WebKit Bugzilla
Attachment 340338 Details for
Bug 185616
: Add runtime check for multi-thread support of SQLite database.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
PAtCH
185616.diff (text/plain), 8.76 KB, created by
Basuke Suzuki
on 2018-05-14 12:18:12 PDT
(
hide
)
Description:
PAtCH
Filename:
MIME Type:
Creator:
Basuke Suzuki
Created:
2018-05-14 12:18:12 PDT
Size:
8.76 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 20d7b2350c5..ccaaa038c4f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-14 Basuke Suzuki <Basuke.Suzuki@sony.com> >+ >+ Improve multi-thread support of SQLite database. >+ https://bugs.webkit.org/show_bug.cgi?id=185616 >+ >+ Add runtime check of sqlite library support for multi-threading. >+ Also rename the method name to more appropriate and positive one. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests because there's no new behavior. >+ >+ * Modules/webdatabase/DatabaseTracker.cpp: >+ (WebCore::DatabaseTracker::openTrackerDatabase): >+ * platform/sql/SQLiteDatabase.cpp: >+ (WebCore::SQLiteDatabase::allowMultiThreadUsage): >+ (WebCore::SQLiteDatabase::disableThreadingChecks): Deleted. >+ * platform/sql/SQLiteDatabase.h: >+ (WebCore::SQLiteDatabase::disableThreadingChecks): Deleted. >+ > 2018-05-11 Chris Dumez <cdumez@apple.com> > > REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >index 8fda62a6e63..44786501574 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >@@ -119,7 +119,7 @@ void DatabaseTracker::openTrackerDatabase(TrackerCreationAction createAction) > LOG_ERROR("Failed to open databasePath %s.", databasePath.utf8().data()); > return; > } >- m_database.disableThreadingChecks(); >+ m_database.allowMultiThreadUsage(); > > if (!m_database.tableExists("Origins")) { > if (!m_database.executeCommand("CREATE TABLE Origins (origin TEXT UNIQUE ON CONFLICT REPLACE, quota INTEGER NOT NULL ON CONFLICT FAIL);")) { >diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.cpp b/Source/WebCore/platform/sql/SQLiteDatabase.cpp >index 2095ee8118a..f4b47db22cd 100644 >--- a/Source/WebCore/platform/sql/SQLiteDatabase.cpp >+++ b/Source/WebCore/platform/sql/SQLiteDatabase.cpp >@@ -373,14 +373,21 @@ const char* SQLiteDatabase::lastErrorMsg() > return m_openErrorMessage.isNull() ? notOpenErrorMessage : m_openErrorMessage.data(); > } > >-#ifndef NDEBUG >-void SQLiteDatabase::disableThreadingChecks() >+bool SQLiteDatabase::allowMultiThreadUsage() > { >+ // The SQLite library must be compiled with thread support. >+ // https://www.sqlite.org/c3ref/threadsafe.html >+ bool builtWithThreadingSupport = (sqlite3_threadsafe() == SQLITE_OK); >+ ASSERT(builtWithThreadingSupport); >+ >+#ifndef NDEBUG > // Note that SQLite could be compiled with -DTHREADSAFE, or you may have turned off the mutexes. > m_sharable = true; >-} > #endif > >+ return builtWithThreadingSupport; >+} >+ > int SQLiteDatabase::authorizerFunction(void* userData, int actionCode, const char* parameter1, const char* parameter2, const char* /*databaseName*/, const char* /*trigger_or_view*/) > { > DatabaseAuthorizer* auth = static_cast<DatabaseAuthorizer*>(userData); >diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.h b/Source/WebCore/platform/sql/SQLiteDatabase.h >index debb7c8ca11..6d1b4c31673 100644 >--- a/Source/WebCore/platform/sql/SQLiteDatabase.h >+++ b/Source/WebCore/platform/sql/SQLiteDatabase.h >@@ -128,13 +128,9 @@ public: > WEBCORE_EXPORT void setCollationFunction(const String& collationName, WTF::Function<int(int, const void*, int, const void*)>&&); > void removeCollationFunction(const String& collationName); > >- // Set this flag to allow access from multiple threads. Not all multi-threaded accesses are safe! >+ // Not all multi-threaded accesses are safe! > // See http://www.sqlite.org/cvstrac/wiki?p=MultiThreading for more info. >-#ifndef NDEBUG >- WEBCORE_EXPORT void disableThreadingChecks(); >-#else >- WEBCORE_EXPORT void disableThreadingChecks() {} >-#endif >+ WEBCORE_EXPORT bool allowMultiThreadUsage(); > > private: > static int authorizerFunction(void*, int, const char*, const char*, const char*, const char*); >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5b571af803b..2a4ed75d00a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2018-05-14 Basuke Suzuki <Basuke.Suzuki@sony.com> >+ >+ Improve multi-thread support of SQLite database. >+ https://bugs.webkit.org/show_bug.cgi?id=185616 >+ >+ Add runtime check of sqlite library support for multi-threading. >+ Also rename the method name to more appropriate and positive one. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/cache/NetworkCacheStatistics.cpp: >+ (WebKit::NetworkCache::Statistics::initialize): >+ * UIProcess/WebStorage/LocalStorageDatabase.cpp: >+ (WebKit::LocalStorageDatabase::tryToOpenDatabase): >+ * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: >+ (WebKit::LocalStorageDatabaseTracker::openTrackerDatabase): >+ > 2018-05-11 Charles Vazac <cvazac@gmail.com> > > Runtime feature flag for Server-Timing >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >index dad8c3c5ffb..2a4d95963b7 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >@@ -103,7 +103,7 @@ void Statistics::initialize(const String& databasePath) > > LOG(NetworkCache, "(NetworkProcess) Opening network cache statistics database at %s...", databasePath.utf8().data()); > m_database.open(databasePath); >- m_database.disableThreadingChecks(); >+ m_database.allowMultiThreadUsage(); > if (!m_database.isOpen()) { > LOG_ERROR("Network cache statistics: Failed to open / create the network cache statistics database"); > return; >diff --git a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >index 826158fb14c..f802826ace1 100644 >--- a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >+++ b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >@@ -100,7 +100,7 @@ bool LocalStorageDatabase::tryToOpenDatabase(DatabaseOpeningStrategy openingStra > > // Since a WorkQueue isn't bound to a specific thread, we have to disable threading checks > // even though we never access the database from different threads simultaneously. >- m_database.disableThreadingChecks(); >+ m_database.allowMultiThreadUsage(); > > if (!migrateItemTableIfNeeded()) { > // We failed to migrate the item table. In order to avoid trying to migrate the table over and over, >diff --git a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >index 821102b7be1..02f6a54b3bd 100644 >--- a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >+++ b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >@@ -240,7 +240,7 @@ void LocalStorageDatabaseTracker::openTrackerDatabase(DatabaseOpeningStrategy op > > // Since a WorkQueue isn't bound to a specific thread, we have to disable threading checks > // even though we never access the database from different threads simultaneously. >- m_database.disableThreadingChecks(); >+ m_database.allowMultiThreadUsage(); > > if (m_database.tableExists("Origins")) > return; >diff --git a/Source/WebKitLegacy/ChangeLog b/Source/WebKitLegacy/ChangeLog >index c2ba26deb74..cd101390fd1 100644 >--- a/Source/WebKitLegacy/ChangeLog >+++ b/Source/WebKitLegacy/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-14 Basuke Suzuki <Basuke.Suzuki@sony.com> >+ >+ Improve multi-thread support of SQLite database. >+ https://bugs.webkit.org/show_bug.cgi?id=185616 >+ >+ Add runtime check of sqlite library support for multi-threading. >+ Also rename the method name to more appropriate and positive one. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Storage/StorageTracker.cpp: >+ (WebKit::StorageTracker::openTrackerDatabase): >+ > 2018-05-11 Charles Vazac <cvazac@gmail.com> > > Runtime feature flag for Server-Timing >diff --git a/Source/WebKitLegacy/Storage/StorageTracker.cpp b/Source/WebKitLegacy/Storage/StorageTracker.cpp >index ddbdb22ea0f..c10fb9d9a49 100644 >--- a/Source/WebKitLegacy/Storage/StorageTracker.cpp >+++ b/Source/WebKitLegacy/Storage/StorageTracker.cpp >@@ -140,7 +140,7 @@ void StorageTracker::openTrackerDatabase(bool createIfDoesNotExist) > return; > } > >- m_database.disableThreadingChecks(); >+ m_database.allowMultiThreadUsage(); > > if (!m_database.tableExists("Origins")) { > if (!m_database.executeCommand("CREATE TABLE Origins (origin TEXT UNIQUE ON CONFLICT REPLACE, path TEXT);"))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185616
: 340338 |
340357