From e34ae353fc98e71801606344c2270932d3770259 Mon Sep 17 00:00:00 2001 From: "weinig@apple.com" Date: Sun, 26 Jan 2014 00:36:23 +0000 Subject: [PATCH] Remove some iOS #ifdefs by adding SQLiteDatabaseTracker to all the builds https://bugs.webkit.org/show_bug.cgi?id=127632 Reviewed by Darin Adler. Move the SQLiteDatabaseTracker and client from platform/sql/ios to platform/sql, as there is nothing iOS specific about it. Then, un-#ifdef all its uses. For ports that don't setup a client, this has no change in behavior. * CMakeLists.txt: * GNUmakefile.list.am: * Modules/webdatabase/DatabaseBackendBase.cpp: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * loader/appcache/ApplicationCacheStorage.cpp: * platform/ScrollableArea.h: (WebCore::ScrollableArea::sendWillRevealEdgeEventsIfNeeded): * platform/sql/SQLiteDatabaseTracker.cpp: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.cpp. * platform/sql/SQLiteDatabaseTracker.h: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.h. * platform/sql/SQLiteDatabaseTrackerClient.h: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTrackerClient.h. * platform/sql/ios: Removed. * platform/sql/ios/SQLiteDatabaseTracker.cpp: Removed. * platform/sql/ios/SQLiteDatabaseTracker.h: Removed. * platform/sql/ios/SQLiteDatabaseTrackerClient.h: Removed. * storage/StorageAreaSync.cpp: (WebCore::StorageAreaSync::openDatabase): (WebCore::StorageAreaSync::sync): * storage/StorageTracker.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162787 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/CMakeLists.txt | 1 + Source/WebCore/ChangeLog | 32 +++++++++ Source/WebCore/GNUmakefile.list.am | 3 + .../Modules/webdatabase/DatabaseBackendBase.cpp | 11 ++- Source/WebCore/WebCore.vcxproj/WebCore.vcxproj | 3 + .../WebCore.vcxproj/WebCore.vcxproj.filters | 9 +++ Source/WebCore/WebCore.xcodeproj/project.pbxproj | 21 ++---- .../loader/appcache/ApplicationCacheStorage.cpp | 80 ++++++---------------- Source/WebCore/platform/ScrollableArea.h | 2 + .../sql/{ios => }/SQLiteDatabaseTracker.cpp | 17 ++--- .../platform/sql/{ios => }/SQLiteDatabaseTracker.h | 3 +- .../sql/{ios => }/SQLiteDatabaseTrackerClient.h | 0 Source/WebCore/storage/StorageAreaSync.cpp | 11 +-- Source/WebCore/storage/StorageTracker.cpp | 29 +++----- 14 files changed, 103 insertions(+), 119 deletions(-) rename Source/WebCore/platform/sql/{ios => }/SQLiteDatabaseTracker.cpp (89%) rename Source/WebCore/platform/sql/{ios => }/SQLiteDatabaseTracker.h (97%) rename Source/WebCore/platform/sql/{ios => }/SQLiteDatabaseTrackerClient.h (100%) diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 764ce28..b16ebd0 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -2057,6 +2057,7 @@ set(WebCore_SOURCES platform/sql/SQLValue.cpp platform/sql/SQLiteAuthorizer.cpp platform/sql/SQLiteDatabase.cpp + platform/sql/SQLiteDatabaseTracker.cpp platform/sql/SQLiteFileSystem.cpp platform/sql/SQLiteStatement.cpp platform/sql/SQLiteTransaction.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index bbbe386..d24120b 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,35 @@ +2014-01-25 Sam Weinig + + Remove some iOS #ifdefs by adding SQLiteDatabaseTracker to all the builds + https://bugs.webkit.org/show_bug.cgi?id=127632 + + Reviewed by Darin Adler. + + Move the SQLiteDatabaseTracker and client from platform/sql/ios to platform/sql, + as there is nothing iOS specific about it. Then, un-#ifdef all its uses. For + ports that don't setup a client, this has no change in behavior. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Modules/webdatabase/DatabaseBackendBase.cpp: + * WebCore.vcxproj/WebCore.vcxproj: + * WebCore.vcxproj/WebCore.vcxproj.filters: + * WebCore.xcodeproj/project.pbxproj: + * loader/appcache/ApplicationCacheStorage.cpp: + * platform/ScrollableArea.h: + (WebCore::ScrollableArea::sendWillRevealEdgeEventsIfNeeded): + * platform/sql/SQLiteDatabaseTracker.cpp: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.cpp. + * platform/sql/SQLiteDatabaseTracker.h: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.h. + * platform/sql/SQLiteDatabaseTrackerClient.h: Copied from Source/WebCore/platform/sql/ios/SQLiteDatabaseTrackerClient.h. + * platform/sql/ios: Removed. + * platform/sql/ios/SQLiteDatabaseTracker.cpp: Removed. + * platform/sql/ios/SQLiteDatabaseTracker.h: Removed. + * platform/sql/ios/SQLiteDatabaseTrackerClient.h: Removed. + * storage/StorageAreaSync.cpp: + (WebCore::StorageAreaSync::openDatabase): + (WebCore::StorageAreaSync::sync): + * storage/StorageTracker.cpp: + 2014-01-25 Anders Carlsson Remove an unused FrameLoaderClient function diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index df63e1d..7d7f9c1 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -5478,6 +5478,9 @@ webcore_platform_sources += \ Source/WebCore/platform/sql/SQLiteAuthorizer.cpp \ Source/WebCore/platform/sql/SQLiteDatabase.cpp \ Source/WebCore/platform/sql/SQLiteDatabase.h \ + Source/WebCore/platform/sql/SQLiteDatabaseTracker.cpp \ + Source/WebCore/platform/sql/SQLiteDatabaseTracker.h \ + Source/WebCore/platform/sql/SQLiteDatabaseTrackerClient.h \ Source/WebCore/platform/sql/SQLiteFileSystem.cpp \ Source/WebCore/platform/sql/SQLiteFileSystem.h \ Source/WebCore/platform/sql/SQLiteStatement.cpp \ diff --git a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp b/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp index f4a56e0..ee45a1d 100644 --- a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp +++ b/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp @@ -40,6 +40,7 @@ #include "DatabaseTracker.h" #include "ExceptionCode.h" #include "Logging.h" +#include "SQLiteDatabaseTracker.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" #include "SecurityOrigin.h" @@ -52,10 +53,6 @@ #include #include -#if PLATFORM(IOS) -#include "SQLiteDatabaseTracker.h" -#endif - // Registering "opened" databases with the DatabaseTracker // ======================================================= // The DatabaseTracker maintains a list of databases that have been @@ -332,9 +329,10 @@ bool DatabaseBackendBase::performOpenAndVerify(bool shouldSetVersionInNewDatabas // Make sure we wait till the background removal of the empty database files finished before trying to open any database. MutexLocker locker(DatabaseTracker::openDatabaseMutex()); } - SQLiteTransactionInProgressAutoCounter transactionCounter; #endif + SQLiteTransactionInProgressAutoCounter transactionCounter; + if (!m_sqliteDatabase.open(m_filename, true)) { errorMessage = formatErrorMessage("unable to open database", m_sqliteDatabase.lastError(), m_sqliteDatabase.lastErrorMsg()); return false; @@ -587,9 +585,8 @@ unsigned long long DatabaseBackendBase::maximumSize() const void DatabaseBackendBase::incrementalVacuumIfNeeded() { -#if PLATFORM(IOS) SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize(); int64_t totalSize = m_sqliteDatabase.totalSize(); if (totalSize <= 10 * freeSpaceSize) { diff --git a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj b/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj index cb7bda0..2ed1a4b 100644 --- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj +++ b/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj @@ -8454,6 +8454,7 @@ + @@ -19510,6 +19511,8 @@ true + + diff --git a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters b/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters index 1326bea..0f653df 100644 --- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters +++ b/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters @@ -1923,6 +1923,9 @@ platform\sql + + platform\sql + platform\sql @@ -8699,6 +8702,12 @@ platform\sql + + platform\sql + + + platform\sql + platform\sql diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 7424222..f1c5ed0 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -9234,9 +9234,9 @@ 7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleIOS.mm; sourceTree = ""; }; 7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESElementIndexUint.cpp; sourceTree = ""; }; 7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESElementIndexUint.h; sourceTree = ""; }; - 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteDatabaseTrackerClient.h; sourceTree = ""; }; - 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteDatabaseTracker.h; sourceTree = ""; }; - 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteDatabaseTracker.cpp; sourceTree = ""; }; + 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteDatabaseTrackerClient.h; path = sql/SQLiteDatabaseTrackerClient.h; sourceTree = ""; }; + 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteDatabaseTracker.h; path = sql/SQLiteDatabaseTracker.h; sourceTree = ""; }; + 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteDatabaseTracker.cpp; path = sql/SQLiteDatabaseTracker.cpp; sourceTree = ""; }; 7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESElementIndexUint.cpp; path = canvas/OESElementIndexUint.cpp; sourceTree = ""; }; 7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESElementIndexUint.h; path = canvas/OESElementIndexUint.h; sourceTree = ""; }; 7E66E23116D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureATC.cpp; path = canvas/WebGLCompressedTextureATC.cpp; sourceTree = ""; }; @@ -14510,7 +14510,9 @@ 1A2E6E560CC551E0004A2062 /* sql */ = { isa = PBXGroup; children = ( - 7E474E1912494DA900235364 /* ios */, + 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */, + 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */, + 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */, 1A2E6E780CC556D5004A2062 /* SQLiteAuthorizer.cpp */, 1A2246430CC98DDB00C05240 /* SQLiteDatabase.cpp */, 1A2246440CC98DDB00C05240 /* SQLiteDatabase.h */, @@ -16209,17 +16211,6 @@ path = icu; sourceTree = ""; }; - 7E474E1912494DA900235364 /* ios */ = { - isa = PBXGroup; - children = ( - 7E474E1D12494DC900235364 /* SQLiteDatabaseTracker.cpp */, - 7E474E1C12494DC900235364 /* SQLiteDatabaseTracker.h */, - 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */, - ); - name = ios; - path = sql/ios; - sourceTree = ""; - }; 7EE6847312D26E5500E79415 /* cf */ = { isa = PBXGroup; children = ( diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp index b66fb8f..40553ec 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -31,21 +31,18 @@ #include "ApplicationCacheHost.h" #include "ApplicationCacheResource.h" #include "FileSystem.h" -#include "URL.h" #include "NotImplemented.h" +#include "SQLiteDatabaseTracker.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" #include "SecurityOrigin.h" +#include "URL.h" #include "UUID.h" -#include #include #include +#include #include -#if PLATFORM(IOS) -#include "SQLiteDatabaseTracker.h" -#endif - namespace WebCore { static const char flatFileSubdirectory[] = "ApplicationCache"; @@ -104,10 +101,8 @@ static unsigned urlHostHash(const URL& url) ApplicationCacheGroup* ApplicationCacheStorage::loadCacheGroup(const URL& manifestURL) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(false); if (!m_database.isOpen()) return 0; @@ -182,10 +177,8 @@ void ApplicationCacheStorage::loadManifestHostHashes() // to avoid trying to open the database over and over if it doesn't exist. hasLoadedHashes = true; -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(false); if (!m_database.isOpen()) return; @@ -229,10 +222,7 @@ ApplicationCacheGroup* ApplicationCacheStorage::cacheGroupForURL(const URL& url) if (!m_database.isOpen()) return 0; -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif // Check the database. Look for all cache groups with a newest cache. SQLiteStatement statement(m_database, "SELECT id, manifestURL, newestCache FROM CacheGroups WHERE newestCache IS NOT NULL"); @@ -280,10 +270,8 @@ ApplicationCacheGroup* ApplicationCacheStorage::cacheGroupForURL(const URL& url) ApplicationCacheGroup* ApplicationCacheStorage::fallbackCacheGroupForURL(const URL& url) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(!url.hasFragmentIdentifier()); // Check if an appropriate cache already exists in memory. @@ -455,10 +443,8 @@ void ApplicationCacheStorage::setDefaultOriginQuota(int64_t quota) bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* origin, int64_t& quota) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0. // Using the count to determine if a record existed or not is a safe way to determine // if a quota of 0 is real, from the record, or from null. @@ -482,10 +468,8 @@ bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* orig bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* origin, int64_t& usage) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + // If an Origins record doesn't exist, then the SUM will be null, // which will become 0, as expected, when converting to a number. SQLiteStatement statement(m_database, "SELECT SUM(Caches.size)" @@ -510,10 +494,8 @@ bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* orig bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(false); if (!m_database.isOpen()) return false; @@ -563,10 +545,8 @@ bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(cons bool ApplicationCacheStorage::storeUpdatedQuotaForOrigin(const SecurityOrigin* origin, int64_t quota) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(true); if (!m_database.isOpen()) return false; @@ -633,10 +613,8 @@ void ApplicationCacheStorage::verifySchemaVersion() void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + if (m_database.isOpen()) return; @@ -950,10 +928,8 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, unsigned bool ApplicationCacheStorage::storeUpdatedType(ApplicationCacheResource* resource, ApplicationCache* cache) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT_UNUSED(cache, cache->storageID()); ASSERT(resource->storageID()); @@ -970,10 +946,8 @@ bool ApplicationCacheStorage::storeUpdatedType(ApplicationCacheResource* resourc bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, ApplicationCache* cache) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(cache->storageID()); openDatabase(true); @@ -1270,10 +1244,8 @@ PassRefPtr ApplicationCacheStorage::loadCache(unsigned storage void ApplicationCacheStorage::remove(ApplicationCache* cache) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + if (!cache->storageID()) return; @@ -1311,10 +1283,8 @@ void ApplicationCacheStorage::remove(ApplicationCache* cache) void ApplicationCacheStorage::empty() { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(false); if (!m_database.isOpen()) @@ -1379,10 +1349,8 @@ bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* dat bool ApplicationCacheStorage::storeCopyOfCache(const String& cacheDirectory, ApplicationCacheHost* cacheHost) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ApplicationCache* cache = cacheHost->applicationCache(); if (!cache) return true; @@ -1419,10 +1387,8 @@ bool ApplicationCacheStorage::storeCopyOfCache(const String& cacheDirectory, App bool ApplicationCacheStorage::manifestURLs(Vector* urls) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(urls); openDatabase(false); if (!m_database.isOpen()) @@ -1441,10 +1407,8 @@ bool ApplicationCacheStorage::manifestURLs(Vector* urls) bool ApplicationCacheStorage::cacheGroupSize(const String& manifestURL, int64_t* size) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(size); openDatabase(false); if (!m_database.isOpen()) @@ -1471,10 +1435,8 @@ bool ApplicationCacheStorage::cacheGroupSize(const String& manifestURL, int64_t* bool ApplicationCacheStorage::deleteCacheGroup(const String& manifestURL) { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + SQLiteTransaction deleteTransaction(m_database); // Check to see if the group is in memory. ApplicationCacheGroup* group = m_cachesInMemory.get(manifestURL); @@ -1526,10 +1488,8 @@ bool ApplicationCacheStorage::deleteCacheGroup(const String& manifestURL) void ApplicationCacheStorage::vacuumDatabaseFile() { -#if PLATFORM(IOS) - // FIXME: Move the PLATFORM(IOS)-guards inside the constructor and destructor of SQLiteTransactionInProgressAutoCounter. SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + openDatabase(false); if (!m_database.isOpen()) return; diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h index b426cc2..8d6f40c 100644 --- a/Source/WebCore/platform/ScrollableArea.h +++ b/Source/WebCore/platform/ScrollableArea.h @@ -254,6 +254,8 @@ protected: bool hasLayerForVerticalScrollbar() const; bool hasLayerForScrollCorner() const; + virtual void sendWillRevealEdgeEventsIfNeeded(const IntPoint&, const IntPoint&) { } + private: virtual IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const; void scrollPositionChanged(const IntPoint&); diff --git a/Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.cpp b/Source/WebCore/platform/sql/SQLiteDatabaseTracker.cpp similarity index 89% rename from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.cpp rename to Source/WebCore/platform/sql/SQLiteDatabaseTracker.cpp index bf622f4..8438ac1 100644 --- a/Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.cpp +++ b/Source/WebCore/platform/sql/SQLiteDatabaseTracker.cpp @@ -26,20 +26,19 @@ #include "config.h" #include "SQLiteDatabaseTracker.h" +#include #include -#include -#include namespace WebCore { namespace SQLiteDatabaseTracker { -static SQLiteDatabaseTrackerClient* s_staticSQLiteDatabaseTrackerClient = 0; +static SQLiteDatabaseTrackerClient* s_staticSQLiteDatabaseTrackerClient = nullptr; static unsigned s_transactionInProgressCounter = 0; -static Mutex& transactionInProgressMutex() +static std::mutex& transactionInProgressMutex() { - static NeverDestroyed tipMutex; + static NeverDestroyed tipMutex; return tipMutex; } @@ -54,7 +53,8 @@ void incrementTransactionInProgressCount() { if (!s_staticSQLiteDatabaseTrackerClient) return; - MutexLocker lock(transactionInProgressMutex()); + + std::lock_guard lock(transactionInProgressMutex()); s_transactionInProgressCounter++; if (s_transactionInProgressCounter == 1) @@ -65,7 +65,8 @@ void decrementTransactionInProgressCount() { if (!s_staticSQLiteDatabaseTrackerClient) return; - MutexLocker lock(transactionInProgressMutex()); + + std::lock_guard lock(transactionInProgressMutex()); ASSERT(s_transactionInProgressCounter); s_transactionInProgressCounter--; @@ -79,7 +80,7 @@ bool hasTransactionInProgress() { return !s_staticSQLiteDatabaseTrackerClient || s_transactionInProgressCounter > 0; } -#endif // !ASSERT_DISABLED +#endif } // namespace SQLiteDatabaseTracker diff --git a/Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.h b/Source/WebCore/platform/sql/SQLiteDatabaseTracker.h similarity index 97% rename from Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.h rename to Source/WebCore/platform/sql/SQLiteDatabaseTracker.h index 861c646..483d9af 100644 --- a/Source/WebCore/platform/sql/ios/SQLiteDatabaseTracker.h +++ b/Source/WebCore/platform/sql/SQLiteDatabaseTracker.h @@ -27,7 +27,6 @@ #define SQLiteDatabaseTracker_h #include "SQLiteDatabaseTrackerClient.h" -#include namespace WebCore { @@ -40,7 +39,7 @@ void setClient(SQLiteDatabaseTrackerClient*); #if !ASSERT_DISABLED bool hasTransactionInProgress(); -#endif // !ASSERT_DISABLED +#endif }; diff --git a/Source/WebCore/platform/sql/ios/SQLiteDatabaseTrackerClient.h b/Source/WebCore/platform/sql/SQLiteDatabaseTrackerClient.h similarity index 100% rename from Source/WebCore/platform/sql/ios/SQLiteDatabaseTrackerClient.h rename to Source/WebCore/platform/sql/SQLiteDatabaseTrackerClient.h diff --git a/Source/WebCore/storage/StorageAreaSync.cpp b/Source/WebCore/storage/StorageAreaSync.cpp index 7b0267f..eea5ebe 100644 --- a/Source/WebCore/storage/StorageAreaSync.cpp +++ b/Source/WebCore/storage/StorageAreaSync.cpp @@ -29,6 +29,7 @@ #include "EventNames.h" #include "FileSystem.h" #include "HTMLElement.h" +#include "SQLiteDatabaseTracker.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" @@ -41,10 +42,6 @@ #include #include -#if PLATFORM(IOS) -#include "SQLiteDatabaseTracker.h" -#endif - namespace WebCore { // If the StorageArea undergoes rapid changes, don't sync each change to disk. @@ -236,9 +233,8 @@ void StorageAreaSync::openDatabase(OpenDatabaseParamType openingStrategy) ASSERT(!m_database.isOpen()); ASSERT(!m_databaseOpenFailed); -#if PLATFORM(IOS) SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier); if (!fileExists(databaseFilename) && openingStrategy == SkipIfNonExistent) @@ -410,9 +406,8 @@ void StorageAreaSync::sync(bool clearItems, const HashMap& items return; } -#if PLATFORM(IOS) SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + // If the clear flag is set, then we clear all items out before we write any new ones in. if (clearItems) { SQLiteStatement clear(m_database, "DELETE FROM ItemTable"); diff --git a/Source/WebCore/storage/StorageTracker.cpp b/Source/WebCore/storage/StorageTracker.cpp index 976dcda..dc236c3 100644 --- a/Source/WebCore/storage/StorageTracker.cpp +++ b/Source/WebCore/storage/StorageTracker.cpp @@ -28,12 +28,13 @@ #include "DatabaseThread.h" #include "FileSystem.h" -#include "StorageThread.h" #include "Logging.h" #include "PageGroup.h" +#include "SQLiteDatabaseTracker.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" #include "SecurityOrigin.h" +#include "StorageThread.h" #include "StorageTrackerClient.h" #include "TextEncoding.h" #include @@ -42,10 +43,6 @@ #include #include -#if PLATFORM(IOS) -#include "SQLiteDatabaseTracker.h" -#endif - namespace WebCore { static StorageTracker* storageTracker = 0; @@ -136,9 +133,9 @@ void StorageTracker::openTrackerDatabase(bool createIfDoesNotExist) { ASSERT(m_isActive); ASSERT(!isMainThread()); -#if PLATFORM(IOS) + SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(!m_databaseMutex.tryLock()); if (m_database.isOpen()) @@ -199,9 +196,8 @@ void StorageTracker::syncImportOriginIdentifiers() openTrackerDatabase(false); if (m_database.isOpen()) { -#if PLATFORM(IOS) SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + SQLiteStatement statement(m_database, "SELECT origin FROM Origins"); if (statement.prepare() != SQLResultOk) { LOG_ERROR("Failed to prepare statement."); @@ -242,9 +238,9 @@ void StorageTracker::syncImportOriginIdentifiers() void StorageTracker::syncFileSystemAndTrackerDatabase() { ASSERT(!isMainThread()); -#if PLATFORM(IOS) + SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif + ASSERT(m_isActive); Vector paths; @@ -317,9 +313,8 @@ void StorageTracker::setOriginDetails(const String& originIdentifier, const Stri void StorageTracker::syncSetOriginDetails(const String& originIdentifier, const String& databaseFile) { ASSERT(!isMainThread()); -#if PLATFORM(IOS) + SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif MutexLocker locker(m_databaseMutex); @@ -389,9 +384,8 @@ void StorageTracker::deleteAllOrigins() void StorageTracker::syncDeleteAllOrigins() { ASSERT(!isMainThread()); -#if PLATFORM(IOS) + SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif MutexLocker locker(m_databaseMutex); @@ -486,9 +480,8 @@ void StorageTracker::deleteOrigin(SecurityOrigin* origin) void StorageTracker::syncDeleteOrigin(const String& originIdentifier) { ASSERT(!isMainThread()); -#if PLATFORM(IOS) + SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif MutexLocker locker(m_databaseMutex); @@ -601,9 +594,7 @@ String StorageTracker::databasePathForOrigin(const String& originIdentifier) if (!m_database.isOpen()) return String(); -#if PLATFORM(IOS) SQLiteTransactionInProgressAutoCounter transactionCounter; -#endif SQLiteStatement pathStatement(m_database, "SELECT path FROM Origins WHERE origin=?"); if (pathStatement.prepare() != SQLResultOk) { -- 1.8.3.1