Title: [202379] trunk/Source/WebCore
- Revision
- 202379
- Author
- [email protected]
- Date
- 2016-06-23 09:03:18 -0700 (Thu, 23 Jun 2016)
Log Message
Only call sqlite3_initialize() when a SQLite database is actually being opened
https://bugs.webkit.org/show_bug.cgi?id=159033
Reviewed by Brady Eidson.
Only call sqlite3_initialize() when a SQLite database is actually being opened
instead of doing it unconditionally. sqlite3_initialize() was previously called
in the SQLiteDatabase constructor which gets called on WebContent process
initialization because a DatabaseTracker is constructed on initialization and
DatabaseTracker has a SQLiteDatabase data member.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::initializeSQLiteIfNecessary):
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::SQLiteDatabase): Deleted.
* platform/sql/SQLiteDatabase.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (202378 => 202379)
--- trunk/Source/WebCore/ChangeLog 2016-06-23 15:10:46 UTC (rev 202378)
+++ trunk/Source/WebCore/ChangeLog 2016-06-23 16:03:18 UTC (rev 202379)
@@ -1,3 +1,22 @@
+2016-06-23 Chris Dumez <[email protected]>
+
+ Only call sqlite3_initialize() when a SQLite database is actually being opened
+ https://bugs.webkit.org/show_bug.cgi?id=159033
+
+ Reviewed by Brady Eidson.
+
+ Only call sqlite3_initialize() when a SQLite database is actually being opened
+ instead of doing it unconditionally. sqlite3_initialize() was previously called
+ in the SQLiteDatabase constructor which gets called on WebContent process
+ initialization because a DatabaseTracker is constructed on initialization and
+ DatabaseTracker has a SQLiteDatabase data member.
+
+ * platform/sql/SQLiteDatabase.cpp:
+ (WebCore::initializeSQLiteIfNecessary):
+ (WebCore::SQLiteDatabase::open):
+ (WebCore::SQLiteDatabase::SQLiteDatabase): Deleted.
+ * platform/sql/SQLiteDatabase.h:
+
2016-06-23 Adam Bergkvist <[email protected]>
WebRTC: Align 'update ICE connection/gathering state' steps with the WebRTC 1.0 specification
Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (202378 => 202379)
--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp 2016-06-23 15:10:46 UTC (rev 202378)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp 2016-06-23 16:03:18 UTC (rev 202379)
@@ -49,15 +49,7 @@
sqlite3_result_error(context, errorMessage.utf8().data(), -1);
}
-SQLiteDatabase::SQLiteDatabase()
- : m_db(0)
- , m_pageSize(-1)
- , m_transactionInProgress(false)
- , m_sharable(false)
- , m_openingThread(0)
- , m_openError(SQLITE_ERROR)
- , m_openErrorMessage()
- , m_lastChangesCount(0)
+static void initializeSQLiteIfNecessary()
{
static std::once_flag flag;
std::call_once(flag, [] {
@@ -77,6 +69,8 @@
});
}
+SQLiteDatabase::SQLiteDatabase() = default;
+
SQLiteDatabase::~SQLiteDatabase()
{
close();
@@ -84,6 +78,8 @@
bool SQLiteDatabase::open(const String& filename, bool forWebSQLDatabase)
{
+ initializeSQLiteIfNecessary();
+
close();
m_openError = SQLiteFileSystem::openDatabase(filename, &m_db, forWebSQLDatabase);
Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.h (202378 => 202379)
--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.h 2016-06-23 15:10:46 UTC (rev 202378)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.h 2016-06-23 16:03:18 UTC (rev 202379)
@@ -145,24 +145,24 @@
void overrideUnauthorizedFunctions();
- sqlite3* m_db;
- int m_pageSize;
+ sqlite3* m_db { nullptr };
+ int m_pageSize { -1 };
- bool m_transactionInProgress;
- bool m_sharable;
+ bool m_transactionInProgress { false };
+ bool m_sharable { false };
Lock m_authorizerLock;
RefPtr<DatabaseAuthorizer> m_authorizer;
Lock m_lockingMutex;
- ThreadIdentifier m_openingThread;
+ ThreadIdentifier m_openingThread { 0 };
Lock m_databaseClosingMutex;
- int m_openError;
+ int m_openError { SQLITE_ERROR };
CString m_openErrorMessage;
- int m_lastChangesCount;
+ int m_lastChangesCount { 0 };
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes