Encapsulate externally used webdatabase APIs in DatabaseManager.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 23:04:20 +0000 (23:04 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 23:04:20 +0000 (23:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104741.

Reviewed by Sam Weinig.

Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
and DatabaseContext directly. This is to prepare for upcoming webkit2
refactoring.

Source/WebCore:

No new tests.

* CMakeLists.txt:
* Modules/webdatabase/DatabaseManager.cpp: Added.
(WebCore::DatabaseManager::manager):
(WebCore::DatabaseManager::DatabaseManager):
(WebCore::DatabaseManager::initialize):
(WebCore::DatabaseManager::setClient):
(WebCore::DatabaseManager::isAvailable):
(WebCore::DatabaseManager::setIsAvailable):
(WebCore::DatabaseManager::hasOpenDatabases):
(WebCore::DatabaseManager::stopDatabases):
(WebCore::DatabaseManager::fullPathForDatabase):
(WebCore::DatabaseManager::databaseDirectoryPath):
(WebCore::DatabaseManager::setDatabaseDirectoryPath):
(WebCore::DatabaseManager::hasEntryForOrigin):
(WebCore::DatabaseManager::origins):
(WebCore::DatabaseManager::databaseNamesForOrigin):
(WebCore::DatabaseManager::detailsForNameAndOrigin):
(WebCore::DatabaseManager::usageForOrigin):
(WebCore::DatabaseManager::quotaForOrigin):
(WebCore::DatabaseManager::setQuota):
(WebCore::DatabaseManager::deleteAllDatabases):
(WebCore::DatabaseManager::deleteOrigin):
(WebCore::DatabaseManager::deleteDatabase):
(WebCore::DatabaseManager::closeDatabasesImmediately):
(WebCore::DatabaseManager::interruptAllDatabasesForContext):
* Modules/webdatabase/DatabaseManager.h: Added.
(DatabaseManager):
(WebCore::DatabaseManager::~DatabaseManager):
* Modules/webdatabase/DatabaseManagerClient.h: Copied from Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h.
(WebCore::DatabaseManagerClient::~DatabaseManagerClient):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::setClient):
* Modules/webdatabase/DatabaseTracker.h:
(DatabaseTracker):
* Modules/webdatabase/DatabaseTrackerClient.h: Removed.
* Target.pri:
* WebCore.exp.in:
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* WebCore.order:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::openDatabaseEnabled):
(WebCore::RuntimeEnabledFeatures::openDatabaseSyncEnabled):
* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision):
(WebCore::PageCache::canCachePageContainingThisFrame):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
* page/DOMWindow.cpp:
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadShutdownStartTask::performTask):
(WebCore::WorkerThread::stop):

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/blackberry:

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::exceededDatabaseQuota):

Source/WebKit/chromium:

* src/ChromeClientImpl.cpp:
* src/WebDatabase.cpp:
(WebKit::WebDatabase::closeDatabaseImmediately):
* src/WebRuntimeFeatures.cpp:
(WebKit::WebRuntimeFeatures::enableDatabase):
(WebKit::WebRuntimeFeatures::isDatabaseEnabled):

Source/WebKit/efl:

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::exceededDatabaseQuota):
* ewk/ewk_security_origin.cpp:
(ewk_security_origin_web_database_usage_get):
(ewk_security_origin_web_database_quota_get):
(ewk_security_origin_web_database_quota_set):
(ewk_security_origin_web_database_get_all):
* ewk/ewk_settings.cpp:
(ewk_settings_web_database_path_set):
* ewk/ewk_web_database.cpp:
(ewk_web_database_display_name_get):
(ewk_web_database_expected_size_get):
(ewk_web_database_filename_get):
(ewk_web_database_size_get):
(ewk_web_database_remove):
(ewk_web_database_remove_all):

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::exceededDatabaseQuota):
* webkit/webkitfavicondatabase.cpp:
* webkit/webkiticondatabase.cpp:
* webkit/webkitsecurityorigin.cpp:
(webkit_security_origin_get_web_database_usage):
(webkit_security_origin_get_web_database_quota):
(webkit_security_origin_set_web_database_quota):
(webkit_security_origin_get_all_web_databases):
* webkit/webkitwebdatabase.cpp:
(webkit_web_database_get_display_name):
(webkit_web_database_get_expected_size):
(webkit_web_database_get_size):
(webkit_web_database_get_filename):
(webkit_web_database_remove):
(webkit_remove_all_web_databases):
(webkit_get_web_database_directory_path):
(webkit_set_web_database_directory_path):
* webkit/webkitwebview.cpp:
(webkit_web_view_update_settings):
(webkit_web_view_settings_notify):

Source/WebKit/mac:

* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager origins]):
(-[WebDatabaseManager databasesWithOrigin:]):
(-[WebDatabaseManager detailsForDatabase:withOrigin:]):
(-[WebDatabaseManager deleteAllDatabases]):
(-[WebDatabaseManager deleteOrigin:]):
(-[WebDatabaseManager deleteDatabase:withOrigin:]):
(WebKitInitializeDatabasesIfNecessary):
* Storage/WebDatabaseManagerClient.h: Copied from Source/WebKit/mac/Storage/WebDatabaseTrackerClient.h.
(WebDatabaseManagerClient):
* Storage/WebDatabaseManagerClient.mm: Copied from Source/WebKit/mac/Storage/WebDatabaseTrackerClient.mm.
(WebDatabaseManagerClient::sharedWebDatabaseManagerClient):
(WebDatabaseManagerClient::WebDatabaseManagerClient):
(WebDatabaseManagerClient::~WebDatabaseManagerClient):
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::DidModifyOriginData):
(DidModifyOriginData):
(WebDatabaseManagerClient::dispatchDidModifyOrigin):
(WebDatabaseManagerClient::dispatchDidModifyDatabase):
* Storage/WebDatabaseQuotaManager.mm:
(-[WebDatabaseQuotaManager usage]):
(-[WebDatabaseQuotaManager quota]):
(-[WebDatabaseQuotaManager setQuota:]):
* Storage/WebDatabaseTrackerClient.h: Removed.
* Storage/WebDatabaseTrackerClient.mm: Removed.
* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin usage]):
(-[WebSecurityOrigin quota]):
(-[WebSecurityOrigin setQuota:]):
* WebKit.order:
* WebView/WebFrame.mm:
(-[WebFrame _cacheabilityDictionary]):
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/qt:

* Api/qwebdatabase.cpp:
(QWebDatabase::displayName):
(QWebDatabase::expectedSize):
(QWebDatabase::size):
(QWebDatabase::fileName):
(QWebDatabase::removeDatabase):
(QWebDatabase::removeAllDatabases):
* Api/qwebsecurityorigin.cpp:
(QWebSecurityOrigin::databaseUsage):
(QWebSecurityOrigin::databaseQuota):
(QWebSecurityOrigin::setDatabaseQuota):
(QWebSecurityOrigin::allOrigins):
(QWebSecurityOrigin::databases):
* Api/qwebsettings.cpp:
(QWebSettingsPrivate::apply):
(QWebSettings::setOfflineStoragePath):
(QWebSettings::offlineStoragePath):
* WebCoreSupport/ChromeClientQt.cpp:

Source/WebKit/win:

* WebDatabaseManager.cpp:
(WebDatabaseManager::sharedWebDatabaseManager):
(WebDatabaseManager::origins):
(WebDatabaseManager::databasesWithOrigin):
(WebDatabaseManager::detailsForDatabase):
(WebDatabaseManager::deleteAllDatabases):
(WebDatabaseManager::deleteOrigin):
(WebDatabaseManager::deleteDatabase):
(WebDatabaseManager::setQuota):
(WebKitInitializeWebDatabasesIfNecessary):
* WebDatabaseManager.h:
(WebDatabaseManager):
* WebSecurityOrigin.cpp:
(WebSecurityOrigin::usage):
(WebSecurityOrigin::quota):
(WebSecurityOrigin::setQuota):
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WebKit/wx:

* WebKitSupport/ChromeClientWx.cpp:
(WebCore::ChromeClientWx::exceededDatabaseQuota):
* WebView.cpp:
(WebKit::WebView::SetDatabaseDirectory):
(WebKit::WebView::GetDatabaseDirectory):
(WebKit::WebView::SetDatabasesEnabled):
(WebKit::WebView::AreDatabasesEnabled):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exceededDatabaseQuota):
* WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
(WebKit::WebDatabaseManager::initialize):
(WebKit::WebDatabaseManager::WebDatabaseManager):
(WebKit::WebDatabaseManager::getDatabasesByOrigin):
(WebKit::WebDatabaseManager::getDatabaseOrigins):
(WebKit::WebDatabaseManager::deleteDatabaseWithNameForOrigin):
(WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
(WebKit::WebDatabaseManager::deleteAllDatabases):
(WebKit::WebDatabaseManager::setQuotaForOrigin):
* WebProcess/WebCoreSupport/WebDatabaseManager.h:
(WebDatabaseManager):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

70 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp [new file with mode: 0644]
Source/WebCore/Modules/webdatabase/DatabaseManager.h [new file with mode: 0644]
Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h [new file with mode: 0644]
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.h
Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h [deleted file]
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.order
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
Source/WebCore/history/PageCache.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/workers/WorkerThread.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/WebDatabase.cpp
Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
Source/WebKit/efl/ewk/ewk_security_origin.cpp
Source/WebKit/efl/ewk/ewk_settings.cpp
Source/WebKit/efl/ewk/ewk_web_database.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp
Source/WebKit/gtk/webkit/webkiticondatabase.cpp
Source/WebKit/gtk/webkit/webkitsecurityorigin.cpp
Source/WebKit/gtk/webkit/webkitwebdatabase.cpp
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Storage/WebDatabaseManager.mm
Source/WebKit/mac/Storage/WebDatabaseManagerClient.h [new file with mode: 0644]
Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm [moved from Source/WebKit/mac/Storage/WebDatabaseTrackerClient.mm with 57% similarity]
Source/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
Source/WebKit/mac/Storage/WebDatabaseTrackerClient.h [deleted file]
Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
Source/WebKit/mac/WebKit.order
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/Api/qwebdatabase.cpp
Source/WebKit/qt/Api/qwebsecurityorigin.cpp
Source/WebKit/qt/Api/qwebsettings.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebDatabaseManager.cpp
Source/WebKit/win/WebDatabaseManager.h
Source/WebKit/win/WebSecurityOrigin.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
Source/WebKit/wx/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index a729778..e89ff2e 100644 (file)
@@ -947,6 +947,7 @@ set(WebCore_SOURCES
     Modules/webdatabase/Database.cpp
     Modules/webdatabase/DatabaseAuthorizer.cpp
     Modules/webdatabase/DatabaseContext.cpp
+    Modules/webdatabase/DatabaseManager.cpp
     Modules/webdatabase/DatabaseSync.cpp
     Modules/webdatabase/DatabaseTask.cpp
     Modules/webdatabase/DatabaseThread.cpp
index d991963..5971dd1 100644 (file)
@@ -1,3 +1,71 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        No new tests.
+
+        * CMakeLists.txt:
+        * Modules/webdatabase/DatabaseManager.cpp: Added.
+        (WebCore::DatabaseManager::manager):
+        (WebCore::DatabaseManager::DatabaseManager):
+        (WebCore::DatabaseManager::initialize):
+        (WebCore::DatabaseManager::setClient):
+        (WebCore::DatabaseManager::isAvailable):
+        (WebCore::DatabaseManager::setIsAvailable):
+        (WebCore::DatabaseManager::hasOpenDatabases):
+        (WebCore::DatabaseManager::stopDatabases):
+        (WebCore::DatabaseManager::fullPathForDatabase):
+        (WebCore::DatabaseManager::databaseDirectoryPath):
+        (WebCore::DatabaseManager::setDatabaseDirectoryPath):
+        (WebCore::DatabaseManager::hasEntryForOrigin):
+        (WebCore::DatabaseManager::origins):
+        (WebCore::DatabaseManager::databaseNamesForOrigin):
+        (WebCore::DatabaseManager::detailsForNameAndOrigin):
+        (WebCore::DatabaseManager::usageForOrigin):
+        (WebCore::DatabaseManager::quotaForOrigin):
+        (WebCore::DatabaseManager::setQuota):
+        (WebCore::DatabaseManager::deleteAllDatabases):
+        (WebCore::DatabaseManager::deleteOrigin):
+        (WebCore::DatabaseManager::deleteDatabase):
+        (WebCore::DatabaseManager::closeDatabasesImmediately):
+        (WebCore::DatabaseManager::interruptAllDatabasesForContext):
+        * Modules/webdatabase/DatabaseManager.h: Added.
+        (DatabaseManager):
+        (WebCore::DatabaseManager::~DatabaseManager):
+        * Modules/webdatabase/DatabaseManagerClient.h: Copied from Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h.
+        (WebCore::DatabaseManagerClient::~DatabaseManagerClient):
+        * Modules/webdatabase/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::setClient):
+        * Modules/webdatabase/DatabaseTracker.h:
+        (DatabaseTracker):
+        * Modules/webdatabase/DatabaseTrackerClient.h: Removed.
+        * Target.pri:
+        * WebCore.exp.in:
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * WebCore.order:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::openDatabaseEnabled):
+        (WebCore::RuntimeEnabledFeatures::openDatabaseSyncEnabled):
+        * history/PageCache.cpp:
+        (WebCore::logCanCacheFrameDecision):
+        (WebCore::PageCache::canCachePageContainingThisFrame):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::stopLoading):
+        * page/DOMWindow.cpp:
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThreadShutdownStartTask::performTask):
+        (WebCore::WorkerThread::stop):
+
 2012-12-12  Tony Chang  <tony@chromium.org>
 
         [chromium] don't write additional idl files to a gyp temp file
index bcfdedf..7bbd637 100644 (file)
@@ -2098,13 +2098,15 @@ webcore_modules_sources += \
        Source/WebCore/Modules/webdatabase/DatabaseContext.cpp \
        Source/WebCore/Modules/webdatabase/DatabaseContext.h \
        Source/WebCore/Modules/webdatabase/DatabaseDetails.h \
+       Source/WebCore/Modules/webdatabase/DatabaseManager.cpp \
+       Source/WebCore/Modules/webdatabase/DatabaseManager.h \
+       Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h \
        Source/WebCore/Modules/webdatabase/DatabaseSync.cpp \
        Source/WebCore/Modules/webdatabase/DatabaseSync.h \
        Source/WebCore/Modules/webdatabase/DatabaseTask.cpp \
        Source/WebCore/Modules/webdatabase/DatabaseTask.h \
        Source/WebCore/Modules/webdatabase/DatabaseThread.cpp \
        Source/WebCore/Modules/webdatabase/DatabaseThread.h \
-       Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h \
        Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp \
        Source/WebCore/Modules/webdatabase/DatabaseTracker.h \
        Source/WebCore/Modules/webdatabase/OriginQuotaManager.cpp \
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
new file mode 100644 (file)
index 0000000..4336d24
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "DatabaseManager.h"
+
+#if ENABLE(SQL_DATABASE)
+
+#include "AbstractDatabase.h"
+#include "DatabaseContext.h"
+#include "DatabaseTracker.h"
+
+namespace WebCore {
+
+DatabaseManager& DatabaseManager::manager()
+{
+    static DatabaseManager* dbManager = 0;
+    if (!dbManager)
+        dbManager = new DatabaseManager();
+
+    return *dbManager;
+}
+
+DatabaseManager::DatabaseManager()
+{
+}
+
+void DatabaseManager::initialize(const String& databasePath)
+{
+    DatabaseTracker::initializeTracker(databasePath);
+}
+
+#if !PLATFORM(CHROMIUM)
+void DatabaseManager::setClient(DatabaseManagerClient* client)
+{
+    DatabaseTracker::tracker().setClient(client);
+}
+
+String DatabaseManager::databaseDirectoryPath() const
+{
+    return DatabaseTracker::tracker().databaseDirectoryPath();
+}
+
+void DatabaseManager::setDatabaseDirectoryPath(const String& path)
+{
+    DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
+}
+#endif
+
+bool DatabaseManager::isAvailable()
+{
+    return AbstractDatabase::isAvailable();
+}
+
+void DatabaseManager::setIsAvailable(bool available)
+{
+    AbstractDatabase::setIsAvailable(available);
+}
+
+bool DatabaseManager::hasOpenDatabases(ScriptExecutionContext* context)
+{
+    return DatabaseContext::hasOpenDatabases(context);
+}
+
+void DatabaseManager::stopDatabases(ScriptExecutionContext* context, DatabaseTaskSynchronizer* synchronizer)
+{
+    DatabaseContext::stopDatabases(context, synchronizer);
+}
+
+String DatabaseManager::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfDoesNotExist)
+{
+    return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIfDoesNotExist);
+}
+
+#if !PLATFORM(CHROMIUM)
+bool DatabaseManager::hasEntryForOrigin(SecurityOrigin* origin)
+{
+    return DatabaseTracker::tracker().hasEntryForOrigin(origin);
+}
+
+void DatabaseManager::origins(Vector<RefPtr<SecurityOrigin> >& result)
+{
+    DatabaseTracker::tracker().origins(result);
+}
+
+bool DatabaseManager::databaseNamesForOrigin(SecurityOrigin* origin, Vector<String>& result)
+{
+    return DatabaseTracker::tracker().databaseNamesForOrigin(origin, result);
+}
+
+DatabaseDetails DatabaseManager::detailsForNameAndOrigin(const String& name, SecurityOrigin* origin)
+{
+    return DatabaseTracker::tracker().detailsForNameAndOrigin(name, origin);
+}
+
+unsigned long long DatabaseManager::usageForOrigin(SecurityOrigin* origin)
+{
+    return DatabaseTracker::tracker().usageForOrigin(origin);
+}
+
+unsigned long long DatabaseManager::quotaForOrigin(SecurityOrigin* origin)
+{
+    return DatabaseTracker::tracker().quotaForOrigin(origin);
+}
+
+void DatabaseManager::setQuota(SecurityOrigin* origin, unsigned long long quotaSize)
+{
+    DatabaseTracker::tracker().setQuota(origin, quotaSize);
+}
+
+void DatabaseManager::deleteAllDatabases()
+{
+    DatabaseTracker::tracker().deleteAllDatabases();
+}
+
+bool DatabaseManager::deleteOrigin(SecurityOrigin* origin)
+{
+    return DatabaseTracker::tracker().deleteOrigin(origin);
+}
+
+bool DatabaseManager::deleteDatabase(SecurityOrigin* origin, const String& name)
+{
+    return DatabaseTracker::tracker().deleteDatabase(origin, name);
+}
+
+#else // PLATFORM(CHROMIUM)
+void DatabaseManager::closeDatabasesImmediately(const String& originIdentifier, const String& name)
+{
+    DatabaseTracker::tracker().closeDatabasesImmediately(originIdentifier, name);
+}
+#endif // PLATFORM(CHROMIUM)
+
+void DatabaseManager::interruptAllDatabasesForContext(const ScriptExecutionContext* context)
+{
+    DatabaseTracker::tracker().interruptAllDatabasesForContext(context);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SQL_DATABASE)
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.h b/Source/WebCore/Modules/webdatabase/DatabaseManager.h
new file mode 100644 (file)
index 0000000..4f7b373
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef DatabaseManager_h
+#define DatabaseManager_h
+
+#if ENABLE(SQL_DATABASE)
+
+#include "DatabaseDetails.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class DatabaseManagerClient;
+class DatabaseTaskSynchronizer;
+class SecurityOrigin;
+class ScriptExecutionContext;
+
+class DatabaseManager {
+    WTF_MAKE_NONCOPYABLE(DatabaseManager); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static DatabaseManager& manager();
+
+    void initialize(const String& databasePath);
+#if !PLATFORM(CHROMIUM)
+    void setClient(DatabaseManagerClient*);
+    String databaseDirectoryPath() const;
+    void setDatabaseDirectoryPath(const String&);
+#endif
+
+    bool isAvailable();
+    void setIsAvailable(bool);
+
+    bool hasOpenDatabases(ScriptExecutionContext*);
+    // When the database cleanup is done, cleanupSync will be signalled.
+    void stopDatabases(ScriptExecutionContext*, DatabaseTaskSynchronizer*);
+
+    String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true);
+
+#if !PLATFORM(CHROMIUM)
+    bool hasEntryForOrigin(SecurityOrigin*);
+    void origins(Vector<RefPtr<SecurityOrigin> >& result);
+    bool databaseNamesForOrigin(SecurityOrigin*, Vector<String>& result);
+    DatabaseDetails detailsForNameAndOrigin(const String&, SecurityOrigin*);
+
+    unsigned long long usageForOrigin(SecurityOrigin*);
+    unsigned long long quotaForOrigin(SecurityOrigin*);
+
+    void setQuota(SecurityOrigin*, unsigned long long);
+
+    void deleteAllDatabases();
+    bool deleteOrigin(SecurityOrigin*);
+    bool deleteDatabase(SecurityOrigin*, const String& name);
+
+#else // PLATFORM(CHROMIUM)
+    void closeDatabasesImmediately(const String& originIdentifier, const String& name);
+#endif // PLATFORM(CHROMIUM)
+
+    void interruptAllDatabasesForContext(const ScriptExecutionContext*);
+
+private:
+    DatabaseManager();
+    ~DatabaseManager() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SQL_DATABASE)
+
+#endif // DatabaseManager_h
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h b/Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h
new file mode 100644 (file)
index 0000000..f4da546
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2007,2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef DatabaseManagerClient_h
+#define DatabaseManagerClient_h
+
+#if ENABLE(SQL_DATABASE)
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class SecurityOrigin;
+
+class DatabaseManagerClient {
+public:
+    virtual ~DatabaseManagerClient() { }
+    virtual void dispatchDidModifyOrigin(SecurityOrigin*) = 0;
+    virtual void dispatchDidModifyDatabase(SecurityOrigin*, const String& databaseName) = 0;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // DatabaseManagerClient_h
index 5bd5e7b..8227d35 100644 (file)
@@ -35,8 +35,8 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "DatabaseContext.h"
+#include "DatabaseManagerClient.h"
 #include "DatabaseThread.h"
-#include "DatabaseTrackerClient.h"
 #include "Logging.h"
 #include "OriginQuotaManager.h"
 #include "Page.h"
@@ -1046,7 +1046,7 @@ bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& n
     return SQLiteFileSystem::deleteDatabaseFile(fullPath);
 }
 
-void DatabaseTracker::setClient(DatabaseTrackerClient* client)
+void DatabaseTracker::setClient(DatabaseManagerClient* client)
 {
     m_client = client;
 }
index bba4892..e8f0508 100644 (file)
@@ -51,7 +51,7 @@ class SecurityOrigin;
 struct SecurityOriginHash;
 
 #if !PLATFORM(CHROMIUM)
-class DatabaseTrackerClient;
+class DatabaseManagerClient;
 
 struct SecurityOriginTraits;
 #endif // !PLATFORM(CHROMIUM)
@@ -103,7 +103,7 @@ public:
     bool deleteOrigin(SecurityOrigin*);
     bool deleteDatabase(SecurityOrigin*, const String& name);
 
-    void setClient(DatabaseTrackerClient*);
+    void setClient(DatabaseManagerClient*);
 
     // From a secondary thread, must be thread safe with its data
     void scheduleNotifyDatabaseChanged(SecurityOrigin*, const String& name);
@@ -145,7 +145,7 @@ private:
 
     String m_databaseDirectoryPath;
 
-    DatabaseTrackerClient* m_client;
+    DatabaseManagerClient* m_client;
 
     typedef std::pair<RefPtr<SecurityOrigin>, DatabaseDetails> ProposedDatabase;
     HashSet<ProposedDatabase*> m_proposedDatabases;
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h b/Source/WebCore/Modules/webdatabase/DatabaseTrackerClient.h
deleted file mode 100644 (file)
index 9c08bcd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef DatabaseTrackerClient_h
-#define DatabaseTrackerClient_h
-
-#if ENABLE(SQL_DATABASE)
-
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class SecurityOrigin;
-
-class DatabaseTrackerClient {
-public:
-    virtual ~DatabaseTrackerClient() { }
-    virtual void dispatchDidModifyOrigin(SecurityOrigin*) = 0;
-    virtual void dispatchDidModifyDatabase(SecurityOrigin*, const String& databaseName) = 0;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // DatabaseTrackerClient_h
index 9b8d9c6..51a14f3 100644 (file)
@@ -1414,6 +1414,7 @@ HEADERS += \
     Modules/webdatabase/DatabaseAuthorizer.h \
     Modules/webdatabase/Database.h \
     Modules/webdatabase/DatabaseCallback.h \
+    Modules/webdatabase/DatabaseManager.h \
     Modules/webdatabase/DatabaseSync.h \
     Modules/webdatabase/DatabaseTask.h \
     Modules/webdatabase/DatabaseThread.h \
@@ -2970,6 +2971,7 @@ use?(PLUGIN_BACKEND_XLIB) {
 enable?(SQL_DATABASE) {
     SOURCES += \
         Modules/webdatabase/ChangeVersionWrapper.cpp \
+        Modules/webdatabase/DatabaseManager.cpp \
         Modules/webdatabase/DatabaseTask.cpp \
         Modules/webdatabase/DatabaseThread.cpp \
         Modules/webdatabase/DatabaseTracker.cpp \
index b6d591b..f9ea562 100644 (file)
@@ -364,19 +364,20 @@ __ZN7WebCore15AffineTransformC1Ev
 __ZN7WebCore15ArchiveResource6createEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS_4KURLERKNS1_6StringESA_SA_RKNS_16ResourceResponseE
 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv
 __ZN7WebCore15DOMWrapperWorldD1Ev
-__ZN7WebCore15DatabaseContext16hasOpenDatabasesEPNS_22ScriptExecutionContextE
-__ZN7WebCore15DatabaseTracker12deleteOriginEPNS_14SecurityOriginE
-__ZN7WebCore15DatabaseTracker14deleteDatabaseEPNS_14SecurityOriginERKN3WTF6StringE
-__ZN7WebCore15DatabaseTracker14quotaForOriginEPNS_14SecurityOriginE
-__ZN7WebCore15DatabaseTracker14usageForOriginEPNS_14SecurityOriginE
-__ZN7WebCore15DatabaseTracker17initializeTrackerERKN3WTF6StringE
-__ZN7WebCore15DatabaseTracker18deleteAllDatabasesEv
-__ZN7WebCore15DatabaseTracker22databaseNamesForOriginEPNS_14SecurityOriginERN3WTF6VectorINS3_6StringELm0EEE
-__ZN7WebCore15DatabaseTracker23detailsForNameAndOriginERKN3WTF6StringEPNS_14SecurityOriginE
-__ZN7WebCore15DatabaseTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0EEE
-__ZN7WebCore15DatabaseTracker7trackerEv
-__ZN7WebCore15DatabaseTracker8setQuotaEPNS_14SecurityOriginEy
-__ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseTrackerClientE
+__ZN7WebCore15DatabaseManager14setIsAvailableEb
+__ZN7WebCore15DatabaseManager16hasOpenDatabasesEPNS_22ScriptExecutionContextE
+__ZN7WebCore15DatabaseManager12deleteOriginEPNS_14SecurityOriginE
+__ZN7WebCore15DatabaseManager14deleteDatabaseEPNS_14SecurityOriginERKN3WTF6StringE
+__ZN7WebCore15DatabaseManager14quotaForOriginEPNS_14SecurityOriginE
+__ZN7WebCore15DatabaseManager14usageForOriginEPNS_14SecurityOriginE
+__ZN7WebCore15DatabaseManager10initializeERKN3WTF6StringE
+__ZN7WebCore15DatabaseManager18deleteAllDatabasesEv
+__ZN7WebCore15DatabaseManager22databaseNamesForOriginEPNS_14SecurityOriginERN3WTF6VectorINS3_6StringELm0EEE
+__ZN7WebCore15DatabaseManager23detailsForNameAndOriginERKN3WTF6StringEPNS_14SecurityOriginE
+__ZN7WebCore15DatabaseManager7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0EEE
+__ZN7WebCore15DatabaseManager7managerEv
+__ZN7WebCore15DatabaseManager8setQuotaEPNS_14SecurityOriginEy
+__ZN7WebCore15DatabaseManager9setClientEPNS_21DatabaseManagerClientE
 __ZN7WebCore15FocusController10setFocusedEb
 __ZN7WebCore15FocusController14setFocusedNodeEPNS_4NodeEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
@@ -431,7 +432,6 @@ __ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi
 __ZN7WebCore15toDOMStringListEPN3JSC9ExecStateENS0_7JSValueE
 __ZN7WebCore15visitedLinkHashEPKtj
 __ZN7WebCore15visitedLinkHashERKN3WTF6StringE
-__ZN7WebCore16AbstractDatabase14setIsAvailableEb
 __ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
@@ -1917,11 +1917,6 @@ __ZN7WebCore14IconController3urlEv
 __ZN7WebCore14ResourceHandle6cancelEv
 __ZN7WebCore14ResourceHandle9setClientEPNS_20ResourceHandleClientE
 __ZN7WebCore14ResourceHandleD1Ev
-__ZN7WebCore15DatabaseTracker16originsDidChangeEv
-__ZN7WebCore15DatabaseTracker25deleteDatabaseFileIfEmptyERKN3WTF6StringE
-__ZN7WebCore15DatabaseTracker28removeDeletedOpenedDatabasesEv
-__ZN7WebCore15DatabaseTracker38emptyDatabaseFilesRemovalTaskDidFinishEv
-__ZN7WebCore15DatabaseTracker44emptyDatabaseFilesRemovalTaskWillBeScheduledEv
 __ZN7WebCore15GraphicsContext12drawBidiTextERKNS_4FontERKNS_7TextRunERKNS_10FloatPointEPNS_10BidiStatusEi
 __ZN7WebCore15GraphicsContext15drawLineForTextERKNS_10FloatPointEfb
 __ZN7WebCore15GraphicsContext22setEmojiDrawingEnabledEb
@@ -1963,8 +1958,6 @@ __ZN7WebCore21MemoryPressureHandler19clearMemoryPressureEv
 __ZN7WebCore21MemoryPressureHandler25hasReceivedMemoryPressureEv
 __ZN7WebCore21MemoryPressureHandler25installMemoryReleaseBlockEU13block_pointerFvvEb
 __ZN7WebCore21MemoryPressureHandler25setReceivedMemoryPressureEv
-__ZN7WebCore21SQLiteDatabaseTracker7trackerEv
-__ZN7WebCore21SQLiteDatabaseTracker9setClientEPNS_27SQLiteDatabaseTrackerClientE
 __ZN7WebCore21applicationIsFacebookEv
 __ZN7WebCore21nextBreakablePositionERNS_21LazyLineBreakIteratorEib
 __ZN7WebCore21nextParagraphPositionERKNS_15VisiblePositionEi
index 859b0ac..b529a9d 100644 (file)
 
         ['exclude', 'Modules/filesystem/LocalFileSystem\\.cpp$'],
         ['exclude', 'Modules/indexeddb/IDBFactoryBackendInterface\\.cpp$'],
-        ['exclude', 'Modules/webdatabase/DatabaseTrackerClient\\.h$'],
+        ['exclude', 'Modules/webdatabase/DatabaseManagerClient\\.h$'],
         ['exclude', 'Modules/webdatabase/DatabaseTracker\\.cpp$'],
         ['exclude', 'Modules/webdatabase/OriginQuotaManager\\.(cpp|h)$'],
         ['exclude', 'Modules/webdatabase/OriginUsageRecord\\.(cpp|h)$'],
index 9bd33a3..690d188 100644 (file)
             'Modules/webdatabase/DatabaseCallback.h',
             'Modules/webdatabase/DatabaseContext.cpp',
             'Modules/webdatabase/DatabaseContext.h',
+            'Modules/webdatabase/DatabaseManager.cpp',
             'Modules/webdatabase/DatabaseSync.cpp',
             'Modules/webdatabase/DatabaseSync.h',
             'Modules/webdatabase/DatabaseTask.cpp',
index 00f6f14..2cb6d2e 100644 (file)
@@ -442,7 +442,7 @@ __ZN7WebCore15DatabaseTracker19openTrackerDatabaseEb
 __ZN7WebCore16SQLiteFileSystem28appendDatabaseFileNameToPathERKN3WTF6StringES4_
 __ZN7WebCore16SQLiteFileSystem24ensureDatabaseFileExistsERKN3WTF6StringEb
 __ZN7WebCore15DatabaseTracker7trackerEv
-__ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseTrackerClientE
+__ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseManagerClientE
 __ZN7WebCore14StorageTracker17initializeTrackerERKN3WTF6StringE
 __ZN7WebCore13StorageThread6createEv
 __ZN7WebCore14StorageTracker23setStorageDirectoryPathERKN3WTF6StringE
index afc51a9..25ee3c0 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\Modules\webdatabase\DatabaseManager.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\Modules\webdatabase\DatabaseManager.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\Modules\webdatabase\DatabaseSync.cpp"
                                        >
                                </File>
index 5ad2ce4..71b5219 100644 (file)
                97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69E51505F081001B74AC /* DatabaseContext.cpp */; };
                97BC6A281505F081001B74AC /* DatabaseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69E61505F081001B74AC /* DatabaseContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                97BC6A291505F081001B74AC /* DatabaseDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69E71505F081001B74AC /* DatabaseDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */; };
+               FE456F191677D74E005EDDF9 /* DatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FE456F171677D74E005EDDF9 /* DatabaseManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                97BC6A2A1505F081001B74AC /* DatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69E81505F081001B74AC /* DatabaseSync.cpp */; };
                97BC6A2B1505F081001B74AC /* DatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69E91505F081001B74AC /* DatabaseSync.h */; };
                97BC6A2D1505F081001B74AC /* DatabaseTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69EB1505F081001B74AC /* DatabaseTask.cpp */; };
                97BC6A301505F081001B74AC /* DatabaseThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69EE1505F081001B74AC /* DatabaseThread.h */; };
                97BC6A311505F081001B74AC /* DatabaseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69EF1505F081001B74AC /* DatabaseTracker.cpp */; };
                97BC6A321505F081001B74AC /* DatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69F01505F081001B74AC /* DatabaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               97BC6A331505F081001B74AC /* DatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69F11505F081001B74AC /* DatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               97BC6A331505F081001B74AC /* DatabaseManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69F11505F081001B74AC /* DatabaseManagerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                97BC6A371505F081001B74AC /* OriginQuotaManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69F51505F081001B74AC /* OriginQuotaManager.cpp */; };
                97BC6A381505F081001B74AC /* OriginQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69F61505F081001B74AC /* OriginQuotaManager.h */; };
                97BC6A391505F081001B74AC /* OriginUsageRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69F71505F081001B74AC /* OriginUsageRecord.cpp */; };
                97BC69EE1505F081001B74AC /* DatabaseThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseThread.h; path = Modules/webdatabase/DatabaseThread.h; sourceTree = "<group>"; };
                97BC69EF1505F081001B74AC /* DatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseTracker.cpp; path = Modules/webdatabase/DatabaseTracker.cpp; sourceTree = "<group>"; };
                97BC69F01505F081001B74AC /* DatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseTracker.h; path = Modules/webdatabase/DatabaseTracker.h; sourceTree = "<group>"; };
-               97BC69F11505F081001B74AC /* DatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseTrackerClient.h; path = Modules/webdatabase/DatabaseTrackerClient.h; sourceTree = "<group>"; };
+               97BC69F11505F081001B74AC /* DatabaseManagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManagerClient.h; path = Modules/webdatabase/DatabaseManagerClient.h; sourceTree = "<group>"; };
                97BC69F51505F081001B74AC /* OriginQuotaManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OriginQuotaManager.cpp; path = Modules/webdatabase/OriginQuotaManager.cpp; sourceTree = "<group>"; };
                97BC69F61505F081001B74AC /* OriginQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OriginQuotaManager.h; path = Modules/webdatabase/OriginQuotaManager.h; sourceTree = "<group>"; };
                97BC69F71505F081001B74AC /* OriginUsageRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OriginUsageRecord.cpp; path = Modules/webdatabase/OriginUsageRecord.cpp; sourceTree = "<group>"; };
                FDF6BAF7134A4C9800822920 /* JSOfflineAudioCompletionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOfflineAudioCompletionEvent.h; sourceTree = "<group>"; };
                FDF7E9C113AC21DB00A51EAC /* JSAudioBufferCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioBufferCallback.cpp; sourceTree = "<group>"; };
                FDF7E9C213AC21DB00A51EAC /* JSAudioBufferCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAudioBufferCallback.h; sourceTree = "<group>"; };
+               FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseManager.cpp; path = Modules/webdatabase/DatabaseManager.cpp; sourceTree = "<group>"; };
+               FE456F171677D74E005EDDF9 /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManager.h; path = Modules/webdatabase/DatabaseManager.h; sourceTree = "<group>"; };
                FE6FD4850F676E5700092873 /* Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coordinates.h; sourceTree = "<group>"; };
                FE6FD4860F676E5700092873 /* Coordinates.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Coordinates.idl; sourceTree = "<group>"; };
                FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = "<group>"; };
                                97BC69E51505F081001B74AC /* DatabaseContext.cpp */,
                                97BC69E61505F081001B74AC /* DatabaseContext.h */,
                                97BC69E71505F081001B74AC /* DatabaseDetails.h */,
+                               FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */,
+                               FE456F171677D74E005EDDF9 /* DatabaseManager.h */,
+                               97BC69F11505F081001B74AC /* DatabaseManagerClient.h */,
                                97BC69E81505F081001B74AC /* DatabaseSync.cpp */,
                                97BC69E91505F081001B74AC /* DatabaseSync.h */,
                                97BC69EA1505F081001B74AC /* DatabaseSync.idl */,
                                97BC69EE1505F081001B74AC /* DatabaseThread.h */,
                                97BC69EF1505F081001B74AC /* DatabaseTracker.cpp */,
                                97BC69F01505F081001B74AC /* DatabaseTracker.h */,
-                               97BC69F11505F081001B74AC /* DatabaseTrackerClient.h */,
                                A8CCBB46151F831600AB7CE9 /* DOMWindowWebDatabase.cpp */,
                                A8CCBB47151F831600AB7CE9 /* DOMWindowWebDatabase.h */,
                                A8CCBB4E151F835A00AB7CE9 /* DOMWindowWebDatabase.idl */,
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               FE456F191677D74E005EDDF9 /* DatabaseManager.h in Headers */,
                                E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */,
                                C375D7FE16639519006184AB /* TypeAhead.h in Headers */,
                                FD1AF1501656F15100C6D4F7 /* ExclusionShapeValue.h in Headers */,
                                97BC6A251505F081001B74AC /* DatabaseCallback.h in Headers */,
                                97BC6A281505F081001B74AC /* DatabaseContext.h in Headers */,
                                97BC6A291505F081001B74AC /* DatabaseDetails.h in Headers */,
+                               97BC6A331505F081001B74AC /* DatabaseManagerClient.h in Headers */,
                                97BC6A2B1505F081001B74AC /* DatabaseSync.h in Headers */,
                                97BC6A2E1505F081001B74AC /* DatabaseTask.h in Headers */,
                                97BC6A301505F081001B74AC /* DatabaseThread.h in Headers */,
                                97BC6A321505F081001B74AC /* DatabaseTracker.h in Headers */,
-                               97BC6A331505F081001B74AC /* DatabaseTrackerClient.h in Headers */,
                                BC22746F0E83664500E7F975 /* DataRef.h in Headers */,
                                BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */,
                                81AC5999131636E60009A7E0 /* DataTransferItem.h in Headers */,
                                E1513D511677F08800149FCB /* NotImplemented.cpp in Sources */,
                                FDA9325D16703B2A008982DC /* OfflineAudioContext.cpp in Sources */,
                                FDA9326616703BA9008982DC /* JSOfflineAudioContext.cpp in Sources */,
+                               FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ac65002..707e0cc 100644 (file)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "RuntimeEnabledFeatures.h"
 
-#include "AbstractDatabase.h"
+#include "DatabaseManager.h"
 #include "MediaPlayer.h"
 #include "SharedWorkerRepository.h"
 #include "WebSocket.h"
@@ -150,12 +150,12 @@ bool RuntimeEnabledFeatures::webSocketEnabled()
 #if ENABLE(SQL_DATABASE)
 bool RuntimeEnabledFeatures::openDatabaseEnabled()
 {
-    return AbstractDatabase::isAvailable();
+    return DatabaseManager::manager().isAvailable();
 }
 
 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
 {
-    return AbstractDatabase::isAvailable();
+    return DatabaseManager::manager().isAvailable();
 }
 #endif
 
index e7eebdc..96aa592 100644 (file)
@@ -31,7 +31,7 @@
 #include "MemoryCache.h"
 #include "CachedPage.h"
 #include "DOMWindow.h"
-#include "DatabaseContext.h"
+#include "DatabaseManager.h"
 #include "DeviceMotionController.h"
 #include "DeviceOrientationController.h"
 #include "Document.h"
@@ -142,7 +142,7 @@ static unsigned logCanCacheFrameDecision(Frame* frame, int indentLevel)
         rejectReasons |= 1 << HasUnloadListener;
     }
 #if ENABLE(SQL_DATABASE)
-    if (DatabaseContext::hasOpenDatabases(frame->document())) {
+    if (DatabaseManager::manager().hasOpenDatabases(frame->document())) {
         PCLOG("   -Frame has open database handles");
         rejectReasons |= 1 << HasDatabaseHandles;
     }
@@ -345,7 +345,7 @@ bool PageCache::canCachePageContainingThisFrame(Frame* frame)
         && (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
         && (!document->domWindow() || !document->domWindow()->hasEventListeners(eventNames().unloadEvent))
 #if ENABLE(SQL_DATABASE)
-        && !DatabaseContext::hasOpenDatabases(document)
+        && !DatabaseManager::manager().hasOpenDatabases(document)
 #endif
 #if ENABLE(SHARED_WORKERS)
         && !SharedWorkerRepository::hasSharedWorkers(document)
index faf1e7d..4c0261c 100644 (file)
@@ -46,9 +46,9 @@
 #include "ChromeClient.h"
 #include "Console.h"
 #include "ContentSecurityPolicy.h"
-#include "DatabaseContext.h"
 #include "DOMImplementation.h"
 #include "DOMWindow.h"
+#include "DatabaseManager.h"
 #include "Document.h"
 #include "DocumentLoadTiming.h"
 #include "DocumentLoader.h"
@@ -450,8 +450,8 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy)
         doc->setReadyState(Document::Complete);
 
 #if ENABLE(SQL_DATABASE)
-        // FIXME: Should the DatabaseContext watch for something like ActiveDOMObject::stop() rather than being special-cased here?
-        DatabaseContext::stopDatabases(doc, 0);
+        // FIXME: Should the DatabaseManager watch for something like ActiveDOMObject::stop() rather than being special-cased here?
+        DatabaseManager::manager().stopDatabases(doc, 0);
 #endif
     }
 
index b9b67c6..9c91632 100644 (file)
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "DOMWindow.h"
 
-#include "AbstractDatabase.h"
 #include "BackForwardController.h"
 #include "BarInfo.h"
 #include "BeforeUnloadEvent.h"
@@ -46,8 +45,6 @@
 #include "DOMURL.h"
 #include "DOMWindowExtension.h"
 #include "DOMWindowNotifications.h"
-#include "Database.h"
-#include "DatabaseCallback.h"
 #include "DeviceMotionController.h"
 #include "DeviceOrientationController.h"
 #include "Document.h"
index 8b08bda..2431fac 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "WorkerThread.h"
 
-#include "DatabaseContext.h"
 #include "DedicatedWorkerContext.h"
 #include "InspectorInstrumentation.h"
 #include "KURL.h"
@@ -43,8 +42,8 @@
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(SQL_DATABASE)
+#include "DatabaseManager.h"
 #include "DatabaseTask.h"
-#include "DatabaseTracker.h"
 #endif
 
 #if PLATFORM(CHROMIUM)
@@ -231,7 +230,7 @@ public:
 #if ENABLE(SQL_DATABASE)
         // FIXME: Should we stop the databases as part of stopActiveDOMObjects() below?
         DatabaseTaskSynchronizer cleanupSync;
-        DatabaseContext::stopDatabases(workerContext, &cleanupSync);
+        DatabaseManager::manager().stopDatabases(workerContext, &cleanupSync);
 #endif
 
         workerContext->stopActiveDOMObjects();
@@ -266,7 +265,7 @@ void WorkerThread::stop()
         m_workerContext->script()->scheduleExecutionTermination();
 
 #if ENABLE(SQL_DATABASE)
-        DatabaseTracker::tracker().interruptAllDatabasesForContext(m_workerContext.get());
+        DatabaseManager::manager().interruptAllDatabasesForContext(m_workerContext.get());
 #endif
         m_runLoop.postTask(WorkerThreadShutdownStartTask::create());
     }
index 40981ea..1ac407e 100644 (file)
@@ -1,3 +1,16 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2012-12-05  Halton Huo  <halton.huo@intel.com>
 
         [CMake] Unify coding style for CMake files
index 019cbd4..229a5f2 100644 (file)
@@ -92,8 +92,8 @@
                4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; };
                511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; };
                511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */; };
-               511F3FD80CECC88F00852565 /* WebDatabaseTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */; };
+               511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */; };
+               511F3FD80CECC88F00852565 /* WebDatabaseManagerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */; };
                51494CD60C7EBDE0004178C5 /* WebIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494CD40C7EBDE0004178C5 /* WebIconDatabaseClient.h */; };
                51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */; };
                51494D240C7EC1B7004178C5 /* WebNSNotificationCenterExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494D220C7EC1B6004178C5 /* WebNSNotificationCenterExtras.h */; };
                4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; };
                511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; };
                511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerPrivate.h; sourceTree = "<group>"; };
-               511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseTrackerClient.h; sourceTree = "<group>"; };
-               511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseTrackerClient.mm; sourceTree = "<group>"; };
+               511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerClient.h; sourceTree = "<group>"; };
+               511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManagerClient.mm; sourceTree = "<group>"; };
                513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPolicyDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPolicyDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        isa = PBXGroup;
                        children = (
                                511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
+                               511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */,
+                               511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */,
                                51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
                                511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
                                A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
                                A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
-                               511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */,
-                               511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */,
                                3AB02AF512C1319B00FBB694 /* WebStorageManager.mm */,
                                3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */,
                                3AB02AFF12C132B200FBB694 /* WebStorageManagerPrivate.h */,
                                065AD5A30B0C32C7005A2B1D /* WebContextMenuClient.h in Headers */,
                                939810160824BF01008DF038 /* WebCoreStatistics.h in Headers */,
                                93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */,
+                               511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */,
                                51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
                                511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
                                A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
-                               511F3FD70CECC88F00852565 /* WebDatabaseTrackerClient.h in Headers */,
                                9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
                                658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
                                9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
                                939810BF0824BF01008DF038 /* WebCoreStatistics.mm in Sources */,
                                93E2A1A5123B0B3C009FE12A /* WebDashboardRegion.mm in Sources */,
                                511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */,
+                               511F3FD80CECC88F00852565 /* WebDatabaseManagerClient.mm in Sources */,
                                A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */,
-                               511F3FD80CECC88F00852565 /* WebDatabaseTrackerClient.mm in Sources */,
                                939810ED0824BF01008DF038 /* WebDataSource.mm in Sources */,
                                939810EF0824BF01008DF038 /* WebDefaultContextMenuDelegate.mm in Sources */,
                                9398111B0824BF01008DF038 /* WebDefaultEditingDelegate.m in Sources */,
index 51af815..9ee81e9 100644 (file)
@@ -39,8 +39,8 @@
 #include "CredentialTransformData.h"
 #include "DOMSupport.h"
 #include "Database.h"
+#include "DatabaseManager.h"
 #include "DatabaseSync.h"
-#include "DatabaseTracker.h"
 #include "DefaultTapHighlight.h"
 #include "DeviceMotionClientBlackBerry.h"
 #include "DeviceOrientationClientBlackBerry.h"
@@ -5843,13 +5843,13 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setCookieEnabled(webSettings->areCookiesEnabled());
 
 #if ENABLE(SQL_DATABASE)
-    // DatabaseTracker can only be initialized for once, so it doesn't
-    // make sense to change database path after DatabaseTracker has
+    // DatabaseManager can only be initialized for once, so it doesn't
+    // make sense to change database path after DatabaseManager has
     // already been initialized.
     static bool dbinit = false;
     if (!dbinit && !webSettings->databasePath().empty()) {
         dbinit = true;
-        DatabaseTracker::initializeTracker(webSettings->databasePath());
+        DatabaseManager::initialize(webSettings->databasePath());
     }
 
     // The directory of cacheStorage for one page group can only be initialized once.
index 71ac302..3f0bbdd 100644 (file)
@@ -1,3 +1,19 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::exceededDatabaseQuota):
+
 2012-12-12  Mike Fenton  <mifenton@rim.com>
 
         [BlackBerry] Fix word matching algorithm to account for adjacent divs with no whitespace between them.
index 8705ff3..b01b1cd 100644 (file)
@@ -24,7 +24,7 @@
 #include "BackingStoreClient.h"
 #include "BackingStore_p.h"
 #include "ColorChooser.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "Document.h"
 #include "DumpRenderTreeClient.h"
 #include "DumpRenderTreeSupport.h"
@@ -496,12 +496,12 @@ void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const String& n
     }
 #endif
 
-    DatabaseTracker& tracker = DatabaseTracker::tracker();
+    DatabaseManager& manager = DatabaseManager::manager();
 
-    unsigned long long totalUsage = tracker.totalDatabaseUsage();
-    unsigned long long originUsage = tracker.usageForOrigin(origin);
+    unsigned long long totalUsage = manager.totalDatabaseUsage();
+    unsigned long long originUsage = manager.usageForOrigin(origin);
 
-    DatabaseDetails details = tracker.detailsForNameAndOrigin(name, origin);
+    DatabaseDetails details = manager.detailsForNameAndOrigin(name, origin);
     unsigned long long estimatedSize = details.expectedUsage();
     const String& nameStr = details.displayName();
 
@@ -510,7 +510,7 @@ void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const String& n
     unsigned long long quota = m_webPagePrivate->m_client->databaseQuota(originStr.characters(), originStr.length(),
         nameStr.characters(), nameStr.length(), totalUsage, originUsage, estimatedSize);
 
-    tracker.setQuota(origin, quota);
+    manager.setQuota(origin, quota);
 #endif
 }
 
index 66bc1e0..e5c3b1d 100644 (file)
@@ -1,3 +1,21 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * src/ChromeClientImpl.cpp:
+        * src/WebDatabase.cpp:
+        (WebKit::WebDatabase::closeDatabaseImmediately):
+        * src/WebRuntimeFeatures.cpp:
+        (WebKit::WebRuntimeFeatures::enableDatabase):
+        (WebKit::WebRuntimeFeatures::isDatabaseEnabled):
+
 2012-12-12  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r137490.
index 107c46a..21dbf40 100644 (file)
@@ -45,7 +45,6 @@
 #endif
 #include "Console.h"
 #include "Cursor.h"
-#include "DatabaseTracker.h"
 #include "DateTimeChooser.h"
 #include "DateTimeChooserImpl.h"
 #include "Document.h"
index 04d4a40..ef132a1 100644 (file)
@@ -32,7 +32,7 @@
 #include "WebDatabase.h"
 
 #include "AbstractDatabase.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "QuotaTracker.h"
 #include "SecurityOrigin.h"
 #include "WebDatabaseObserver.h"
@@ -123,7 +123,7 @@ void WebDatabase::resetSpaceAvailable(const WebString& originIdentifier)
 void WebDatabase::closeDatabaseImmediately(const WebString& originIdentifier, const WebString& databaseName)
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().closeDatabasesImmediately(originIdentifier, databaseName);
+    DatabaseManager::manager().closeDatabasesImmediately(originIdentifier, databaseName);
 #endif
 }
 
index 7fec109..8262cd3 100644 (file)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "WebRuntimeFeatures.h"
 
-#include "AbstractDatabase.h"
+#include "DatabaseManager.h"
 #include "RuntimeEnabledFeatures.h"
 #include "WebMediaPlayerClientImpl.h"
 #include "Modules/websockets/WebSocket.h"
@@ -45,14 +45,14 @@ namespace WebKit {
 void WebRuntimeFeatures::enableDatabase(bool enable)
 {
 #if ENABLE(SQL_DATABASE)
-    AbstractDatabase::setIsAvailable(enable);
+    DatabaseManager::manager().setIsAvailable(enable);
 #endif
 }
 
 bool WebRuntimeFeatures::isDatabaseEnabled()
 {
 #if ENABLE(SQL_DATABASE)
-    return AbstractDatabase::isAvailable();
+    return DatabaseManager::manager().isAvailable();
 #else
     return false;
 #endif
index 4227951..315abdb 100644 (file)
@@ -1,3 +1,31 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::exceededDatabaseQuota):
+        * ewk/ewk_security_origin.cpp:
+        (ewk_security_origin_web_database_usage_get):
+        (ewk_security_origin_web_database_quota_get):
+        (ewk_security_origin_web_database_quota_set):
+        (ewk_security_origin_web_database_get_all):
+        * ewk/ewk_settings.cpp:
+        (ewk_settings_web_database_path_set):
+        * ewk/ewk_web_database.cpp:
+        (ewk_web_database_display_name_get):
+        (ewk_web_database_expected_size_get):
+        (ewk_web_database_filename_get):
+        (ewk_web_database_size_get):
+        (ewk_web_database_remove):
+        (ewk_web_database_remove_all):
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         Make LOG() work in WebProcess and NetworkProcess
index 5ef5e68..04f2250 100644 (file)
@@ -68,7 +68,7 @@
 
 #if ENABLE(SQL_DATABASE)
 #include "DatabaseDetails.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
@@ -425,7 +425,7 @@ void ChromeClientEfl::exceededDatabaseQuota(Frame* frame, const String& database
     uint64_t quota;
     SecurityOrigin* origin = frame->document()->securityOrigin();
 
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin);
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(databaseName, origin);
     quota = ewk_view_exceeded_database_quota(m_view,
                                              kit(frame), databaseName.utf8().data(),
                                              details.currentUsage(), details.expectedUsage());
@@ -433,10 +433,10 @@ void ChromeClientEfl::exceededDatabaseQuota(Frame* frame, const String& database
     /* if client did not set quota, and database is being created now, the
      * default quota is applied
      */
-    if (!quota && !DatabaseTracker::tracker().hasEntryForOrigin(origin))
+    if (!quota && !DatabaseManager::manager().hasEntryForOrigin(origin))
         quota = ewk_settings_web_database_default_quota_get();
 
-    DatabaseTracker::tracker().setQuota(origin, quota);
+    DatabaseManager::manager().setQuota(origin, quota);
 }
 #endif
 
index 1b6884e..9298c5d 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "ApplicationCache.h"
 #include "ApplicationCacheStorage.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "SecurityOrigin.h"
 #include "ewk_security_origin_private.h"
 #include "ewk_web_database.h"
@@ -67,7 +67,7 @@ uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin* o
     EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
 
 #if ENABLE(SQL_DATABASE)
-    return WebCore::DatabaseTracker::tracker().usageForOrigin(origin->securityOrigin.get());
+    return WebCore::DatabaseManager::manager().usageForOrigin(origin->securityOrigin.get());
 #else
     return 0;
 #endif
@@ -78,7 +78,7 @@ uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin* o
     EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
 
 #if ENABLE(SQL_DATABASE)
-    return WebCore::DatabaseTracker::tracker().quotaForOrigin(origin->securityOrigin.get());
+    return WebCore::DatabaseManager::manager().quotaForOrigin(origin->securityOrigin.get());
 #else
     return 0;
 #endif
@@ -89,7 +89,7 @@ void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin* origi
     EINA_SAFETY_ON_NULL_RETURN(origin);
 
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().setQuota(origin->securityOrigin.get(), quota);
+    WebCore::DatabaseManager::manager().setQuota(origin->securityOrigin.get(), quota);
 #endif
 }
 
@@ -113,7 +113,7 @@ Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* o
 #if ENABLE(SQL_DATABASE)
     Vector<WTF::String> names;
 
-    if (!WebCore::DatabaseTracker::tracker().databaseNamesForOrigin(origin->securityOrigin.get(), names))
+    if (!WebCore::DatabaseManager::manager().databaseNamesForOrigin(origin->securityOrigin.get(), names))
         return 0;
 
     for (unsigned i = 0; i < names.size(); i++) {
index b65c884..e05df96 100644 (file)
@@ -25,7 +25,7 @@
 #include "ApplicationCacheStorage.h"
 #include "CairoUtilitiesEfl.h"
 #include "CrossOriginPreflightResultCache.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "FontCache.h"
 #include "FrameView.h"
 #include "IconDatabase.h"
@@ -136,7 +136,7 @@ void ewk_settings_local_storage_database_origin_clear(const char* url)
 void ewk_settings_web_database_path_set(const char* path)
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(WTF::String::fromUTF8(path));
+    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(WTF::String::fromUTF8(path));
     eina_stringshare_replace(&s_webDatabasePath, path);
 #endif
 }
index c15cad6..4cfc185 100644 (file)
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "ewk_web_database.h"
 
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "SecurityOrigin.h"
 #include "ewk_security_origin.h"
 #include "ewk_security_origin_private.h"
@@ -28,6 +28,7 @@
 #include <Eina.h>
 #include <wtf/RefPtr.h>
 #include <wtf/UnusedParam.h>
+#include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
 struct _Ewk_Web_Database {
@@ -45,7 +46,7 @@ const char* ewk_web_database_display_name_get(Ewk_Web_Database* database)
         return database->displayName;
 
     WebCore::SecurityOrigin* origin = database->securityOrigin.get();
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin);
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(database->name, origin);
     database->displayName = eina_stringshare_add(details.displayName().utf8().data());
 
     return database->displayName;
@@ -59,7 +60,7 @@ uint64_t ewk_web_database_expected_size_get(const Ewk_Web_Database* database)
 {
 #if ENABLE(SQL_DATABASE)
     WebCore::SecurityOrigin* origin = database->securityOrigin.get();
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin);
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(database->name, origin);
     return details.expectedUsage();
 #else
     UNUSED_PARAM(database);
@@ -74,7 +75,7 @@ const char* ewk_web_database_filename_get(Ewk_Web_Database* database)
         return database->filename;
 
     WebCore::SecurityOrigin* origin = database->securityOrigin.get();
-    WTF::String path = WebCore::DatabaseTracker::tracker().fullPathForDatabase(origin, database->coreName);
+    WTF::String path = WebCore::DatabaseManager::manager().fullPathForDatabase(origin, database->coreName);
     database->filename = eina_stringshare_add(path.utf8().data());
 
     return database->filename;
@@ -108,7 +109,7 @@ uint64_t ewk_web_database_size_get(const Ewk_Web_Database* database)
 {
 #if ENABLE(SQL_DATABASE)
     WebCore::SecurityOrigin* origin = database->securityOrigin.get();
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(database->name, origin);
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(database->name, origin);
     return details.currentUsage();
 #else
     UNUSED_PARAM(database);
@@ -119,7 +120,7 @@ uint64_t ewk_web_database_size_get(const Ewk_Web_Database* database)
 void ewk_web_database_remove(Ewk_Web_Database* database)
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().deleteDatabase(database->securityOrigin.get(), database->coreName);
+    WebCore::DatabaseManager::manager().deleteDatabase(database->securityOrigin.get(), database->coreName);
 #else
     UNUSED_PARAM(database);
 #endif
@@ -128,7 +129,7 @@ void ewk_web_database_remove(Ewk_Web_Database* database)
 void ewk_web_database_remove_all(void)
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().deleteAllDatabases();
+    WebCore::DatabaseManager::manager().deleteAllDatabases();
 #endif
 }
 
index 890dbbc..1b947cb 100644 (file)
@@ -1,3 +1,36 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::exceededDatabaseQuota):
+        * webkit/webkitfavicondatabase.cpp:
+        * webkit/webkiticondatabase.cpp:
+        * webkit/webkitsecurityorigin.cpp:
+        (webkit_security_origin_get_web_database_usage):
+        (webkit_security_origin_get_web_database_quota):
+        (webkit_security_origin_set_web_database_quota):
+        (webkit_security_origin_get_all_web_databases):
+        * webkit/webkitwebdatabase.cpp:
+        (webkit_web_database_get_display_name):
+        (webkit_web_database_get_expected_size):
+        (webkit_web_database_get_size):
+        (webkit_web_database_get_filename):
+        (webkit_web_database_remove):
+        (webkit_remove_all_web_databases):
+        (webkit_get_web_database_directory_path):
+        (webkit_set_web_database_directory_path):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_update_settings):
+        (webkit_web_view_settings_notify):
+
 2012-12-12  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] Add authentication support to DRT and fix exposed issues in the libsoup backend
index 58f1ed1..fc0f6fc 100644 (file)
@@ -74,7 +74,7 @@
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(SQL_DATABASE)
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #endif
 
 using namespace WebCore;
@@ -812,7 +812,7 @@ void ChromeClient::print(Frame* frame)
 void ChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
 {
     guint64 defaultQuota = webkit_get_default_web_database_quota();
-    DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), defaultQuota);
+    DatabaseManager::manager().setQuota(frame->document()->securityOrigin(), defaultQuota);
 
     WebKitWebFrame* webFrame = kit(frame);
     WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(webFrame);
index d77419a..b439a55 100644 (file)
@@ -21,8 +21,6 @@
 #include "config.h"
 #include "webkitfavicondatabase.h"
 
-#include "DatabaseDetails.h"
-#include "DatabaseTracker.h"
 #include "FileSystem.h"
 #include "GdkCairoUtilities.h"
 #include "IconDatabase.h"
index e3269f9..c986d4d 100644 (file)
@@ -20,8 +20,6 @@
 #include "config.h"
 #include "webkiticondatabase.h"
 
-#include "DatabaseDetails.h"
-#include "DatabaseTracker.h"
 #include "FileSystem.h"
 #include "IconDatabase.h"
 #include "Image.h"
index d6782f0..c867d4a 100644 (file)
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "webkitsecurityorigin.h"
 
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "webkitglobalsprivate.h"
 #include "webkitsecurityoriginprivate.h"
 #include <glib/gi18n-lib.h>
@@ -298,7 +298,7 @@ guint64 webkit_security_origin_get_web_database_usage(WebKitSecurityOrigin* secu
 
 #if ENABLE(SQL_DATABASE)
     WebCore::SecurityOrigin* coreOrigin = core(securityOrigin);
-    return WebCore::DatabaseTracker::tracker().usageForOrigin(coreOrigin);
+    return WebCore::DatabaseManager::manager().usageForOrigin(coreOrigin);
 #else
     return 0;
 #endif
@@ -321,7 +321,7 @@ guint64 webkit_security_origin_get_web_database_quota(WebKitSecurityOrigin* secu
 
 #if ENABLE(SQL_DATABASE)
     WebCore::SecurityOrigin* coreOrigin = core(securityOrigin);
-    return WebCore::DatabaseTracker::tracker().quotaForOrigin(coreOrigin);
+    return WebCore::DatabaseManager::manager().quotaForOrigin(coreOrigin);
 #else
     return 0;
 #endif
@@ -342,7 +342,7 @@ void webkit_security_origin_set_web_database_quota(WebKitSecurityOrigin* securit
 
 #if ENABLE(SQL_DATABASE)
     WebCore::SecurityOrigin* coreOrigin = core(securityOrigin);
-    WebCore::DatabaseTracker::tracker().setQuota(coreOrigin, quota);
+    WebCore::DatabaseManager::manager().setQuota(coreOrigin, quota);
 #endif
 }
 
@@ -366,7 +366,7 @@ GList* webkit_security_origin_get_all_web_databases(WebKitSecurityOrigin* securi
     WebCore::SecurityOrigin* coreOrigin = core(securityOrigin);
     Vector<WTF::String> databaseNames;
 
-    if (!WebCore::DatabaseTracker::tracker().databaseNamesForOrigin(coreOrigin, databaseNames))
+    if (!WebCore::DatabaseManager::manager().databaseNamesForOrigin(coreOrigin, databaseNames))
         return NULL;
 
     for (unsigned i = 0; i < databaseNames.size(); ++i) {
index 12ee5d4..49e190f 100644 (file)
@@ -21,7 +21,7 @@
 #include "webkitwebdatabase.h"
 
 #include "DatabaseDetails.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "webkitglobalsprivate.h"
 #include "webkitsecurityoriginprivate.h"
 #include <glib/gi18n-lib.h>
@@ -327,7 +327,7 @@ const gchar* webkit_web_database_get_display_name(WebKitWebDatabase* webDatabase
 
 #if ENABLE(SQL_DATABASE)
     WebKitWebDatabasePrivate* priv = webDatabase->priv;
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(priv->name, core(priv->origin));
     WTF::String displayName =  details.displayName();
 
     if (displayName.isEmpty())
@@ -359,7 +359,7 @@ guint64 webkit_web_database_get_expected_size(WebKitWebDatabase* webDatabase)
 
 #if ENABLE(SQL_DATABASE)
     WebKitWebDatabasePrivate* priv = webDatabase->priv;
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(priv->name, core(priv->origin));
     return details.expectedUsage();
 #else
     return 0;
@@ -382,7 +382,7 @@ guint64 webkit_web_database_get_size(WebKitWebDatabase* webDatabase)
 
 #if ENABLE(SQL_DATABASE)
     WebKitWebDatabasePrivate* priv = webDatabase->priv;
-    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
+    WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(priv->name, core(priv->origin));
     return details.currentUsage();
 #else
     return 0;
@@ -406,7 +406,7 @@ const gchar* webkit_web_database_get_filename(WebKitWebDatabase* webDatabase)
 #if ENABLE(SQL_DATABASE)
     WebKitWebDatabasePrivate* priv = webDatabase->priv;
     WTF::String coreName = WTF::String::fromUTF8(priv->name);
-    WTF::String corePath = WebCore::DatabaseTracker::tracker().fullPathForDatabase(core(priv->origin), coreName);
+    WTF::String corePath = WebCore::DatabaseManager::manager().fullPathForDatabase(core(priv->origin), coreName);
 
     if (corePath.isEmpty())
         return"";
@@ -435,7 +435,7 @@ void webkit_web_database_remove(WebKitWebDatabase* webDatabase)
 
 #if ENABLE(SQL_DATABASE)
     WebKitWebDatabasePrivate* priv = webDatabase->priv;
-    WebCore::DatabaseTracker::tracker().deleteDatabase(core(priv->origin), priv->name);
+    WebCore::DatabaseManager::manager().deleteDatabase(core(priv->origin), priv->name);
 #endif
 }
 
@@ -449,7 +449,7 @@ void webkit_web_database_remove(WebKitWebDatabase* webDatabase)
 void webkit_remove_all_web_databases()
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().deleteAllDatabases();
+    WebCore::DatabaseManager::manager().deleteAllDatabases();
 #endif
 }
 
@@ -467,7 +467,7 @@ void webkit_remove_all_web_databases()
 const gchar* webkit_get_web_database_directory_path()
 {
 #if ENABLE(SQL_DATABASE)
-    WTF::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
+    WTF::String path = WebCore::DatabaseManager::manager().databaseDirectoryPath();
 
     if (path.isEmpty())
         return "";
@@ -493,7 +493,7 @@ void webkit_set_web_database_directory_path(const gchar* path)
 {
 #if ENABLE(SQL_DATABASE)
     WTF::String corePath = WTF::String::fromUTF8(path);
-    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath);
+    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(corePath);
 
     g_free(webkit_database_directory_path);
     webkit_database_directory_path = g_strdup(corePath.utf8().data());
index f530489..29310d4 100644 (file)
@@ -32,7 +32,6 @@
 #include "webkitwebview.h"
 
 #include "AXObjectCache.h"
-#include "AbstractDatabase.h"
 #include "BackForwardListImpl.h"
 #include "CairoUtilities.h"
 #include "Chrome.h"
@@ -42,6 +41,7 @@
 #include "ContextMenuClientGtk.h"
 #include "ContextMenuController.h"
 #include "Cursor.h"
+#include "DatabaseManager.h"
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "DragActions.h"
@@ -3411,7 +3411,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
     coreSettings->setAllowRunningOfInsecureContent(settingsPrivate->enableRunningOfInsecureContent);
 
 #if ENABLE(SQL_DATABASE)
-    AbstractDatabase::setIsAvailable(settingsPrivate->enableHTML5Database);
+    DatabaseManager::manager().setIsAvailable(settingsPrivate->enableHTML5Database);
 #endif
 
 #if ENABLE(FULLSCREEN_API)
@@ -3515,7 +3515,7 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
         settings->setCaretBrowsingEnabled(g_value_get_boolean(&value));
 #if ENABLE(SQL_DATABASE)
     else if (name == g_intern_string("enable-html5-database")) {
-        AbstractDatabase::setIsAvailable(g_value_get_boolean(&value));
+        DatabaseManager::manager().setIsAvailable(g_value_get_boolean(&value));
     }
 #endif
     else if (name == g_intern_string("enable-html5-local-storage"))
index 30bb5ff..d437437 100644 (file)
@@ -1,3 +1,49 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * Storage/WebDatabaseManager.mm:
+        (-[WebDatabaseManager origins]):
+        (-[WebDatabaseManager databasesWithOrigin:]):
+        (-[WebDatabaseManager detailsForDatabase:withOrigin:]):
+        (-[WebDatabaseManager deleteAllDatabases]):
+        (-[WebDatabaseManager deleteOrigin:]):
+        (-[WebDatabaseManager deleteDatabase:withOrigin:]):
+        (WebKitInitializeDatabasesIfNecessary):
+        * Storage/WebDatabaseManagerClient.h: Copied from Source/WebKit/mac/Storage/WebDatabaseTrackerClient.h.
+        (WebDatabaseManagerClient):
+        * Storage/WebDatabaseManagerClient.mm: Copied from Source/WebKit/mac/Storage/WebDatabaseTrackerClient.mm.
+        (WebDatabaseManagerClient::sharedWebDatabaseManagerClient):
+        (WebDatabaseManagerClient::WebDatabaseManagerClient):
+        (WebDatabaseManagerClient::~WebDatabaseManagerClient):
+        (DidModifyOriginData::dispatchToMainThread):
+        (DidModifyOriginData::DidModifyOriginData):
+        (DidModifyOriginData):
+        (WebDatabaseManagerClient::dispatchDidModifyOrigin):
+        (WebDatabaseManagerClient::dispatchDidModifyDatabase):
+        * Storage/WebDatabaseQuotaManager.mm:
+        (-[WebDatabaseQuotaManager usage]):
+        (-[WebDatabaseQuotaManager quota]):
+        (-[WebDatabaseQuotaManager setQuota:]):
+        * Storage/WebDatabaseTrackerClient.h: Removed.
+        * Storage/WebDatabaseTrackerClient.mm: Removed.
+        * WebCoreSupport/WebSecurityOrigin.mm:
+        (-[WebSecurityOrigin usage]):
+        (-[WebSecurityOrigin quota]):
+        (-[WebSecurityOrigin setQuota:]):
+        * WebKit.order:
+        * WebView/WebFrame.mm:
+        (-[WebFrame _cacheabilityDictionary]):
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         Make LOG() work in WebProcess and NetworkProcess
index 44c4313..79f3b80 100644 (file)
 
 #if ENABLE(SQL_DATABASE)
 
-#import "WebDatabaseTrackerClient.h"
+#import "WebDatabaseManagerClient.h"
 #import "WebSecurityOriginInternal.h"
 
-#import <WebCore/DatabaseTracker.h>
+#import <WebCore/DatabaseManager.h>
 #import <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
@@ -62,7 +62,7 @@ static NSString *databasesDirectoryPath();
 - (NSArray *)origins
 {
     Vector<RefPtr<SecurityOrigin> > coreOrigins;
-    DatabaseTracker::tracker().origins(coreOrigins);
+    DatabaseManager::manager().origins(coreOrigins);
     NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()];
 
     for (unsigned i = 0; i < coreOrigins.size(); ++i) {
@@ -77,7 +77,7 @@ static NSString *databasesDirectoryPath();
 - (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin
 {
     Vector<String> nameVector;
-    if (!DatabaseTracker::tracker().databaseNamesForOrigin([origin _core], nameVector))
+    if (!DatabaseManager::manager().databaseNamesForOrigin([origin _core], nameVector))
         return nil;
     
     NSMutableArray *names = [[NSMutableArray alloc] initWithCapacity:nameVector.size()];
@@ -92,7 +92,7 @@ static NSString *databasesDirectoryPath();
 {
     static id keys[3] = {WebDatabaseDisplayNameKey, WebDatabaseExpectedSizeKey, WebDatabaseUsageKey};
     
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseIdentifier, [origin _core]);
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(databaseIdentifier, [origin _core]);
     if (details.name().isNull())
         return nil;
         
@@ -106,17 +106,17 @@ static NSString *databasesDirectoryPath();
 
 - (void)deleteAllDatabases
 {
-    DatabaseTracker::tracker().deleteAllDatabases();
+    DatabaseManager::manager().deleteAllDatabases();
 }
 
 - (BOOL)deleteOrigin:(WebSecurityOrigin *)origin
 {
-    return DatabaseTracker::tracker().deleteOrigin([origin _core]);
+    return DatabaseManager::manager().deleteOrigin([origin _core]);
 }
 
 - (BOOL)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin
 {
-    return DatabaseTracker::tracker().deleteDatabase([origin _core], databaseIdentifier);
+    return DatabaseManager::manager().deleteDatabase([origin _core], databaseIdentifier);
 }
 
 @end
@@ -137,11 +137,13 @@ void WebKitInitializeDatabasesIfNecessary()
     if (initialized)
         return;
 
+    DatabaseManager& dbManager = DatabaseManager::manager();
+
     // Set the database root path in WebCore
-    DatabaseTracker::initializeTracker(databasesDirectoryPath());
+    dbManager.initialize(databasesDirectoryPath());
 
-    // Set the DatabaseTrackerClient
-    DatabaseTracker::tracker().setClient(WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient());
+    // Set the DatabaseManagerClient
+    dbManager.setClient(WebDatabaseManagerClient::sharedWebDatabaseManagerClient());
     
     initialized = YES;
 }
diff --git a/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h b/Source/WebKit/mac/Storage/WebDatabaseManagerClient.h
new file mode 100644 (file)
index 0000000..28f8428
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007,2012 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#if ENABLE(SQL_DATABASE) 
+
+#import <WebCore/DatabaseManagerClient.h>
+
+class WebDatabaseManagerClient : public WebCore::DatabaseManagerClient {
+public:
+    static WebDatabaseManagerClient* sharedWebDatabaseManagerClient();
+    
+    virtual ~WebDatabaseManagerClient();
+    virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
+    virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseIdentifier);
+private:
+    WebDatabaseManagerClient();
+};
+
+#endif
@@ -1,32 +1,29 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007,2012 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
  
-#import "WebDatabaseTrackerClient.h"
+#import "WebDatabaseManagerClient.h"
 
 #if ENABLE(SQL_DATABASE)
 
 
 using namespace WebCore;
 
-WebDatabaseTrackerClient* WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient()
+WebDatabaseManagerClient* WebDatabaseManagerClient::sharedWebDatabaseManagerClient()
 {
-    static WebDatabaseTrackerClient* sharedClient = new WebDatabaseTrackerClient();
+    static WebDatabaseManagerClient* sharedClient = new WebDatabaseManagerClient();
     return sharedClient;
 }
 
-WebDatabaseTrackerClient::WebDatabaseTrackerClient()
+WebDatabaseManagerClient::WebDatabaseManagerClient()
 {
 }
 
-WebDatabaseTrackerClient::~WebDatabaseTrackerClient()
+WebDatabaseManagerClient::~WebDatabaseManagerClient()
 {
 }
 
 class DidModifyOriginData {
     WTF_MAKE_NONCOPYABLE(DidModifyOriginData);
 public:
-    static void dispatchToMainThread(WebDatabaseTrackerClient* client, SecurityOrigin* origin)
+    static void dispatchToMainThread(WebDatabaseManagerClient* client, SecurityOrigin* origin)
     {
         DidModifyOriginData* context = new DidModifyOriginData(client, origin->isolatedCopy());
         callOnMainThread(&DidModifyOriginData::dispatchDidModifyOriginOnMainThread, context);
     }
 
 private:
-    DidModifyOriginData(WebDatabaseTrackerClient* client, PassRefPtr<SecurityOrigin> origin)
+    DidModifyOriginData(WebDatabaseManagerClient* client, PassRefPtr<SecurityOrigin> origin)
         : client(client)
         , origin(origin)
     {
@@ -76,11 +73,11 @@ private:
         delete info;
     }
 
-    WebDatabaseTrackerClient* client;
+    WebDatabaseManagerClient* client;
     RefPtr<SecurityOrigin> origin;
 };
 
-void WebDatabaseTrackerClient::dispatchDidModifyOrigin(SecurityOrigin* origin)
+void WebDatabaseManagerClient::dispatchDidModifyOrigin(SecurityOrigin* origin)
 {
     if (!isMainThread()) {
         DidModifyOriginData::dispatchToMainThread(this, origin);
@@ -93,7 +90,7 @@ void WebDatabaseTrackerClient::dispatchDidModifyOrigin(SecurityOrigin* origin)
                                                         object:webSecurityOrigin.get()];
 }
 
-void WebDatabaseTrackerClient::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseIdentifier)
+void WebDatabaseManagerClient::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseIdentifier)
 {
     if (!isMainThread()) {
         DidModifyOriginData::dispatchToMainThread(this, origin);
index 476d583..138830c 100644 (file)
@@ -26,7 +26,7 @@
 #import "WebDatabaseQuotaManager.h"
 
 #import "WebSecurityOriginInternal.h"
-#import <WebCore/DatabaseTracker.h>
+#import <WebCore/DatabaseManager.h>
 
 using namespace WebCore;
 
@@ -50,7 +50,7 @@ using namespace WebCore;
 - (unsigned long long)usage
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().usageForOrigin([_origin _core]);
+    return DatabaseManager::manager().usageForOrigin([_origin _core]);
 #else
     return 0;
 #endif
@@ -59,7 +59,7 @@ using namespace WebCore;
 - (unsigned long long)quota
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().quotaForOrigin([_origin _core]);
+    return DatabaseManager::manager().quotaForOrigin([_origin _core]);
 #else
     return 0;
 #endif
@@ -71,7 +71,7 @@ using namespace WebCore;
 - (void)setQuota:(unsigned long long)quota
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().setQuota([_origin _core], quota);
+    DatabaseManager::manager().setQuota([_origin _core], quota);
 #endif
 }
 
diff --git a/Source/WebKit/mac/Storage/WebDatabaseTrackerClient.h b/Source/WebKit/mac/Storage/WebDatabaseTrackerClient.h
deleted file mode 100644 (file)
index ae7efa2..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(SQL_DATABASE) 
-
-#import <WebCore/DatabaseTrackerClient.h>
-
-class WebDatabaseTrackerClient : public WebCore::DatabaseTrackerClient {
-public:
-    static WebDatabaseTrackerClient* sharedWebDatabaseTrackerClient();
-    
-    virtual ~WebDatabaseTrackerClient();
-    virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
-    virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseIdentifier);
-private:
-    WebDatabaseTrackerClient();
-};
-
-#endif
index 8f38fed..b83be16 100644 (file)
@@ -32,7 +32,7 @@
 #import "WebDatabaseQuotaManager.h"
 #import "WebQuotaManager.h"
 #import <WebCore/KURL.h>
-#import <WebCore/DatabaseTracker.h>
+#import <WebCore/DatabaseManager.h>
 #import <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
@@ -161,14 +161,14 @@ using namespace WebCore;
 
 // FIXME: The following methods are deprecated and should removed later.
 // Clients should instead get a WebQuotaManager, and query / set the quota via the Manager.
-// NOTE: the <WebCore/DatabaseTracker.h> #include should be removed as well.
+// NOTE: the <WebCore/DatabaseManager.h> #include should be removed as well.
 
 @implementation WebSecurityOrigin (Deprecated)
 
 - (unsigned long long)usage
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+    return DatabaseManager::manager().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
 #else
     return 0;
 #endif
@@ -177,7 +177,7 @@ using namespace WebCore;
 - (unsigned long long)quota
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+    return DatabaseManager::manager().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
 #else
     return 0;
 #endif
@@ -186,7 +186,7 @@ using namespace WebCore;
 - (void)setQuota:(unsigned long long)quota
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
+    DatabaseManager::manager().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
 #endif
 }
 
index 6263b7e..016c17a 100644 (file)
@@ -221,9 +221,9 @@ _initializeLogChannel
 +[WebHistoryItem initialize]
 +[WebHistoryItem(WebInternal) initWindowWatcherIfNecessary]
 __Z36WebKitInitializeDatabasesIfNecessaryv
-__ZN24WebDatabaseTrackerClient30sharedWebDatabaseTrackerClientEv
+__ZN24WebDatabaseManagerClient30sharedWebDatabaseManagerClientEv
 __Z34WebKitInitializeStorageIfNecessaryv
-__ZN23WebStorageTrackerClient29sharedWebStorageTrackerClientEv
+__ZN23WebStorageManagerClient29sharedWebStorageManagerClientEv
 __ZN21WebPlatformStrategies10initializeEv
 __ZN15WebChromeClientC1EP7WebView
 __ZN20WebContextMenuClientC1EP7WebView
@@ -1935,8 +1935,8 @@ __ZN15WebChromeClient21exceededDatabaseQuotaEPN7WebCore5FrameERKN3WTF6StringE
 -[WebDatabaseQuotaManager initWithOrigin:]
 -[WebDatabaseQuotaManager setQuota:]
 -[WebSecurityOrigin(WebInternal) _core]
-__ZN24WebDatabaseTrackerClient23dispatchDidModifyOriginEPN7WebCore14SecurityOriginE
-__ZN24WebDatabaseTrackerClient25dispatchDidModifyDatabaseEPN7WebCore14SecurityOriginERKN3WTF6StringE
+__ZN24WebDatabaseManagerClient23dispatchDidModifyOriginEPN7WebCore14SecurityOriginE
+__ZN24WebDatabaseManagerClient25dispatchDidModifyDatabaseEPN7WebCore14SecurityOriginERKN3WTF6StringE
 __ZN7WebCore17FrameLoaderClient17didNotAllowScriptEv
 -[WebBackForwardList forwardListCount]
 -[WebBackForwardList backListCount]
@@ -1980,7 +1980,7 @@ __ZN3WTF9HashTableIxSt4pairIxNS_9RetainPtrI14NSMutableArrayEEENS_18PairFirstExtr
 __ZN3WTF9HashTableIxSt4pairIxNS_9RetainPtrI14NSMutableArrayEEENS_18PairFirstExtractorIS5_EENS_7IntHashIyEENS_14PairHashTraitsINS_10HashTraitsIxEENSB_IS4_EEEESC_E6rehashEi
 -[WebFrameView(WebPrivate) _area]
 +[WebWorkersPrivate workerThreadCount]
-__ZN19DidModifyOriginData20dispatchToMainThreadEP24WebDatabaseTrackerClientPN7WebCore14SecurityOriginE
+__ZN19DidModifyOriginData20dispatchToMainThreadEP24WebDatabaseManagerClientPN7WebCore14SecurityOriginE
 __ZN19DidModifyOriginData35dispatchDidModifyOriginOnMainThreadEPv
 __ZN15WebChromeClient25enterFullScreenForElementEPN7WebCore7ElementE
 -[WebKitFullScreenListener .cxx_construct]
index 89b9b81..ea51018 100644 (file)
@@ -60,7 +60,7 @@
 #import <WebCore/Chrome.h>
 #import <WebCore/ColorMac.h>
 #import <WebCore/DOMImplementation.h>
-#import <WebCore/DatabaseContext.h>
+#import <WebCore/DatabaseManager.h>
 #import <WebCore/DocumentFragment.h>
 #import <WebCore/DocumentLoader.h>
 #import <WebCore/DocumentMarkerController.h>
@@ -1069,7 +1069,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     
     if (Document* document = _private->coreFrame->document()) {
 #if ENABLE(SQL_DATABASE)
-        if (DatabaseContext::hasOpenDatabases(document))
+        if (DatabaseManager::manager().hasOpenDatabases(document))
             [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases];
 #endif
         if (!document->canSuspendActiveDOMObjects())
index cc56705..c89c96c 100644 (file)
 #import <Foundation/NSURLConnection.h>
 #import <JavaScriptCore/APICast.h>
 #import <JavaScriptCore/JSValueRef.h>
-#import <WebCore/AbstractDatabase.h>
 #import <WebCore/AlternativeTextUIController.h>
 #import <WebCore/ApplicationCacheStorage.h>
 #import <WebCore/BackForwardListImpl.h>
 #import <WebCore/ColorMac.h>
 #import <WebCore/CSSComputedStyleDeclaration.h>
 #import <WebCore/Cursor.h>
+#import <WebCore/DatabaseManager.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
 #import <WebCore/DragController.h>
@@ -1468,7 +1468,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings->setPictographFontFamily([preferences pictographFontFamily]);
     settings->setPluginsEnabled([preferences arePlugInsEnabled]);
 #if ENABLE(SQL_DATABASE)
-    AbstractDatabase::setIsAvailable([preferences databasesEnabled]);
+    DatabaseManager::manager().setIsAvailable([preferences databasesEnabled]);
 #endif
     settings->setLocalStorageEnabled([preferences localStorageEnabled]);
     settings->setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]);
index b267720..12e9e5d 100644 (file)
@@ -24,7 +24,7 @@
 #include "qwebsecurityorigin.h"
 #include "qwebsecurityorigin_p.h"
 #include "DatabaseDetails.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 
 using namespace WebCore;
 
@@ -87,7 +87,7 @@ QString QWebDatabase::name() const
 QString QWebDatabase::displayName() const
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(d->name, d->origin.get());
     return details.displayName();
 #else
     return QString();
@@ -100,7 +100,7 @@ QString QWebDatabase::displayName() const
 qint64 QWebDatabase::expectedSize() const
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(d->name, d->origin.get());
     return details.expectedUsage();
 #else
     return 0;
@@ -113,7 +113,7 @@ qint64 QWebDatabase::expectedSize() const
 qint64 QWebDatabase::size() const
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(d->name, d->origin.get());
     return details.currentUsage();
 #else
     return 0;
@@ -148,7 +148,7 @@ QWebDatabase::QWebDatabase(QWebDatabasePrivate* priv)
 QString QWebDatabase::fileName() const
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().fullPathForDatabase(d->origin.get(), d->name, false);
+    return DatabaseManager::manager().fullPathForDatabase(d->origin.get(), d->name, false);
 #else
     return QString();
 #endif
@@ -171,7 +171,7 @@ QWebSecurityOrigin QWebDatabase::origin() const
 void QWebDatabase::removeDatabase(const QWebDatabase& db)
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().deleteDatabase(db.d->origin.get(), db.d->name);
+    DatabaseManager::manager().deleteDatabase(db.d->origin.get(), db.d->name);
 #endif
 }
 
@@ -185,7 +185,7 @@ void QWebDatabase::removeDatabase(const QWebDatabase& db)
 void QWebDatabase::removeAllDatabases()
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().deleteAllDatabases();
+    DatabaseManager::manager().deleteAllDatabases();
 #endif
 }
 
index afac42b..c2c85c5 100644 (file)
@@ -21,7 +21,7 @@
 #include "qwebsecurityorigin.h"
 
 #include "ApplicationCacheStorage.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "KURL.h"
 #include "SchemeRegistry.h"
 #include "SecurityOrigin.h"
@@ -121,7 +121,7 @@ int QWebSecurityOrigin::port() const
 qint64 QWebSecurityOrigin::databaseUsage() const
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().usageForOrigin(d->origin.get());
+    return DatabaseManager::manager().usageForOrigin(d->origin.get());
 #else
     return 0;
 #endif
@@ -133,7 +133,7 @@ qint64 QWebSecurityOrigin::databaseUsage() const
 qint64 QWebSecurityOrigin::databaseQuota() const
 {
 #if ENABLE(SQL_DATABASE)
-    return DatabaseTracker::tracker().quotaForOrigin(d->origin.get());
+    return DatabaseManager::manager().quotaForOrigin(d->origin.get());
 #else
     return 0;
 #endif
@@ -149,7 +149,7 @@ qint64 QWebSecurityOrigin::databaseQuota() const
 void QWebSecurityOrigin::setDatabaseQuota(qint64 quota)
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().setQuota(d->origin.get(), quota);
+    DatabaseManager::manager().setQuota(d->origin.get(), quota);
 #endif
 }
 
@@ -181,7 +181,7 @@ QList<QWebSecurityOrigin> QWebSecurityOrigin::allOrigins()
 
 #if ENABLE(SQL_DATABASE)
     Vector<RefPtr<SecurityOrigin> > coreOrigins;
-    DatabaseTracker::tracker().origins(coreOrigins);
+    DatabaseManager::manager().origins(coreOrigins);
 
     for (unsigned i = 0; i < coreOrigins.size(); ++i) {
         QWebSecurityOriginPrivate* priv = new QWebSecurityOriginPrivate(coreOrigins[i].get());
@@ -202,7 +202,7 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const
 #if ENABLE(SQL_DATABASE)
     Vector<String> nameVector;
 
-    if (!DatabaseTracker::tracker().databaseNamesForOrigin(d->origin.get(), nameVector))
+    if (!DatabaseManager::manager().databaseNamesForOrigin(d->origin.get(), nameVector))
         return databases;
     for (unsigned i = 0; i < nameVector.size(); ++i) {
         QWebDatabasePrivate* priv = new QWebDatabasePrivate();
index 65520e1..9db01b1 100644 (file)
 
 #include "qwebplugindatabase_p.h"
 
-#include "AbstractDatabase.h"
 #include "ApplicationCacheStorage.h"
 #include "CrossOriginPreflightResultCache.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "FileSystem.h"
 #include "FontCache.h"
 #include "IconDatabase.h"
@@ -231,7 +230,7 @@ void QWebSettingsPrivate::apply()
 #if ENABLE(SQL_DATABASE)
         value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
                                       global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
-        WebCore::AbstractDatabase::setIsAvailable(value);
+        WebCore::DatabaseManager::manager().setIsAvailable(value);
 #endif
 
         value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled,
@@ -1004,7 +1003,7 @@ void QWebSettings::setOfflineStoragePath(const QString& path)
 {
     WebCore::initializeWebCoreQt();
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
+    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(path);
 #endif
 }
 
@@ -1020,7 +1019,7 @@ QString QWebSettings::offlineStoragePath()
 {
     WebCore::initializeWebCoreQt();
 #if ENABLE(SQL_DATABASE)
-    return WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
+    return WebCore::DatabaseManager::manager().databaseDirectoryPath();
 #else
     return QString();
 #endif
index 875ff17..6b555bc 100644 (file)
@@ -1,3 +1,33 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * Api/qwebdatabase.cpp:
+        (QWebDatabase::displayName):
+        (QWebDatabase::expectedSize):
+        (QWebDatabase::size):
+        (QWebDatabase::fileName):
+        (QWebDatabase::removeDatabase):
+        (QWebDatabase::removeAllDatabases):
+        * Api/qwebsecurityorigin.cpp:
+        (QWebSecurityOrigin::databaseUsage):
+        (QWebSecurityOrigin::databaseQuota):
+        (QWebSecurityOrigin::setDatabaseQuota):
+        (QWebSecurityOrigin::allOrigins):
+        (QWebSecurityOrigin::databases):
+        * Api/qwebsettings.cpp:
+        (QWebSettingsPrivate::apply):
+        (QWebSettings::setOfflineStoragePath):
+        (QWebSettings::offlineStoragePath):
+        * WebCoreSupport/ChromeClientQt.cpp:
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         Make LOG() work in WebProcess and NetworkProcess
index d154d42..9bf11ce 100644 (file)
@@ -33,7 +33,7 @@
 #include "ApplicationCacheStorage.h"
 #include "ColorChooser.h"
 #include "ColorChooserClient.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #include "Document.h"
 #include "FileChooser.h"
 #include "FileIconLoader.h"
@@ -539,8 +539,8 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN
 {
     quint64 quota = QWebSettings::offlineStorageDefaultQuota();
 
-    if (!DatabaseTracker::tracker().hasEntryForOrigin(frame->document()->securityOrigin()))
-        DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota);
+    if (!DatabaseManager::manager().hasEntryForOrigin(frame->document()->securityOrigin()))
+        DatabaseManager::manager().setQuota(frame->document()->securityOrigin(), quota);
 
     m_webPage->databaseQuotaExceeded(QWebFrameAdapter::kit(frame), databaseName);
 }
index 40b7e75..0b4e390 100644 (file)
@@ -1,3 +1,33 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebDatabaseManager.cpp:
+        (WebDatabaseManager::sharedWebDatabaseManager):
+        (WebDatabaseManager::origins):
+        (WebDatabaseManager::databasesWithOrigin):
+        (WebDatabaseManager::detailsForDatabase):
+        (WebDatabaseManager::deleteAllDatabases):
+        (WebDatabaseManager::deleteOrigin):
+        (WebDatabaseManager::deleteDatabase):
+        (WebDatabaseManager::setQuota):
+        (WebKitInitializeWebDatabasesIfNecessary):
+        * WebDatabaseManager.h:
+        (WebDatabaseManager):
+        * WebSecurityOrigin.cpp:
+        (WebSecurityOrigin::usage):
+        (WebSecurityOrigin::quota):
+        (WebSecurityOrigin::setQuota):
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         Make LOG() work in WebProcess and NetworkProcess
index 15872e3..cfd124c 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <WebCore/BString.h>
 #include <WebCore/COMPtr.h>
-#include <WebCore/DatabaseTracker.h>
+#include <WebCore/DatabaseManager.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/SecurityOrigin.h>
 #include <wtf/MainThread.h>
@@ -202,7 +202,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::sharedWebDatabaseManager(
 {
     if (!s_sharedWebDatabaseManager) {
         s_sharedWebDatabaseManager.adoptRef(WebDatabaseManager::createInstance());
-        DatabaseTracker::tracker().setClient(s_sharedWebDatabaseManager.get());
+        DatabaseManager::manager().setClient(s_sharedWebDatabaseManager.get());
     }
 
     return s_sharedWebDatabaseManager.copyRefTo(result);
@@ -220,7 +220,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::origins(
         return E_FAIL;
 
     Vector<RefPtr<SecurityOrigin> > origins;
-    DatabaseTracker::tracker().origins(origins);
+    DatabaseManager::manager().origins(origins);
         COMPtr<COMEnumVariant<Vector<RefPtr<SecurityOrigin> > > > enumVariant(AdoptCOM, COMEnumVariant<Vector<RefPtr<SecurityOrigin> > >::adopt(origins));
 
     *result = enumVariant.leakRef();
@@ -244,7 +244,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::databasesWithOrigin(
         return E_FAIL;
 
     Vector<String> databaseNames;
-    DatabaseTracker::tracker().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
+    DatabaseManager::manager().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
 
     COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::adopt(databaseNames));
 
@@ -269,7 +269,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabase(
     if (!webSecurityOrigin)
         return E_FAIL;
 
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
+    DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
         webSecurityOrigin->securityOrigin());
 
     if (details.name().isNull())
@@ -284,7 +284,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteAllDatabases()
     if (this != s_sharedWebDatabaseManager)
         return E_FAIL;
 
-    DatabaseTracker::tracker().deleteAllDatabases();
+    DatabaseManager::manager().deleteAllDatabases();
 
     return S_OK;
 }
@@ -302,7 +302,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteOrigin(
     if (!webSecurityOrigin)
         return E_FAIL;
 
-    DatabaseTracker::tracker().deleteOrigin(webSecurityOrigin->securityOrigin());
+    DatabaseManager::manager().deleteOrigin(webSecurityOrigin->securityOrigin());
 
     return S_OK;
 }
@@ -324,7 +324,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabase(
     if (!webSecurityOrigin)
         return E_FAIL;
 
-    DatabaseTracker::tracker().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
+    DatabaseManager::manager().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
 
     return S_OK;
 }
@@ -381,7 +381,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::setQuota(
     if (this != s_sharedWebDatabaseManager)
         return E_FAIL;
 
-    DatabaseTracker::tracker().setQuota(SecurityOrigin::createFromString(origin).get(), quota);
+    DatabaseManager::manager().setQuota(SecurityOrigin::createFromString(origin).get(), quota);
 
     return S_OK;
 }
@@ -416,7 +416,7 @@ void WebKitInitializeWebDatabasesIfNecessary()
         return;
 
     WTF::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
-    WebCore::DatabaseTracker::initializeTracker(databasesDirectory);
+    WebCore::DatabaseManager::manager().initialize(databasesDirectory);
 
     initialized = true;
 }
index 3c5dd1e..6cb69b8 100644 (file)
@@ -32,9 +32,9 @@
 #if ENABLE(SQL_DATABASE)
 
 #include "WebKit.h"
-#include <WebCore/DatabaseTrackerClient.h>
+#include <WebCore/DatabaseManagerClient.h>
 
-class WebDatabaseManager : public IWebDatabaseManager, private WebCore::DatabaseTrackerClient {
+class WebDatabaseManager : public IWebDatabaseManager, private WebCore::DatabaseManagerClient {
 public:
     static WebDatabaseManager* createInstance();
 
@@ -76,7 +76,7 @@ public:
         /* [in] */ BSTR origin,
         /* [in] */ unsigned long long quota);
 
-    // DatabaseTrackerClient
+    // DatabaseManagerClient
     virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
     virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseName);
 
index 61fcadf..d75b835 100644 (file)
@@ -31,7 +31,7 @@
 #include "WebKitDLL.h"
 
 #include <WebCore/BString.h>
-#include <WebCore/DatabaseTracker.h>
+#include <WebCore/DatabaseManager.h>
 
 #if !ENABLE(SQL_DATABASE)
 #include <wtf/UnusedParam.h>
@@ -134,7 +134,7 @@ HRESULT STDMETHODCALLTYPE WebSecurityOrigin::usage(
     if (!result)
         return E_POINTER;
 
-    *result = DatabaseTracker::tracker().usageForOrigin(m_securityOrigin.get());
+    *result = DatabaseManager::manager().usageForOrigin(m_securityOrigin.get());
 
     return S_OK;
 #else
@@ -150,7 +150,7 @@ HRESULT STDMETHODCALLTYPE WebSecurityOrigin::quota(
     if (!result)
         return E_POINTER;
 
-    *result = DatabaseTracker::tracker().quotaForOrigin(m_securityOrigin.get());
+    *result = DatabaseManager::manager().quotaForOrigin(m_securityOrigin.get());
     return S_OK;
 #else
     UNUSED_PARAM(result);
@@ -162,7 +162,7 @@ HRESULT STDMETHODCALLTYPE WebSecurityOrigin::setQuota(
     /* [in] */ unsigned long long quota) 
 {
 #if ENABLE(SQL_DATABASE)
-    DatabaseTracker::tracker().setQuota(m_securityOrigin.get(), quota);
+    DatabaseManager::manager().setQuota(m_securityOrigin.get(), quota);
 
     return S_OK;
 #else
index 8767808..2a03e2a 100644 (file)
@@ -67,7 +67,6 @@
 #include <JavaScriptCore/JSLock.h>
 #include <JavaScriptCore/JSValue.h>
 #include <WebCore/AXObjectCache.h>
-#include <WebCore/AbstractDatabase.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/BString.h>
 #include <WebCore/BackForwardListImpl.h>
@@ -76,6 +75,7 @@
 #include <WebCore/ContextMenu.h>
 #include <WebCore/ContextMenuController.h>
 #include <WebCore/Cursor.h>
+#include <WebCore/DatabaseManager.h>
 #include <WebCore/Document.h>
 #include <WebCore/DocumentMarkerController.h>
 #include <WebCore/DragController.h>
@@ -4804,7 +4804,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     hr = prefsPrivate->databasesEnabled(&enabled);
     if (FAILED(hr))
         return hr;
-    AbstractDatabase::setIsAvailable(enabled);
+    DatabaseManager::manager().setIsAvailable(enabled);
 #endif
 
     hr = prefsPrivate->localStorageEnabled(&enabled);
index 4a5239c..c4a8f9e 100644 (file)
@@ -1,3 +1,22 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebKitSupport/ChromeClientWx.cpp:
+        (WebCore::ChromeClientWx::exceededDatabaseQuota):
+        * WebView.cpp:
+        (WebKit::WebView::SetDatabaseDirectory):
+        (WebKit::WebView::GetDatabaseDirectory):
+        (WebKit::WebView::SetDatabasesEnabled):
+        (WebKit::WebView::AreDatabasesEnabled):
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         Make LOG() work in WebProcess and NetworkProcess
index 691da85..7e55a72 100644 (file)
@@ -30,7 +30,7 @@
 #include "ChromeClientWx.h"
 #include "Console.h"
 #if ENABLE(SQL_DATABASE)
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #endif
 #include "FileChooser.h"
 #include "FileIconLoader.h"
@@ -427,8 +427,8 @@ void ChromeClientWx::exceededDatabaseQuota(Frame*, const String&)
     if (WebFrame* webFrame = m_webView->GetMainFrame())
         if (Frame* frame = webFrame->GetFrame())
             if (Document* document = frame->document())
-                if (!DatabaseTracker::tracker().hasEntryForOrigin(document->securityOrigin()))
-                    DatabaseTracker::tracker().setQuota(document->securityOrigin(), quota);
+                if (!DatabaseManager::manager().hasEntryForOrigin(document->securityOrigin()))
+                    DatabaseManager::manager().setQuota(document->securityOrigin(), quota);
 }
 #endif
 
index 68fa9f9..94c569c 100644 (file)
@@ -76,8 +76,7 @@
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(SQL_DATABASE)
-#include "AbstractDatabase.h"
-#include "DatabaseTracker.h"
+#include "DatabaseManager.h"
 #endif
 
 #include "wx/wxprec.h"
@@ -1126,7 +1125,7 @@ bool WebView::ShouldClose() const
 void WebView::SetDatabaseDirectory(const wxString& databaseDirectory)
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory);
+    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(databaseDirectory);
 #endif
 }
 
@@ -1134,7 +1133,7 @@ void WebView::SetDatabaseDirectory(const wxString& databaseDirectory)
 wxString WebView::GetDatabaseDirectory()
 {
 #if ENABLE(SQL_DATABASE)
-    return WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
+    return WebCore::DatabaseManager::manager().databaseDirectoryPath();
 #else
     return wxEmptyString;
 #endif
@@ -1144,7 +1143,8 @@ wxString WebView::GetDatabaseDirectory()
 void WebView::SetDatabasesEnabled(bool enabled)
 {
 #if ENABLE(SQL_DATABASE)
-    WebCore::AbstractDatabase::setIsAvailable(enabled);
+    WebCore::DatabaseManager& dbManager = WebCore::DatabaseManager::manager();
+    manager.setIsAvailable(enabled);
 #endif
 }
 
@@ -1152,7 +1152,8 @@ void WebView::SetDatabasesEnabled(bool enabled)
 bool WebView::AreDatabasesEnabled()
 {
 #if ENABLE(SQL_DATABASE)
-    return WebCore::AbstractDatabase::isAvailable();
+    WebCore::DatabaseManager& dbManager = WebCore::DatabaseManager::manager();
+    return dbManager.isAvailable();
 #endif
     return false;
 }
index a18daef..04bf86b 100644 (file)
@@ -1,3 +1,30 @@
+2012-12-12  Mark Lam  <mark.lam@apple.com>
+
+        Encapsulate externally used webdatabase APIs in DatabaseManager.
+        https://bugs.webkit.org/show_bug.cgi?id=104741.
+
+        Reviewed by Sam Weinig.
+
+        Use DatabaseManager instead of accessing DatabaseTracker, AbstractDatabase,
+        and DatabaseContext directly. This is to prepare for upcoming webkit2
+        refactoring.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::exceededDatabaseQuota):
+        * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
+        (WebKit::WebDatabaseManager::initialize):
+        (WebKit::WebDatabaseManager::WebDatabaseManager):
+        (WebKit::WebDatabaseManager::getDatabasesByOrigin):
+        (WebKit::WebDatabaseManager::getDatabaseOrigins):
+        (WebKit::WebDatabaseManager::deleteDatabaseWithNameForOrigin):
+        (WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
+        (WebKit::WebDatabaseManager::deleteAllDatabases):
+        (WebKit::WebDatabaseManager::setQuotaForOrigin):
+        * WebProcess/WebCoreSupport/WebDatabaseManager.h:
+        (WebDatabaseManager):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2012-12-12  Alexey Proskuryakov  <ap@apple.com>
 
         <rdar://problem/12862512> Crashes in NetworkResourceLoadScheduler::receivedRedirect
index 795aec7..b019b95 100644 (file)
@@ -49,7 +49,7 @@
 #include "WebSecurityOrigin.h"
 #include <WebCore/AXObjectCache.h>
 #include <WebCore/ColorChooser.h>
-#include <WebCore/DatabaseTracker.h>
+#include <WebCore/DatabaseManager.h>
 #include <WebCore/FileChooser.h>
 #include <WebCore/FileIconLoader.h>
 #include <WebCore/Frame.h>
@@ -549,9 +549,10 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
     SecurityOrigin* origin = frame->document()->securityOrigin();
 
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin);
-    uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin);
-    uint64_t currentOriginUsage = DatabaseTracker::tracker().usageForOrigin(origin);
+    DatabaseManager& dbManager = DatabaseManager::manager();
+    DatabaseDetails details = dbManager.detailsForNameAndOrigin(databaseName, origin);
+    uint64_t currentQuota = dbManager.quotaForOrigin(origin);
+    uint64_t currentOriginUsage = dbManager.usageForOrigin(origin);
     uint64_t newQuota = 0;
     RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier());
     newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage());
@@ -562,7 +563,7 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
             Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
     }
 
-    DatabaseTracker::tracker().setQuota(origin, newQuota);
+    dbManager.setQuota(origin, newQuota);
 }
 #endif
 
index 05b75a1..686a691 100644 (file)
@@ -35,7 +35,7 @@
 #include "WebDatabaseManagerProxyMessages.h"
 #include "WebProcess.h"
 #include <WebCore/DatabaseDetails.h>
-#include <WebCore/DatabaseTracker.h>
+#include <WebCore/DatabaseManager.h>
 #include <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
@@ -50,12 +50,12 @@ WebDatabaseManager& WebDatabaseManager::shared()
 
 void WebDatabaseManager::initialize(const String& databaseDirectory)
 {
-    DatabaseTracker::initializeTracker(databaseDirectory);
+    DatabaseManager::manager().initialize(databaseDirectory);
 }
 
 WebDatabaseManager::WebDatabaseManager()
 {
-    DatabaseTracker::tracker().setClient(this);
+    DatabaseManager::manager().setClient(this);
 }
 
 WebDatabaseManager::~WebDatabaseManager()
@@ -71,12 +71,12 @@ void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const
 {
     WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
 
-    // FIXME: This could be made more efficient by adding a function to DatabaseTracker
+    // FIXME: This could be made more efficient by adding a function to DatabaseManager
     // to get both the origins and the Vector of DatabaseDetails for each origin in one
     // shot.  That would avoid taking the numerous locks this requires.
 
     Vector<RefPtr<SecurityOrigin> > origins;
-    DatabaseTracker::tracker().origins(origins);
+    DatabaseManager::manager().origins(origins);
 
     Vector<OriginAndDatabases> originAndDatabasesVector;
     originAndDatabasesVector.reserveInitialCapacity(origins.size());
@@ -85,13 +85,13 @@ void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const
         OriginAndDatabases originAndDatabases;
 
         Vector<String> nameVector;
-        if (!DatabaseTracker::tracker().databaseNamesForOrigin(origins[i].get(), nameVector))
+        if (!DatabaseManager::manager().databaseNamesForOrigin(origins[i].get(), nameVector))
             continue;
 
         Vector<DatabaseDetails> detailsVector;
         detailsVector.reserveInitialCapacity(nameVector.size());
         for (size_t j = 0; j < nameVector.size(); j++) {
-            DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(nameVector[j], origins[i].get());
+            DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(nameVector[j], origins[i].get());
             if (details.name().isNull())
                 continue;
 
@@ -102,8 +102,8 @@ void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const
             continue;
 
         originAndDatabases.originIdentifier = origins[i]->databaseIdentifier();
-        originAndDatabases.originQuota = DatabaseTracker::tracker().quotaForOrigin(origins[i].get());
-        originAndDatabases.originUsage = DatabaseTracker::tracker().usageForOrigin(origins[i].get());
+        originAndDatabases.originQuota = DatabaseManager::manager().quotaForOrigin(origins[i].get());
+        originAndDatabases.originUsage = DatabaseManager::manager().usageForOrigin(origins[i].get());
         originAndDatabases.databases.swap(detailsVector); 
         originAndDatabasesVector.append(originAndDatabases);
     }
@@ -116,7 +116,7 @@ void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const
     WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
 
     Vector<RefPtr<SecurityOrigin> > origins;
-    DatabaseTracker::tracker().origins(origins);
+    DatabaseManager::manager().origins(origins);
 
     size_t numOrigins = origins.size();
 
@@ -134,7 +134,7 @@ void WebDatabaseManager::deleteDatabaseWithNameForOrigin(const String& databaseI
     if (!origin)
         return;
 
-    DatabaseTracker::tracker().deleteDatabase(origin.get(), databaseIdentifier);
+    DatabaseManager::manager().deleteDatabase(origin.get(), databaseIdentifier);
 }
 
 void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const
@@ -145,14 +145,14 @@ void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier
     if (!origin)
         return;
 
-    DatabaseTracker::tracker().deleteOrigin(origin.get());
+    DatabaseManager::manager().deleteOrigin(origin.get());
 }
 
 void WebDatabaseManager::deleteAllDatabases() const
 {
     WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
 
-    DatabaseTracker::tracker().deleteAllDatabases();
+    DatabaseManager::manager().deleteAllDatabases();
 }
 
 void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const
@@ -167,7 +167,7 @@ void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsig
     if (!origin)
         return;
 
-    DatabaseTracker::tracker().setQuota(origin.get(), quota);
+    DatabaseManager::manager().setQuota(origin.get(), quota);
 }
 
 void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
index adb4d4b..2c44878 100644 (file)
@@ -29,7 +29,7 @@
 #if ENABLE(SQL_DATABASE)
 
 #include "Arguments.h"
-#include <WebCore/DatabaseTrackerClient.h>
+#include <WebCore/DatabaseManagerClient.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
 
@@ -41,7 +41,7 @@ class MessageID;
 
 namespace WebKit {
 
-class WebDatabaseManager : public WebCore::DatabaseTrackerClient {
+class WebDatabaseManager : public WebCore::DatabaseManagerClient {
     WTF_MAKE_NONCOPYABLE(WebDatabaseManager);
 public:
     static WebDatabaseManager& shared();
@@ -65,7 +65,7 @@ private:
     void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const;
     void deleteDatabasesForOrigin(const String& originIdentifier) const;
 
-    // WebCore::DatabaseTrackerClient
+    // WebCore::DatabaseManagerClient
     virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*) OVERRIDE;
     virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier) OVERRIDE;
 };
index 806f903..7fcecab 100644 (file)
 #include "WebProcess.h"
 #include "WebProcessProxyMessages.h"
 #include <JavaScriptCore/APICast.h>
-#include <WebCore/AbstractDatabase.h>
 #include <WebCore/ArchiveResource.h>
 #include <WebCore/Chrome.h>
 #include <WebCore/ContextMenuController.h>
+#include <WebCore/DatabaseManager.h>
 #include <WebCore/DocumentFragment.h>
 #include <WebCore/DocumentLoader.h>
 #include <WebCore/DocumentMarkerController.h>
@@ -2303,7 +2303,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setInteractiveFormValidationEnabled(store.getBoolValueForKey(WebPreferencesKey::interactiveFormValidationEnabledKey()));
 
 #if ENABLE(SQL_DATABASE)
-    AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
+    DatabaseManager::manager().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
 #endif
 
 #if ENABLE(FULLSCREEN_API)