Clean up Storage code
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2016 23:28:12 +0000 (23:28 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2016 23:28:12 +0000 (23:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164562

Reviewed by Brady Eidson.

Source/WebKit:

Some classes were in WebCore namespace instead of WebKit.

* Storage/StorageAreaImpl.cpp:
(WebKit::StorageAreaImpl::StorageAreaImpl):
(WebKit::StorageAreaImpl::create):
(WebKit::StorageAreaImpl::copy):
(WebCore::StorageAreaImpl::~StorageAreaImpl): Deleted.
(WebCore::StorageAreaImpl::StorageAreaImpl): Deleted.
(WebCore::StorageAreaImpl::create): Deleted.
(WebCore::StorageAreaImpl::copy): Deleted.
(WebCore::StorageAreaImpl::canAccessStorage): Deleted.
(WebCore::StorageAreaImpl::storageType): Deleted.
(WebCore::StorageAreaImpl::length): Deleted.
(WebCore::StorageAreaImpl::key): Deleted.
(WebCore::StorageAreaImpl::item): Deleted.
(WebCore::StorageAreaImpl::setItem): Deleted.
(WebCore::StorageAreaImpl::removeItem): Deleted.
(WebCore::StorageAreaImpl::clear): Deleted.
(WebCore::StorageAreaImpl::contains): Deleted.
(WebCore::StorageAreaImpl::importItems): Deleted.
(WebCore::StorageAreaImpl::close): Deleted.
(WebCore::StorageAreaImpl::clearForOriginDeletion): Deleted.
(WebCore::StorageAreaImpl::sync): Deleted.
(WebCore::StorageAreaImpl::blockUntilImportComplete): Deleted.
(WebCore::StorageAreaImpl::memoryBytesUsedByCache): Deleted.
(WebCore::StorageAreaImpl::incrementAccessCount): Deleted.
(WebCore::StorageAreaImpl::decrementAccessCount): Deleted.
(WebCore::StorageAreaImpl::closeDatabaseTimerFired): Deleted.
(WebCore::StorageAreaImpl::closeDatabaseIfIdle): Deleted.
(WebCore::StorageAreaImpl::dispatchStorageEvent): Deleted.
* Storage/StorageAreaImpl.h:
* Storage/StorageAreaSync.cpp:
(WebKit::StorageAreaSync::StorageAreaSync):
(WebKit::StorageAreaSync::create):
(WebCore::StorageAreaSync::StorageAreaSync): Deleted.
(WebCore::StorageAreaSync::create): Deleted.
(WebCore::StorageAreaSync::~StorageAreaSync): Deleted.
(WebCore::StorageAreaSync::scheduleFinalSync): Deleted.
(WebCore::StorageAreaSync::scheduleItemForSync): Deleted.
(WebCore::StorageAreaSync::scheduleClear): Deleted.
(WebCore::StorageAreaSync::scheduleCloseDatabase): Deleted.
(WebCore::StorageAreaSync::syncTimerFired): Deleted.
(WebCore::StorageAreaSync::openDatabase): Deleted.
(WebCore::StorageAreaSync::migrateItemTableIfNeeded): Deleted.
(WebCore::StorageAreaSync::performImport): Deleted.
(WebCore::StorageAreaSync::markImported): Deleted.
(WebCore::StorageAreaSync::blockUntilImportComplete): Deleted.
(WebCore::StorageAreaSync::sync): Deleted.
(WebCore::StorageAreaSync::performSync): Deleted.
(WebCore::StorageAreaSync::deleteEmptyDatabase): Deleted.
(WebCore::StorageAreaSync::scheduleSync): Deleted.
* Storage/StorageAreaSync.h:
* Storage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
(WebKit::StorageNamespaceImpl::getOrCreateLocalStorageNamespace):
(WebKit::StorageNamespaceImpl::storageArea):
(WebCore::localStorageNamespaceMap): Deleted.
(WebCore::StorageNamespaceImpl::createSessionStorageNamespace): Deleted.
(WebCore::StorageNamespaceImpl::getOrCreateLocalStorageNamespace): Deleted.
(WebCore::StorageNamespaceImpl::StorageNamespaceImpl): Deleted.
(WebCore::StorageNamespaceImpl::~StorageNamespaceImpl): Deleted.
(WebCore::StorageNamespaceImpl::copy): Deleted.
(WebCore::StorageNamespaceImpl::storageArea): Deleted.
(WebCore::StorageNamespaceImpl::close): Deleted.
(WebCore::StorageNamespaceImpl::clearOriginForDeletion): Deleted.
(WebCore::StorageNamespaceImpl::clearAllOriginsForDeletion): Deleted.
(WebCore::StorageNamespaceImpl::sync): Deleted.
(WebCore::StorageNamespaceImpl::closeIdleLocalStorageDatabases): Deleted.
* Storage/StorageNamespaceImpl.h:
* Storage/StorageTracker.cpp:
(WebCore::StorageTracker::initializeTracker): Deleted.
(WebCore::StorageTracker::internalInitialize): Deleted.
(WebCore::StorageTracker::tracker): Deleted.
(WebCore::StorageTracker::StorageTracker): Deleted.
(WebCore::StorageTracker::setDatabaseDirectoryPath): Deleted.
(WebCore::StorageTracker::databaseDirectoryPath): Deleted.
(WebCore::StorageTracker::trackerDatabasePath): Deleted.
(WebCore::ensureDatabaseFileExists): Deleted.
(WebCore::StorageTracker::openTrackerDatabase): Deleted.
(WebCore::StorageTracker::importOriginIdentifiers): Deleted.
(WebCore::StorageTracker::finishedImportingOriginIdentifiers): Deleted.
(WebCore::StorageTracker::syncImportOriginIdentifiers): Deleted.
(WebCore::StorageTracker::syncFileSystemAndTrackerDatabase): Deleted.
(WebCore::StorageTracker::setOriginDetails): Deleted.
(WebCore::StorageTracker::syncSetOriginDetails): Deleted.
(WebCore::StorageTracker::origins): Deleted.
(WebCore::StorageTracker::deleteAllOrigins): Deleted.
(WebCore::truncateDatabaseFile): Deleted.
(WebCore::StorageTracker::syncDeleteAllOrigins): Deleted.
(WebCore::StorageTracker::deleteOriginWithIdentifier): Deleted.
(WebCore::StorageTracker::deleteOrigin): Deleted.
(WebCore::StorageTracker::syncDeleteOrigin): Deleted.
(WebCore::StorageTracker::willDeleteAllOrigins): Deleted.
(WebCore::StorageTracker::willDeleteOrigin): Deleted.
(WebCore::StorageTracker::canDeleteOrigin): Deleted.
(WebCore::StorageTracker::cancelDeletingOrigin): Deleted.
(WebCore::StorageTracker::isActive): Deleted.
(WebCore::StorageTracker::setIsActive): Deleted.
(WebCore::StorageTracker::databasePathForOrigin): Deleted.
(WebCore::StorageTracker::diskUsageForOrigin): Deleted.
* Storage/StorageTracker.h:
(WebCore::StorageTracker::storageDatabaseIdleInterval): Deleted.
(WebCore::StorageTracker::setStorageDatabaseIdleInterval): Deleted.
* Storage/WebStorageNamespaceProvider.cpp:
(storageNamespaceProviders): Deleted.
(WebStorageNamespaceProvider::create): Deleted.
(WebStorageNamespaceProvider::WebStorageNamespaceProvider): Deleted.
(WebStorageNamespaceProvider::~WebStorageNamespaceProvider): Deleted.
(WebStorageNamespaceProvider::closeLocalStorage): Deleted.
(WebStorageNamespaceProvider::clearLocalStorageForAllOrigins): Deleted.
(WebStorageNamespaceProvider::clearLocalStorageForOrigin): Deleted.
(WebStorageNamespaceProvider::closeIdleLocalStorageDatabases): Deleted.
(WebStorageNamespaceProvider::syncLocalStorage): Deleted.
(WebStorageNamespaceProvider::createSessionStorageNamespace): Deleted.
(WebStorageNamespaceProvider::createLocalStorageNamespace): Deleted.
(WebStorageNamespaceProvider::createTransientLocalStorageNamespace): Deleted.
* Storage/WebStorageNamespaceProvider.h:
* WebCoreSupport/WebResourceLoadScheduler.h:
* WebCoreSupport/WebViewGroup.cpp:
(WebViewGroup::storageNamespaceProvider):

Source/WebKit/mac:

* Storage/WebStorageManager.mm:
(-[WebStorageManager origins]):
(-[WebStorageManager deleteAllOrigins]):
(-[WebStorageManager deleteOrigin:]):
(-[WebStorageManager diskUsageForOrigin:]):
(-[WebStorageManager syncLocalStorage]):
(-[WebStorageManager syncFileSystemAndTrackerDatabase]):
(+[WebStorageManager setStorageDatabaseIdleInterval:]):
(+[WebStorageManager closeIdleLocalStorageDatabases]):
(WebKitInitializeStorageIfNecessary):
* WebView/WebView.mm:
(+[WebView _applicationWillTerminate]):

Source/WebKit2:

Use more Refs!

* NetworkProcess/CustomProtocols/CustomProtocolManager.h:
* Platform/IPC/Connection.cpp:
(IPC::Connection::addWorkQueueMessageReceiver):
* Platform/IPC/Connection.h:
* UIProcess/Storage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
* UIProcess/Storage/LocalStorageDatabase.h:
* UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::create):
(WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
* UIProcess/Storage/LocalStorageDatabaseTracker.h:
* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
(WebKit::StorageManager::StorageManager):
* UIProcess/Storage/StorageManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::initializeConnection):
* WebProcess/Plugins/PluginProcessConnectionManager.cpp:
(WebKit::PluginProcessConnectionManager::initializeConnection):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::initializeConnection):
* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::initializeConnection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208499 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
Source/WebKit/ChangeLog
Source/WebKit/Storage/StorageAreaImpl.cpp
Source/WebKit/Storage/StorageAreaImpl.h
Source/WebKit/Storage/StorageAreaSync.cpp
Source/WebKit/Storage/StorageAreaSync.h
Source/WebKit/Storage/StorageNamespaceImpl.cpp
Source/WebKit/Storage/StorageNamespaceImpl.h
Source/WebKit/Storage/StorageTracker.cpp
Source/WebKit/Storage/StorageTracker.h
Source/WebKit/Storage/WebStorageNamespaceProvider.cpp
Source/WebKit/Storage/WebStorageNamespaceProvider.h
Source/WebKit/WebCoreSupport/WebResourceLoadScheduler.h
Source/WebKit/WebCoreSupport/WebViewGroup.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Storage/WebStorageManager.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/CustomProtocols/CustomProtocolManager.h
Source/WebKit2/Platform/IPC/Connection.cpp
Source/WebKit2/Platform/IPC/Connection.h
Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp
Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.h
Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.cpp
Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.h
Source/WebKit2/UIProcess/Storage/StorageManager.cpp
Source/WebKit2/UIProcess/Storage/StorageManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.cpp

index 408820b..9166325 100644 (file)
@@ -1,3 +1,131 @@
+2016-11-09  Alex Christensen  <achristensen@webkit.org>
+
+        Clean up Storage code
+        https://bugs.webkit.org/show_bug.cgi?id=164562
+
+        Reviewed by Brady Eidson.
+
+        Some classes were in WebCore namespace instead of WebKit.
+
+        * Storage/StorageAreaImpl.cpp:
+        (WebKit::StorageAreaImpl::StorageAreaImpl):
+        (WebKit::StorageAreaImpl::create):
+        (WebKit::StorageAreaImpl::copy):
+        (WebCore::StorageAreaImpl::~StorageAreaImpl): Deleted.
+        (WebCore::StorageAreaImpl::StorageAreaImpl): Deleted.
+        (WebCore::StorageAreaImpl::create): Deleted.
+        (WebCore::StorageAreaImpl::copy): Deleted.
+        (WebCore::StorageAreaImpl::canAccessStorage): Deleted.
+        (WebCore::StorageAreaImpl::storageType): Deleted.
+        (WebCore::StorageAreaImpl::length): Deleted.
+        (WebCore::StorageAreaImpl::key): Deleted.
+        (WebCore::StorageAreaImpl::item): Deleted.
+        (WebCore::StorageAreaImpl::setItem): Deleted.
+        (WebCore::StorageAreaImpl::removeItem): Deleted.
+        (WebCore::StorageAreaImpl::clear): Deleted.
+        (WebCore::StorageAreaImpl::contains): Deleted.
+        (WebCore::StorageAreaImpl::importItems): Deleted.
+        (WebCore::StorageAreaImpl::close): Deleted.
+        (WebCore::StorageAreaImpl::clearForOriginDeletion): Deleted.
+        (WebCore::StorageAreaImpl::sync): Deleted.
+        (WebCore::StorageAreaImpl::blockUntilImportComplete): Deleted.
+        (WebCore::StorageAreaImpl::memoryBytesUsedByCache): Deleted.
+        (WebCore::StorageAreaImpl::incrementAccessCount): Deleted.
+        (WebCore::StorageAreaImpl::decrementAccessCount): Deleted.
+        (WebCore::StorageAreaImpl::closeDatabaseTimerFired): Deleted.
+        (WebCore::StorageAreaImpl::closeDatabaseIfIdle): Deleted.
+        (WebCore::StorageAreaImpl::dispatchStorageEvent): Deleted.
+        * Storage/StorageAreaImpl.h:
+        * Storage/StorageAreaSync.cpp:
+        (WebKit::StorageAreaSync::StorageAreaSync):
+        (WebKit::StorageAreaSync::create):
+        (WebCore::StorageAreaSync::StorageAreaSync): Deleted.
+        (WebCore::StorageAreaSync::create): Deleted.
+        (WebCore::StorageAreaSync::~StorageAreaSync): Deleted.
+        (WebCore::StorageAreaSync::scheduleFinalSync): Deleted.
+        (WebCore::StorageAreaSync::scheduleItemForSync): Deleted.
+        (WebCore::StorageAreaSync::scheduleClear): Deleted.
+        (WebCore::StorageAreaSync::scheduleCloseDatabase): Deleted.
+        (WebCore::StorageAreaSync::syncTimerFired): Deleted.
+        (WebCore::StorageAreaSync::openDatabase): Deleted.
+        (WebCore::StorageAreaSync::migrateItemTableIfNeeded): Deleted.
+        (WebCore::StorageAreaSync::performImport): Deleted.
+        (WebCore::StorageAreaSync::markImported): Deleted.
+        (WebCore::StorageAreaSync::blockUntilImportComplete): Deleted.
+        (WebCore::StorageAreaSync::sync): Deleted.
+        (WebCore::StorageAreaSync::performSync): Deleted.
+        (WebCore::StorageAreaSync::deleteEmptyDatabase): Deleted.
+        (WebCore::StorageAreaSync::scheduleSync): Deleted.
+        * Storage/StorageAreaSync.h:
+        * Storage/StorageNamespaceImpl.cpp:
+        (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
+        (WebKit::StorageNamespaceImpl::getOrCreateLocalStorageNamespace):
+        (WebKit::StorageNamespaceImpl::storageArea):
+        (WebCore::localStorageNamespaceMap): Deleted.
+        (WebCore::StorageNamespaceImpl::createSessionStorageNamespace): Deleted.
+        (WebCore::StorageNamespaceImpl::getOrCreateLocalStorageNamespace): Deleted.
+        (WebCore::StorageNamespaceImpl::StorageNamespaceImpl): Deleted.
+        (WebCore::StorageNamespaceImpl::~StorageNamespaceImpl): Deleted.
+        (WebCore::StorageNamespaceImpl::copy): Deleted.
+        (WebCore::StorageNamespaceImpl::storageArea): Deleted.
+        (WebCore::StorageNamespaceImpl::close): Deleted.
+        (WebCore::StorageNamespaceImpl::clearOriginForDeletion): Deleted.
+        (WebCore::StorageNamespaceImpl::clearAllOriginsForDeletion): Deleted.
+        (WebCore::StorageNamespaceImpl::sync): Deleted.
+        (WebCore::StorageNamespaceImpl::closeIdleLocalStorageDatabases): Deleted.
+        * Storage/StorageNamespaceImpl.h:
+        * Storage/StorageTracker.cpp:
+        (WebCore::StorageTracker::initializeTracker): Deleted.
+        (WebCore::StorageTracker::internalInitialize): Deleted.
+        (WebCore::StorageTracker::tracker): Deleted.
+        (WebCore::StorageTracker::StorageTracker): Deleted.
+        (WebCore::StorageTracker::setDatabaseDirectoryPath): Deleted.
+        (WebCore::StorageTracker::databaseDirectoryPath): Deleted.
+        (WebCore::StorageTracker::trackerDatabasePath): Deleted.
+        (WebCore::ensureDatabaseFileExists): Deleted.
+        (WebCore::StorageTracker::openTrackerDatabase): Deleted.
+        (WebCore::StorageTracker::importOriginIdentifiers): Deleted.
+        (WebCore::StorageTracker::finishedImportingOriginIdentifiers): Deleted.
+        (WebCore::StorageTracker::syncImportOriginIdentifiers): Deleted.
+        (WebCore::StorageTracker::syncFileSystemAndTrackerDatabase): Deleted.
+        (WebCore::StorageTracker::setOriginDetails): Deleted.
+        (WebCore::StorageTracker::syncSetOriginDetails): Deleted.
+        (WebCore::StorageTracker::origins): Deleted.
+        (WebCore::StorageTracker::deleteAllOrigins): Deleted.
+        (WebCore::truncateDatabaseFile): Deleted.
+        (WebCore::StorageTracker::syncDeleteAllOrigins): Deleted.
+        (WebCore::StorageTracker::deleteOriginWithIdentifier): Deleted.
+        (WebCore::StorageTracker::deleteOrigin): Deleted.
+        (WebCore::StorageTracker::syncDeleteOrigin): Deleted.
+        (WebCore::StorageTracker::willDeleteAllOrigins): Deleted.
+        (WebCore::StorageTracker::willDeleteOrigin): Deleted.
+        (WebCore::StorageTracker::canDeleteOrigin): Deleted.
+        (WebCore::StorageTracker::cancelDeletingOrigin): Deleted.
+        (WebCore::StorageTracker::isActive): Deleted.
+        (WebCore::StorageTracker::setIsActive): Deleted.
+        (WebCore::StorageTracker::databasePathForOrigin): Deleted.
+        (WebCore::StorageTracker::diskUsageForOrigin): Deleted.
+        * Storage/StorageTracker.h:
+        (WebCore::StorageTracker::storageDatabaseIdleInterval): Deleted.
+        (WebCore::StorageTracker::setStorageDatabaseIdleInterval): Deleted.
+        * Storage/WebStorageNamespaceProvider.cpp:
+        (storageNamespaceProviders): Deleted.
+        (WebStorageNamespaceProvider::create): Deleted.
+        (WebStorageNamespaceProvider::WebStorageNamespaceProvider): Deleted.
+        (WebStorageNamespaceProvider::~WebStorageNamespaceProvider): Deleted.
+        (WebStorageNamespaceProvider::closeLocalStorage): Deleted.
+        (WebStorageNamespaceProvider::clearLocalStorageForAllOrigins): Deleted.
+        (WebStorageNamespaceProvider::clearLocalStorageForOrigin): Deleted.
+        (WebStorageNamespaceProvider::closeIdleLocalStorageDatabases): Deleted.
+        (WebStorageNamespaceProvider::syncLocalStorage): Deleted.
+        (WebStorageNamespaceProvider::createSessionStorageNamespace): Deleted.
+        (WebStorageNamespaceProvider::createLocalStorageNamespace): Deleted.
+        (WebStorageNamespaceProvider::createTransientLocalStorageNamespace): Deleted.
+        * Storage/WebStorageNamespaceProvider.h:
+        * WebCoreSupport/WebResourceLoadScheduler.h:
+        * WebCoreSupport/WebViewGroup.cpp:
+        (WebViewGroup::storageNamespaceProvider):
+
 2016-11-02  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Copy build results to AAS 'Program Files' folder.
index a6550da..cdc30c7 100644 (file)
 #include <WebCore/StorageMap.h>
 #include <wtf/MainThread.h>
 
-namespace WebCore {
+using namespace WebCore;
+
+namespace WebKit {
 
 StorageAreaImpl::~StorageAreaImpl()
 {
     ASSERT(isMainThread());
 }
 
-inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
+inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, RefPtr<SecurityOrigin>&& origin, RefPtr<StorageSyncManager>&& syncManager, unsigned quota)
     : m_storageType(storageType)
-    , m_securityOrigin(origin)
+    , m_securityOrigin(WTFMove(origin))
     , m_storageMap(StorageMap::create(quota))
-    , m_storageSyncManager(syncManager)
+    , m_storageSyncManager(WTFMove(syncManager))
 #ifndef NDEBUG
     , m_isShutdown(false)
 #endif
@@ -61,33 +63,31 @@ inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<Secu
     StorageTracker::tracker();
 }
 
-Ref<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
+Ref<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, RefPtr<SecurityOrigin>&& origin, RefPtr<StorageSyncManager>&& syncManager, unsigned quota)
 {
-    Ref<StorageAreaImpl> area = adoptRef(*new StorageAreaImpl(storageType, origin, syncManager, quota));
-
+    Ref<StorageAreaImpl> area = adoptRef(*new StorageAreaImpl(storageType, WTFMove(origin), WTFMove(syncManager), quota));
     // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,
     // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
     if (area->m_storageSyncManager) {
-        area->m_storageAreaSync = StorageAreaSync::create(area->m_storageSyncManager, area.ptr(), area->m_securityOrigin->databaseIdentifier());
+        area->m_storageAreaSync = StorageAreaSync::create(area->m_storageSyncManager.get(), area.copyRef(), area->m_securityOrigin->databaseIdentifier());
         ASSERT(area->m_storageAreaSync);
     }
-
     return area;
 }
 
-PassRefPtr<StorageAreaImpl> StorageAreaImpl::copy()
+Ref<StorageAreaImpl> StorageAreaImpl::copy()
 {
     ASSERT(!m_isShutdown);
-    return adoptRef(new StorageAreaImpl(this));
+    return adoptRef(*new StorageAreaImpl(*this));
 }
 
-StorageAreaImpl::StorageAreaImpl(StorageAreaImpl* area)
-    : m_storageType(area->m_storageType)
-    , m_securityOrigin(area->m_securityOrigin)
-    , m_storageMap(area->m_storageMap)
-    , m_storageSyncManager(area->m_storageSyncManager)
+StorageAreaImpl::StorageAreaImpl(const StorageAreaImpl& area)
+    : m_storageType(area.m_storageType)
+    , m_securityOrigin(area.m_securityOrigin.copyRef())
+    , m_storageMap(area.m_storageMap)
+    , m_storageSyncManager(area.m_storageSyncManager)
 #ifndef NDEBUG
-    , m_isShutdown(area->m_isShutdown)
+    , m_isShutdown(area.m_isShutdown)
 #endif
     , m_accessCount(0)
     , m_closeDatabaseTimer(*this, &StorageAreaImpl::closeDatabaseTimerFired)
index 6cdd9c7..25284a1 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef StorageAreaImpl_h
-#define StorageAreaImpl_h
+#pragma once
 
 #include <WebCore/StorageArea.h>
 #include <WebCore/Timer.h>
 #include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
-
 class SecurityOrigin;
 class StorageMap;
+}
+
+namespace WebKit {
+
 class StorageAreaSync;
 
-class StorageAreaImpl : public StorageArea {
+class StorageAreaImpl : public WebCore::StorageArea {
 public:
-    static Ref<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
+    static Ref<StorageAreaImpl> create(WebCore::StorageType, RefPtr<WebCore::SecurityOrigin>&&, RefPtr<WebCore::StorageSyncManager>&&, unsigned quota);
     virtual ~StorageAreaImpl();
 
     unsigned length() override;
     String key(unsigned index) override;
     String item(const String& key) override;
-    void setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException) override;
-    void removeItem(Frame* sourceFrame, const String& key) override;
-    void clear(Frame* sourceFrame) override;
+    void setItem(WebCore::Frame* sourceFrame, const String& key, const String& value, bool& quotaException) override;
+    void removeItem(WebCore::Frame* sourceFrame, const String& key) override;
+    void clear(WebCore::Frame* sourceFrame) override;
     bool contains(const String& key) override;
 
-    bool canAccessStorage(Frame* sourceFrame) override;
-    StorageType storageType() const override;
+    bool canAccessStorage(WebCore::Frame* sourceFrame) override;
+    WebCore::StorageType storageType() const override;
 
     size_t memoryBytesUsedByCache() override;
 
@@ -60,9 +61,9 @@ public:
     void decrementAccessCount() override;
     void closeDatabaseIfIdle() override;
 
-    SecurityOrigin& securityOrigin() override { return *m_securityOrigin; }
+    WebCore::SecurityOrigin& securityOrigin() override { return *m_securityOrigin.get(); }
 
-    PassRefPtr<StorageAreaImpl> copy();
+    Ref<StorageAreaImpl> copy();
     void close();
 
     // Only called from a background thread.
@@ -74,28 +75,26 @@ public:
     void sync();
 
 private:
-    StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
-    explicit StorageAreaImpl(StorageAreaImpl*);
+    StorageAreaImpl(WebCore::StorageType, RefPtr<WebCore::SecurityOrigin>&&, RefPtr<WebCore::StorageSyncManager>&&, unsigned quota);
+    explicit StorageAreaImpl(const StorageAreaImpl&);
 
     void blockUntilImportComplete() const;
     void closeDatabaseTimerFired();
 
-    void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
+    void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, WebCore::Frame* sourceFrame);
 
-    StorageType m_storageType;
-    RefPtr<SecurityOrigin> m_securityOrigin;
-    RefPtr<StorageMap> m_storageMap;
+    WebCore::StorageType m_storageType;
+    RefPtr<WebCore::SecurityOrigin> m_securityOrigin;
+    RefPtr<WebCore::StorageMap> m_storageMap;
 
     RefPtr<StorageAreaSync> m_storageAreaSync;
-    RefPtr<StorageSyncManager> m_storageSyncManager;
+    RefPtr<WebCore::StorageSyncManager> m_storageSyncManager;
 
 #ifndef NDEBUG
     bool m_isShutdown;
 #endif
     unsigned m_accessCount;
-    Timer m_closeDatabaseTimer;
+    WebCore::Timer m_closeDatabaseTimer;
 };
 
 } // namespace WebCore
-
-#endif // StorageAreaImpl_h
index 524fa26..ac0dcc1 100644 (file)
@@ -35,7 +35,9 @@
 #include <WebCore/SuddenTermination.h>
 #include <wtf/MainThread.h>
 
-namespace WebCore {
+using namespace WebCore;
+
+namespace WebKit {
 
 // If the StorageArea undergoes rapid changes, don't sync each change to disk.
 // Instead, queue up a batch of items to sync and actually do the sync at the following interval.
@@ -45,12 +47,12 @@ static const double StorageSyncInterval = 1.0;
 // much harder to starve the rest of LocalStorage and the OS's IO subsystem in general.
 static const int MaxiumItemsToSync = 100;
 
-inline StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
+inline StorageAreaSync::StorageAreaSync(RefPtr<StorageSyncManager>&& storageSyncManager, Ref<StorageAreaImpl>&& storageArea, const String& databaseIdentifier)
     : m_syncTimer(*this, &StorageAreaSync::syncTimerFired)
     , m_itemsCleared(false)
     , m_finalSyncScheduled(false)
-    , m_storageArea(storageArea)
-    , m_syncManager(storageSyncManager)
+    , m_storageArea(WTFMove(storageArea))
+    , m_syncManager(WTFMove(storageSyncManager))
     , m_databaseIdentifier(databaseIdentifier.isolatedCopy())
     , m_clearItemsWhileSyncing(false)
     , m_syncScheduled(false)
@@ -71,9 +73,9 @@ inline StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSy
     });
 }
 
-Ref<StorageAreaSync> StorageAreaSync::create(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
+Ref<StorageAreaSync> StorageAreaSync::create(RefPtr<StorageSyncManager>&& storageSyncManager, Ref<StorageAreaImpl>&& storageArea, const String& databaseIdentifier)
 {
-    return adoptRef(*new StorageAreaSync(storageSyncManager, storageArea, databaseIdentifier));
+    return adoptRef(*new StorageAreaSync(WTFMove(storageSyncManager), WTFMove(storageArea), databaseIdentifier));
 }
 
 StorageAreaSync::~StorageAreaSync()
index b3ca89a..c008753 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef StorageAreaSync_h
-#define StorageAreaSync_h
+#pragma once
 
 #include <WebCore/SQLiteDatabase.h>
 #include <WebCore/Timer.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
+class StorageSyncManager;
+}
+
+namespace WebKit {
 
-class Frame;
 class StorageAreaImpl;
-class StorageSyncManager;
 
 class StorageAreaSync : public ThreadSafeRefCounted<StorageAreaSync> {
 public:
-    static Ref<StorageAreaSync> create(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
+    static Ref<StorageAreaSync> create(RefPtr<WebCore::StorageSyncManager>&&, Ref<StorageAreaImpl>&&, const String& databaseIdentifier);
     ~StorageAreaSync();
 
     void scheduleFinalSync();
@@ -53,19 +54,19 @@ public:
     void scheduleSync();
 
 private:
-    StorageAreaSync(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
+    StorageAreaSync(RefPtr<WebCore::StorageSyncManager>&&, Ref<StorageAreaImpl>&&, const String& databaseIdentifier);
 
-    Timer m_syncTimer;
+    WebCore::Timer m_syncTimer;
     HashMap<String, String> m_changedItems;
     bool m_itemsCleared;
 
     bool m_finalSyncScheduled;
 
     RefPtr<StorageAreaImpl> m_storageArea;
-    RefPtr<StorageSyncManager> m_syncManager;
+    RefPtr<WebCore::StorageSyncManager> m_syncManager;
 
     // The database handle will only ever be opened and used on the background thread.
-    SQLiteDatabase m_database;
+    WebCore::SQLiteDatabase m_database;
 
     // The following members are subject to thread synchronization issues.
 public:
@@ -103,5 +104,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // StorageAreaSync_h
index 7d85c1c..56a0192 100644 (file)
@@ -33,7 +33,9 @@
 #include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringHash.h>
 
-namespace WebCore {
+using namespace WebCore;
+
+namespace WebKit {
 
 static HashMap<String, StorageNamespaceImpl*>& localStorageNamespaceMap()
 {
@@ -42,21 +44,21 @@ static HashMap<String, StorageNamespaceImpl*>& localStorageNamespaceMap()
     return localStorageNamespaceMap;
 }
 
-RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::createSessionStorageNamespace(unsigned quota)
+Ref<StorageNamespaceImpl> StorageNamespaceImpl::createSessionStorageNamespace(unsigned quota)
 {
-    return adoptRef(new StorageNamespaceImpl(SessionStorage, String(), quota));
+    return adoptRef(*new StorageNamespaceImpl(SessionStorage, String(), quota));
 }
 
-RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota)
+Ref<StorageNamespaceImpl> StorageNamespaceImpl::getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota)
 {
     ASSERT(!databasePath.isNull());
 
     auto& slot = localStorageNamespaceMap().add(databasePath, nullptr).iterator->value;
     if (slot)
-        return slot;
+        return *slot;
 
-    RefPtr<StorageNamespaceImpl> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, databasePath, quota));
-    slot = storageNamespace.get();
+    Ref<StorageNamespaceImpl> storageNamespace = adoptRef(*new StorageNamespaceImpl(LocalStorage, databasePath, quota));
+    slot = storageNamespace.ptr();
 
     return storageNamespace;
 }
@@ -105,11 +107,11 @@ RefPtr<StorageArea> StorageNamespaceImpl::storageArea(RefPtr<SecurityOrigin>&& o
     ASSERT(!m_isShutdown);
 
     RefPtr<StorageAreaImpl> storageArea;
-    if ((storageArea = m_storageAreaMap.get(origin)))
+    if ((storageArea = m_storageAreaMap.get(origin.get())))
         return storageArea;
 
-    storageArea = StorageAreaImpl::create(m_storageType, origin.copyRef(), m_syncManager, m_quota);
-    m_storageAreaMap.set(WTFMove(origin), storageArea);
+    storageArea = StorageAreaImpl::create(m_storageType, origin.get(), m_syncManager.get(), m_quota);
+    m_storageAreaMap.set(origin, storageArea.get());
     return storageArea;
 }
 
index ae161e1..d58ed40 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef StorageNamespaceImpl_h
-#define StorageNamespaceImpl_h
+#pragma once
 
 #include <WebCore/SecurityOriginHash.h>
 #include <WebCore/StorageArea.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 
-namespace WebCore {
+namespace WebKit {
 
 class StorageAreaImpl;
 
-class StorageNamespaceImpl : public StorageNamespace {
+class StorageNamespaceImpl : public WebCore::StorageNamespace {
 public:
-    WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> createSessionStorageNamespace(unsigned quota);
-    WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota);
+    static Ref<StorageNamespaceImpl> createSessionStorageNamespace(unsigned quota);
+    static Ref<StorageNamespaceImpl> getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota);
     virtual ~StorageNamespaceImpl();
 
     void close();
@@ -49,25 +48,25 @@ public:
     // we're just deleting the underlying db file. If an item is added immediately
     // after file deletion, we want the same StorageArea to eventually trigger
     // a sync and for StorageAreaSync to recreate the backing db file.
-    void clearOriginForDeletion(SecurityOrigin*);
+    void clearOriginForDeletion(WebCore::SecurityOrigin*);
     void clearAllOriginsForDeletion();
     void sync();
     void closeIdleLocalStorageDatabases();
 
 private:
-    StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
+    StorageNamespaceImpl(WebCore::StorageType, const String& path, unsigned quota);
 
-    RefPtr<StorageArea> storageArea(RefPtr<SecurityOrigin>&&)  override;
-    RefPtr<StorageNamespace> copy(Page* newPage) override;
+    RefPtr<WebCore::StorageArea> storageArea(RefPtr<WebCore::SecurityOrigin>&&) override;
+    RefPtr<StorageNamespace> copy(WebCore::Page* newPage) override;
 
-    typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>> StorageAreaMap;
+    typedef HashMap<RefPtr<WebCore::SecurityOrigin>, RefPtr<StorageAreaImpl>> StorageAreaMap;
     StorageAreaMap m_storageAreaMap;
 
-    StorageType m_storageType;
+    WebCore::StorageType m_storageType;
 
     // Only used if m_storageType == LocalStorage and the path was not "" in our constructor.
     String m_path;
-    RefPtr<StorageSyncManager> m_syncManager;
+    RefPtr<WebCore::StorageSyncManager> m_syncManager;
 
     // The default quota for each new storage area.
     unsigned m_quota;
@@ -76,5 +75,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // StorageNamespaceImpl_h
index 02674c3..5c436a3 100644 (file)
 #include <sqlite3_private.h>
 #endif
 
-namespace WebCore {
+using namespace WebCore;
 
-static StorageTracker* storageTracker = 0;
+namespace WebKit {
+
+static StorageTracker* storageTracker = nullptr;
 
 // If there is no document referencing a storage database, close the underlying database
 // after it has been idle for m_StorageDatabaseIdleInterval seconds.
index a999da2..ab243aa 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef StorageTracker_h
-#define StorageTracker_h
+#pragma once
 
 #include <WebCore/SQLiteDatabase.h>
 #include <wtf/HashSet.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
-
-class StorageTask;
 class StorageThread;
 class SecurityOrigin;
-class StorageTrackerClient;    
+class StorageTrackerClient;
+}
+
+namespace WebKit {
 
 class StorageTracker {
     WTF_MAKE_NONCOPYABLE(StorageTracker);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WEBCORE_EXPORT static void initializeTracker(const String& storagePath, StorageTrackerClient*);
-    WEBCORE_EXPORT static StorageTracker& tracker();
+    static void initializeTracker(const String& storagePath, WebCore::StorageTrackerClient*);
+    static StorageTracker& tracker();
 
     void setDatabaseDirectoryPath(const String&);
     String databaseDirectoryPath() const;
 
     void setOriginDetails(const String& originIdentifier, const String& databaseFile);
     
-    WEBCORE_EXPORT void deleteAllOrigins();
-    WEBCORE_EXPORT void deleteOrigin(SecurityOrigin*);
+    void deleteAllOrigins();
+    void deleteOrigin(WebCore::SecurityOrigin*);
     void deleteOriginWithIdentifier(const String& originIdentifier);
-    WEBCORE_EXPORT void origins(Vector<RefPtr<SecurityOrigin>>& result);
-    WEBCORE_EXPORT long long diskUsageForOrigin(SecurityOrigin*);
+    void origins(Vector<RefPtr<WebCore::SecurityOrigin>>& result);
+    long long diskUsageForOrigin(WebCore::SecurityOrigin*);
     
     void cancelDeletingOrigin(const String& originIdentifier);
     
@@ -64,7 +64,7 @@ public:
     double storageDatabaseIdleInterval() { return m_StorageDatabaseIdleInterval; }
     void setStorageDatabaseIdleInterval(double interval) { m_StorageDatabaseIdleInterval = interval; }
 
-    WEBCORE_EXPORT void syncFileSystemAndTrackerDatabase();
+    void syncFileSystemAndTrackerDatabase();
 
 private:
     explicit StorageTracker(const String& storagePath);
@@ -96,11 +96,11 @@ private:
 
     // Mutex for m_database and m_storageDirectoryPath.
     Lock m_databaseMutex;
-    SQLiteDatabase m_database;
+    WebCore::SQLiteDatabase m_database;
     String m_storageDirectoryPath;
 
     Lock m_clientMutex;
-    StorageTrackerClient* m_client;
+    WebCore::StorageTrackerClient* m_client;
 
     // Guard for m_originSet and m_originsBeingDeleted.
     Lock m_originSetMutex;
@@ -108,7 +108,7 @@ private:
     OriginSet m_originSet;
     OriginSet m_originsBeingDeleted;
 
-    std::unique_ptr<StorageThread> m_thread;
+    std::unique_ptr<WebCore::StorageThread> m_thread;
     
     bool m_isActive;
     bool m_needsInitialization;
@@ -116,5 +116,3 @@ private:
 };
     
 } // namespace WebCore
-
-#endif // StorageTracker_h
index f71c7c2..48a2986 100644 (file)
@@ -30,6 +30,8 @@
 
 using namespace WebCore;
 
+namespace WebKit {
+
 static HashSet<WebStorageNamespaceProvider*>& storageNamespaceProviders()
 {
     static NeverDestroyed<HashSet<WebStorageNamespaceProvider*>> storageNamespaceProviders;
@@ -110,3 +112,5 @@ RefPtr<StorageNamespace> WebStorageNamespaceProvider::createTransientLocalStorag
     // SessionStorageNamespace here.
     return StorageNamespaceImpl::createSessionStorageNamespace(quota);
 }
+
+}
index 097ff76..8e24982 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebStorageNamespaceProvider_h
-#define WebStorageNamespaceProvider_h
+#pragma once
 
 #include <WebCore/StorageNamespaceProvider.h>
 
+namespace WebKit {
+
 class WebStorageNamespaceProvider final : public WebCore::StorageNamespaceProvider {
 public:
     static RefPtr<WebStorageNamespaceProvider> create(const String& localStorageDatabasePath);
@@ -51,4 +52,4 @@ private:
     const String m_localStorageDatabasePath;
 };
 
-#endif // WebStorageNamespaceProvider_h
+} // namespace WebKit
index 3a6647b..12ecb1a 100644 (file)
@@ -20,8 +20,7 @@
     Boston, MA 02110-1301, USA.
  */
 
-#ifndef WebResourceLoadScheduler_h
-#define WebResourceLoadScheduler_h
+#pragma once
 
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/LoaderStrategy.h>
@@ -104,7 +103,7 @@ private:
     };
     
     HostInformation* hostForURL(const WebCore::URL&, CreateHostPolicy = FindOnly);
-    WEBCORE_EXPORT void servePendingRequests(HostInformation*, WebCore::ResourceLoadPriority);
+    void servePendingRequests(HostInformation*, WebCore::ResourceLoadPriority);
 
     typedef HashMap<String, HostInformation*, StringHash> HostMap;
     HostMap m_hosts;
@@ -115,5 +114,3 @@ private:
     unsigned m_suspendPendingRequestsCount;
     bool m_isSerialLoadingEnabled;
 };
-
-#endif
index d17f224..c6b4087 100644 (file)
@@ -94,7 +94,7 @@ void WebViewGroup::removeWebView(WebView *webView)
 StorageNamespaceProvider& WebViewGroup::storageNamespaceProvider()
 {
     if (!m_storageNamespaceProvider)
-        m_storageNamespaceProvider = WebStorageNamespaceProvider::create(m_localStorageDatabasePath);
+        m_storageNamespaceProvider = WebKit::WebStorageNamespaceProvider::create(m_localStorageDatabasePath);
 
     return *m_storageNamespaceProvider;
 }
index d578bfb..e05ebd1 100644 (file)
@@ -1,3 +1,23 @@
+2016-11-09  Alex Christensen  <achristensen@webkit.org>
+
+        Clean up Storage code
+        https://bugs.webkit.org/show_bug.cgi?id=164562
+
+        Reviewed by Brady Eidson.
+
+        * Storage/WebStorageManager.mm:
+        (-[WebStorageManager origins]):
+        (-[WebStorageManager deleteAllOrigins]):
+        (-[WebStorageManager deleteOrigin:]):
+        (-[WebStorageManager diskUsageForOrigin:]):
+        (-[WebStorageManager syncLocalStorage]):
+        (-[WebStorageManager syncFileSystemAndTrackerDatabase]):
+        (+[WebStorageManager setStorageDatabaseIdleInterval:]):
+        (+[WebStorageManager closeIdleLocalStorageDatabases]):
+        (WebKitInitializeStorageIfNecessary):
+        * WebView/WebView.mm:
+        (+[WebView _applicationWillTerminate]):
+
 2016-11-09  Beth Dakin  <bdakin@apple.com>
 
         Another attempted build fix.
index fb40e54..e882c7f 100644 (file)
@@ -66,7 +66,7 @@ static pthread_once_t registerLocalStoragePath = PTHREAD_ONCE_INIT;
 {
     Vector<RefPtr<SecurityOrigin>> coreOrigins;
 
-    StorageTracker::tracker().origins(coreOrigins);
+    WebKit::StorageTracker::tracker().origins(coreOrigins);
 
     NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()];
 
@@ -81,7 +81,7 @@ static pthread_once_t registerLocalStoragePath = PTHREAD_ONCE_INIT;
 
 - (void)deleteAllOrigins
 {
-    StorageTracker::tracker().deleteAllOrigins();
+    WebKit::StorageTracker::tracker().deleteAllOrigins();
 #if PLATFORM(IOS)
     // FIXME: This needs to be removed once StorageTrackers in multiple processes
     // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
@@ -91,22 +91,22 @@ static pthread_once_t registerLocalStoragePath = PTHREAD_ONCE_INIT;
 
 - (void)deleteOrigin:(WebSecurityOrigin *)origin
 {
-    StorageTracker::tracker().deleteOrigin([origin _core]);
+    WebKit::StorageTracker::tracker().deleteOrigin([origin _core]);
 }
 
 - (unsigned long long)diskUsageForOrigin:(WebSecurityOrigin *)origin
 {
-    return StorageTracker::tracker().diskUsageForOrigin([origin _core]);
+    return WebKit::StorageTracker::tracker().diskUsageForOrigin([origin _core]);
 }
 
 - (void)syncLocalStorage
 {
-    WebStorageNamespaceProvider::syncLocalStorage();
+    WebKit::WebStorageNamespaceProvider::syncLocalStorage();
 }
 
 - (void)syncFileSystemAndTrackerDatabase
 {
-    StorageTracker::tracker().syncFileSystemAndTrackerDatabase();
+    WebKit::StorageTracker::tracker().syncFileSystemAndTrackerDatabase();
 }
 
 + (NSString *)_storageDirectoryPath
@@ -117,12 +117,12 @@ static pthread_once_t registerLocalStoragePath = PTHREAD_ONCE_INIT;
 
 + (void)setStorageDatabaseIdleInterval:(double)interval
 {
-    StorageTracker::tracker().setStorageDatabaseIdleInterval(interval);
+    WebKit::StorageTracker::tracker().setStorageDatabaseIdleInterval(interval);
 }
 
 + (void)closeIdleLocalStorageDatabases
 {
-    WebStorageNamespaceProvider::closeIdleLocalStorageDatabases();
+    WebKit::WebStorageNamespaceProvider::closeIdleLocalStorageDatabases();
 }
 
 static void initializeLocalStoragePath()
@@ -143,7 +143,7 @@ void WebKitInitializeStorageIfNecessary()
     if (initialized)
         return;
     
-    StorageTracker::initializeTracker([WebStorageManager _storageDirectoryPath], WebStorageTrackerClient::sharedWebStorageTrackerClient());
+    WebKit::StorageTracker::initializeTracker([WebStorageManager _storageDirectoryPath], WebStorageTrackerClient::sharedWebStorageTrackerClient());
         
     initialized = YES;
 }
index e9ee30f..93aa089 100644 (file)
@@ -5253,7 +5253,7 @@ static Vector<String> toStringVector(NSArray* patterns)
     if (!pluginDatabaseClientCount)
         [WebPluginDatabase closeSharedDatabase];
 
-    WebStorageNamespaceProvider::closeLocalStorage();
+    WebKit::WebStorageNamespaceProvider::closeLocalStorage();
 }
 #endif // !PLATFORM(IOS)
 
index e7f5771..a8c944c 100644 (file)
@@ -1,3 +1,39 @@
+2016-11-09  Alex Christensen  <achristensen@webkit.org>
+
+        Clean up Storage code
+        https://bugs.webkit.org/show_bug.cgi?id=164562
+
+        Reviewed by Brady Eidson.
+
+        Use more Refs!
+
+        * NetworkProcess/CustomProtocols/CustomProtocolManager.h:
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::addWorkQueueMessageReceiver):
+        * Platform/IPC/Connection.h:
+        * UIProcess/Storage/LocalStorageDatabase.cpp:
+        (WebKit::LocalStorageDatabase::create):
+        (WebKit::LocalStorageDatabase::LocalStorageDatabase):
+        * UIProcess/Storage/LocalStorageDatabase.h:
+        * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
+        (WebKit::LocalStorageDatabaseTracker::create):
+        (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
+        * UIProcess/Storage/LocalStorageDatabaseTracker.h:
+        * UIProcess/Storage/StorageManager.cpp:
+        (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
+        (WebKit::StorageManager::StorageManager):
+        * UIProcess/Storage/StorageManager.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
+        * UIProcess/mac/SecItemShimProxy.cpp:
+        (WebKit::SecItemShimProxy::initializeConnection):
+        * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
+        (WebKit::PluginProcessConnectionManager::initializeConnection):
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::initializeConnection):
+        * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
+        (WebKit::ViewUpdateDispatcher::initializeConnection):
+
 2016-11-09  Beth Dakin  <bdakin@apple.com>
 
         Another attempted build fix.
index 439d8b0..040fc4a 100644 (file)
@@ -97,7 +97,7 @@ private:
     void wasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
 
     ChildProcess* m_childProcess;
-    RefPtr<WorkQueue> m_messageQueue;
+    Ref<WorkQueue> m_messageQueue;
 
 #if PLATFORM(COCOA)
     HashSet<String, ASCIICaseInsensitiveHash> m_registeredSchemes;
index 78cfa2e..22255e0 100644 (file)
@@ -264,11 +264,11 @@ void Connection::setShouldExitOnSyncMessageSendFailure(bool shouldExitOnSyncMess
     m_shouldExitOnSyncMessageSendFailure = shouldExitOnSyncMessageSendFailure;
 }
 
-void Connection::addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue* workQueue, WorkQueueMessageReceiver* workQueueMessageReceiver)
+void Connection::addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue& workQueue, WorkQueueMessageReceiver* workQueueMessageReceiver)
 {
     ASSERT(RunLoop::isMain());
 
-    m_connectionQueue->dispatch([protectedThis = makeRef(*this), messageReceiverName = WTFMove(messageReceiverName), workQueue, workQueueMessageReceiver]() mutable {
+    m_connectionQueue->dispatch([protectedThis = makeRef(*this), messageReceiverName = WTFMove(messageReceiverName), workQueue = &workQueue, workQueueMessageReceiver]() mutable {
         ASSERT(!protectedThis->m_workQueueMessageReceivers.contains(messageReceiverName));
 
         protectedThis->m_workQueueMessageReceivers.add(messageReceiverName, std::make_pair(workQueue, workQueueMessageReceiver));
index ec51e30..503cf5f 100644 (file)
@@ -155,7 +155,7 @@ public:
     typedef void (*DidCloseOnConnectionWorkQueueCallback)(Connection*);
     void setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback);
 
-    void addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue*, WorkQueueMessageReceiver*);
+    void addWorkQueueMessageReceiver(StringReference messageReceiverName, WorkQueue&, WorkQueueMessageReceiver*);
     void removeWorkQueueMessageReceiver(StringReference messageReceiverName);
 
     bool open();
index 3468b5d..a5f400d 100644 (file)
@@ -46,14 +46,14 @@ static const int maximumItemsToUpdate = 100;
 
 namespace WebKit {
 
-PassRefPtr<LocalStorageDatabase> LocalStorageDatabase::create(PassRefPtr<WorkQueue> queue, PassRefPtr<LocalStorageDatabaseTracker> tracker, Ref<SecurityOrigin>&& securityOrigin)
+Ref<LocalStorageDatabase> LocalStorageDatabase::create(Ref<WorkQueue>&& queue, Ref<LocalStorageDatabaseTracker>&& tracker, Ref<SecurityOrigin>&& securityOrigin)
 {
-    return adoptRef(new LocalStorageDatabase(queue, tracker, WTFMove(securityOrigin)));
+    return adoptRef(*new LocalStorageDatabase(WTFMove(queue), WTFMove(tracker), WTFMove(securityOrigin)));
 }
 
-LocalStorageDatabase::LocalStorageDatabase(PassRefPtr<WorkQueue> queue, PassRefPtr<LocalStorageDatabaseTracker> tracker, Ref<SecurityOrigin>&& securityOrigin)
-    : m_queue(queue)
-    , m_tracker(tracker)
+LocalStorageDatabase::LocalStorageDatabase(Ref<WorkQueue>&& queue, Ref<LocalStorageDatabaseTracker>&& tracker, Ref<SecurityOrigin>&& securityOrigin)
+    : m_queue(WTFMove(queue))
+    , m_tracker(WTFMove(tracker))
     , m_securityOrigin(WTFMove(securityOrigin))
     , m_databasePath(m_tracker->databasePath(m_securityOrigin.ptr()))
     , m_failedToOpenDatabase(false)
index 3340ef7..998612c 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LocalStorageDatabase_h
-#define LocalStorageDatabase_h
+#pragma once
 
 #include <WebCore/SQLiteDatabase.h>
 #include <wtf/Forward.h>
@@ -45,7 +44,7 @@ class LocalStorageDatabaseTracker;
 
 class LocalStorageDatabase : public ThreadSafeRefCounted<LocalStorageDatabase> {
 public:
-    static PassRefPtr<LocalStorageDatabase> create(PassRefPtr<WorkQueue>, PassRefPtr<LocalStorageDatabaseTracker>, Ref<WebCore::SecurityOrigin>&&);
+    static Ref<LocalStorageDatabase> create(Ref<WorkQueue>&&, Ref<LocalStorageDatabaseTracker>&&, Ref<WebCore::SecurityOrigin>&&);
     ~LocalStorageDatabase();
 
     // Will block until the import is complete.
@@ -59,7 +58,7 @@ public:
     void close();
 
 private:
-    LocalStorageDatabase(PassRefPtr<WorkQueue>, PassRefPtr<LocalStorageDatabaseTracker>, Ref<WebCore::SecurityOrigin>&&);
+    LocalStorageDatabase(Ref<WorkQueue>&&, Ref<LocalStorageDatabaseTracker>&&, Ref<WebCore::SecurityOrigin>&&);
 
     enum DatabaseOpeningStrategy {
         CreateIfNonExistent,
@@ -78,8 +77,8 @@ private:
 
     bool databaseIsEmpty();
 
-    RefPtr<WorkQueue> m_queue;
-    RefPtr<LocalStorageDatabaseTracker> m_tracker;
+    Ref<WorkQueue> m_queue;
+    Ref<LocalStorageDatabaseTracker> m_tracker;
     Ref<WebCore::SecurityOrigin> m_securityOrigin;
 
     String m_databasePath;
@@ -97,5 +96,3 @@ private:
 
 
 } // namespace WebKit
-
-#endif // LocalStorageDatabase_h
index fa3fa6e..df82ac6 100644 (file)
@@ -38,13 +38,13 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassRefPtr<LocalStorageDatabaseTracker> LocalStorageDatabaseTracker::create(PassRefPtr<WorkQueue> queue, const String& localStorageDirectory)
+Ref<LocalStorageDatabaseTracker> LocalStorageDatabaseTracker::create(Ref<WorkQueue>&& queue, const String& localStorageDirectory)
 {
-    return adoptRef(new LocalStorageDatabaseTracker(queue, localStorageDirectory));
+    return adoptRef(*new LocalStorageDatabaseTracker(WTFMove(queue), localStorageDirectory));
 }
 
-LocalStorageDatabaseTracker::LocalStorageDatabaseTracker(PassRefPtr<WorkQueue> queue, const String& localStorageDirectory)
-    : m_queue(queue)
+LocalStorageDatabaseTracker::LocalStorageDatabaseTracker(Ref<WorkQueue>&& queue, const String& localStorageDirectory)
+    : m_queue(WTFMove(queue))
     , m_localStorageDirectory(localStorageDirectory.isolatedCopy())
 {
     ASSERT(!m_localStorageDirectory.isEmpty());
index 04f61fd..7f20597 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LocalStorageDatabaseTracker_h
-#define LocalStorageDatabaseTracker_h
+#pragma once
 
 #include <WebCore/SQLiteDatabase.h>
 #include <wtf/HashSet.h>
 #include <wtf/Optional.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/WorkQueue.h>
@@ -46,7 +44,7 @@ struct LocalStorageDetails;
 
 class LocalStorageDatabaseTracker : public ThreadSafeRefCounted<LocalStorageDatabaseTracker> {
 public:
-    static PassRefPtr<LocalStorageDatabaseTracker> create(PassRefPtr<WorkQueue>, const String& localStorageDirectory);
+    static Ref<LocalStorageDatabaseTracker> create(Ref<WorkQueue>&&, const String& localStorageDirectory);
     ~LocalStorageDatabaseTracker();
 
     String databasePath(WebCore::SecurityOrigin*) const;
@@ -68,7 +66,7 @@ public:
     Vector<OriginDetails> originDetails();
 
 private:
-    LocalStorageDatabaseTracker(PassRefPtr<WorkQueue>, const String& localStorageDirectory);
+    LocalStorageDatabaseTracker(Ref<WorkQueue>&&, const String& localStorageDirectory);
 
     String databasePath(const String& filename) const;
     String trackerDatabasePath() const;
@@ -94,5 +92,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // LocalStorageDatabaseTracker_h
index 3f7d983..f31c2d9 100644 (file)
@@ -292,7 +292,7 @@ void StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded()
 
     // We open the database here even if we've already imported our items to ensure that the database is open if we need to write to it.
     if (!m_localStorageDatabase)
-        m_localStorageDatabase = LocalStorageDatabase::create(m_localStorageNamespace->storageManager()->m_queue, m_localStorageNamespace->storageManager()->m_localStorageDatabaseTracker, m_securityOrigin.copyRef());
+        m_localStorageDatabase = LocalStorageDatabase::create(m_localStorageNamespace->storageManager()->m_queue.copyRef(), m_localStorageNamespace->storageManager()->m_localStorageDatabaseTracker.copyRef(), m_securityOrigin.copyRef());
 
     if (m_didImportItemsFromDatabase)
         return;
@@ -461,7 +461,7 @@ Ref<StorageManager> StorageManager::create(const String& localStorageDirectory)
 
 StorageManager::StorageManager(const String& localStorageDirectory)
     : m_queue(WorkQueue::create("com.apple.WebKit.StorageManager"))
-    , m_localStorageDatabaseTracker(LocalStorageDatabaseTracker::create(m_queue, localStorageDirectory))
+    , m_localStorageDatabaseTracker(LocalStorageDatabaseTracker::create(m_queue.copyRef(), localStorageDirectory))
 {
     // Make sure the encoding is initialized before we start dispatching things to the queue.
     UTF8Encoding();
index 6cb9f1c..18756c1 100644 (file)
@@ -98,9 +98,9 @@ private:
     class TransientLocalStorageNamespace;
     TransientLocalStorageNamespace* getOrCreateTransientLocalStorageNamespace(uint64_t storageNamespaceID, WebCore::SecurityOrigin& topLevelOrigin);
 
-    RefPtr<WorkQueue> m_queue;
+    Ref<WorkQueue> m_queue;
 
-    RefPtr<LocalStorageDatabaseTracker> m_localStorageDatabaseTracker;
+    Ref<LocalStorageDatabaseTracker> m_localStorageDatabaseTracker;
     HashMap<uint64_t, RefPtr<LocalStorageNamespace>> m_localStorageNamespaces;
 
     HashMap<std::pair<uint64_t, RefPtr<WebCore::SecurityOrigin>>, RefPtr<TransientLocalStorageNamespace>> m_transientLocalStorageNamespaces;
index 9109b16..720ed74 100644 (file)
@@ -198,7 +198,7 @@ void WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded()
 
 void WebResourceLoadStatisticsStore::processWillOpenConnection(WebProcessProxy&, IPC::Connection& connection)
 {
-    connection.addWorkQueueMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName(), &m_statisticsQueue.get(), this);
+    connection.addWorkQueueMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName(), m_statisticsQueue.get(), this);
 }
 
 void WebResourceLoadStatisticsStore::processDidCloseConnection(WebProcessProxy&, IPC::Connection& connection)
index 3d3672c..21ea7b0 100644 (file)
@@ -53,7 +53,7 @@ SecItemShimProxy::SecItemShimProxy()
 
 void SecItemShimProxy::initializeConnection(IPC::Connection& connection)
 {
-    connection.addWorkQueueMessageReceiver(Messages::SecItemShimProxy::messageReceiverName(), &m_queue.get(), this);
+    connection.addWorkQueueMessageReceiver(Messages::SecItemShimProxy::messageReceiverName(), m_queue.get(), this);
 }
 
 void SecItemShimProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
index 92dd103..cbc4f0e 100644 (file)
@@ -58,7 +58,7 @@ PluginProcessConnectionManager::~PluginProcessConnectionManager()
 
 void PluginProcessConnectionManager::initializeConnection(IPC::Connection* connection)
 {
-    connection->addWorkQueueMessageReceiver(Messages::PluginProcessConnectionManager::messageReceiverName(), &m_queue.get(), this);
+    connection->addWorkQueueMessageReceiver(Messages::PluginProcessConnectionManager::messageReceiverName(), m_queue.get(), this);
 }
 
 PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(uint64_t pluginProcessToken)
index 5c9352a..1f29a01 100644 (file)
@@ -85,7 +85,7 @@ void EventDispatcher::removeScrollingTreeForPage(WebPage* webPage)
 
 void EventDispatcher::initializeConnection(IPC::Connection* connection)
 {
-    connection->addWorkQueueMessageReceiver(Messages::EventDispatcher::messageReceiverName(), &m_queue.get(), this);
+    connection->addWorkQueueMessageReceiver(Messages::EventDispatcher::messageReceiverName(), m_queue.get(), this);
 }
 
 void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent, bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom)
index 4e3e8c8..c8e3638 100644 (file)
@@ -51,7 +51,7 @@ ViewUpdateDispatcher::~ViewUpdateDispatcher()
 
 void ViewUpdateDispatcher::initializeConnection(IPC::Connection* connection)
 {
-    connection->addWorkQueueMessageReceiver(Messages::ViewUpdateDispatcher::messageReceiverName(), &m_queue.get(), this);
+    connection->addWorkQueueMessageReceiver(Messages::ViewUpdateDispatcher::messageReceiverName(), m_queue.get(), this);
 }
 
 void ViewUpdateDispatcher::visibleContentRectUpdate(uint64_t pageID, const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)