WebKit2: Add additional API for managing databases
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Dec 2010 21:04:45 +0000 (21:04 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Dec 2010 21:04:45 +0000 (21:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=51629

Reviewed by Anders Carlsson.

- Adds client for the database manager to get notifications
  of changes to databases.

* UIProcess/API/C/WKDatabaseManager.cpp:
(WKDatabaseManagerSetClient):
* UIProcess/API/C/WKDatabaseManager.h:
* UIProcess/WebDatabaseManagerProxy.cpp:
(WebKit::WebDatabaseManagerProxy::initializeClient):
(WebKit::WebDatabaseManagerProxy::didModifyOrigin):
(WebKit::WebDatabaseManagerProxy::didModifyDatabase):
* UIProcess/WebDatabaseManagerProxy.h:
* UIProcess/WebDatabaseManagerProxy.messages.in:
* UIProcess/WebDatabaseManagerProxyClient.cpp: Added.
(WebKit::WebDatabaseManagerProxyClient::didModifyOrigin):
(WebKit::WebDatabaseManagerProxyClient::didModifyDatabase):
* UIProcess/WebDatabaseManagerProxyClient.h: Added.
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
(WebKit::WebDatabaseManager::WebDatabaseManager):
(WebKit::WebDatabaseManager::~WebDatabaseManager):
(WebKit::WebDatabaseManager::dispatchDidModifyOrigin):
(WebKit::WebDatabaseManager::dispatchDidModifyDatabase):
* WebProcess/WebCoreSupport/WebDatabaseManager.h:
* win/WebKit2.vcproj:

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

13 files changed:
WebKit2/ChangeLog
WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
WebKit2/UIProcess/API/C/WKDatabaseManager.h
WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
WebKit2/UIProcess/WebDatabaseManagerProxy.h
WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in
WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp [new file with mode: 0644]
WebKit2/UIProcess/WebDatabaseManagerProxyClient.h [new file with mode: 0644]
WebKit2/WebKit2.pro
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
WebKit2/win/WebKit2.vcproj

index 9d2757c27e3e58c89c95c6716e6eb26237dc2db9..1168a6bfa2c587874accb01b12016d6eff1a2b82 100644 (file)
@@ -1,3 +1,36 @@
+2010-12-27  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        WebKit2: Add additional API for managing databases
+        https://bugs.webkit.org/show_bug.cgi?id=51629
+
+        - Adds client for the database manager to get notifications
+          of changes to databases.
+
+        * UIProcess/API/C/WKDatabaseManager.cpp:
+        (WKDatabaseManagerSetClient):
+        * UIProcess/API/C/WKDatabaseManager.h:
+        * UIProcess/WebDatabaseManagerProxy.cpp:
+        (WebKit::WebDatabaseManagerProxy::initializeClient):
+        (WebKit::WebDatabaseManagerProxy::didModifyOrigin):
+        (WebKit::WebDatabaseManagerProxy::didModifyDatabase):
+        * UIProcess/WebDatabaseManagerProxy.h:
+        * UIProcess/WebDatabaseManagerProxy.messages.in:
+        * UIProcess/WebDatabaseManagerProxyClient.cpp: Added.
+        (WebKit::WebDatabaseManagerProxyClient::didModifyOrigin):
+        (WebKit::WebDatabaseManagerProxyClient::didModifyDatabase):
+        * UIProcess/WebDatabaseManagerProxyClient.h: Added.
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
+        (WebKit::WebDatabaseManager::WebDatabaseManager):
+        (WebKit::WebDatabaseManager::~WebDatabaseManager):
+        (WebKit::WebDatabaseManager::dispatchDidModifyOrigin):
+        (WebKit::WebDatabaseManager::dispatchDidModifyDatabase):
+        * WebProcess/WebCoreSupport/WebDatabaseManager.h:
+        * win/WebKit2.vcproj:
+
 2010-12-27  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders Carlsson.
index 52aa5be7a3e7c27fc4177f909467b9069e9bbd24..226ef8c83aa4c681f4b8687c10ae35812bbfd7bb 100644 (file)
@@ -87,6 +87,13 @@ WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey()
     return toAPI(key);
 }
 
+void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManagerRef, const WKDatabaseManagerClient* wkClient)
+{
+    if (wkClient && wkClient->version)
+        return;
+    toImpl(databaseManagerRef)->initializeClient(wkClient);
+}
+
 void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabasesByOriginFunction callback)
 {
     toImpl(databaseManagerRef)->getDatabasesByOrigin(ArrayCallback::create(context, callback));
index a4c97a6295ddda885b056239e457cef731830243..0a5eff65abd48f9bde45c7394a3fb1838792d7b8 100644 (file)
@@ -32,8 +32,6 @@
 extern "C" {
 #endif
 
-WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID();
-
 /* Value type: WKSecurityOriginRef */
 WK_EXPORT WKStringRef WKDatabaseManagerGetOriginKey();
 
@@ -63,8 +61,26 @@ WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey();
 /* Value type: WKUInt64Ref */
 WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey();
 
+
+// Database Manager Client
+typedef void (*WKDatabaseManagerDidModifyOriginCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, const void *clientInfo);
+typedef void (*WKDatabaseManagerDidModifyDatabaseCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, WKStringRef databaseIdentifier, const void *clientInfo);
+
+struct WKDatabaseManagerClient {
+    int                                                                 version;
+    const void *                                                        clientInfo;
+    WKDatabaseManagerDidModifyOriginCallback                            didModifyOrigin;
+    WKDatabaseManagerDidModifyDatabaseCallback                          didModifyDatabase;
+};
+typedef struct WKDatabaseManagerClient WKDatabaseManagerClient;
+
+
+WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID();
+
+WK_EXPORT void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManager, const WKDatabaseManagerClient* client);
+
 typedef void (*WKDatabaseManagerGetDatabasesByOriginFunction)(WKArrayRef, WKErrorRef, void*);
-WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function);
+WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function);
 #ifdef __BLOCKS__
 typedef void (^WKDatabaseManagerGetDatabasesByOriginBlock)(WKArrayRef, WKErrorRef);
 WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabasesByOriginBlock block);
index eccb16b7403d27db986c60364891cc299464f76f..6f382b79dc7fd0dd80baaa6acfee14eea7fa97b9 100644 (file)
@@ -104,6 +104,11 @@ void WebDatabaseManagerProxy::invalidate()
     m_webContext = 0;
 }
 
+void WebDatabaseManagerProxy::initializeClient(const WKDatabaseManagerClient* client)
+{
+    m_client.initialize(client);
+}
+
 void WebDatabaseManagerProxy::getDatabasesByOrigin(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
@@ -201,5 +206,17 @@ void WebDatabaseManagerProxy::setQuotaForOrigin(WebSecurityOrigin* origin, uint6
     m_webContext->process()->send(Messages::WebDatabaseManager::SetQuotaForOrigin(origin->databaseIdentifier(), quota), 0);
 }
 
+void WebDatabaseManagerProxy::didModifyOrigin(const String& originIdentifier)
+{
+    RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+    m_client.didModifyOrigin(this, origin.get());
+}
+
+void WebDatabaseManagerProxy::didModifyDatabase(const String& originIdentifier, const String& databaseIdentifier)
+{
+    RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+    m_client.didModifyDatabase(this, origin.get(), databaseIdentifier);
+}
+
 } // namespace WebKit
 
index 2734ad16c5af3571d3dfa9d0e9230f4e2427fab7..98782324042c6ada607033b6cbc0a89e4da76fae 100644 (file)
@@ -30,7 +30,7 @@
 #include "Arguments.h"
 #include "GenericCallback.h"
 #include "OriginAndDatabases.h"
-#include "WKBase.h"
+#include "WebDatabaseManagerProxyClient.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 
@@ -56,6 +56,8 @@ public:
 
     void invalidate();
 
+    void initializeClient(const WKDatabaseManagerClient*);
+
     void getDatabasesByOrigin(PassRefPtr<ArrayCallback>);
     void getDatabaseOrigins(PassRefPtr<ArrayCallback>);
     void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, WebSecurityOrigin*);
@@ -82,9 +84,13 @@ private:
     // Message handlers.
     void didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabases, uint64_t callbackID);
     void didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID);
+    void didModifyOrigin(const String& originIdentifier);
+    void didModifyDatabase(const String& originIdentifier, const String& databaseIdentifier);
 
     WebContext* m_webContext;
     HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+
+    WebDatabaseManagerProxyClient m_client;
 };
 
 } // namespace WebKit
index b1fa68a6336e3145480b63200ce12cbb68a07203..37a9b89ecfd49f9ae860b79fc5ac8d17501d180a 100644 (file)
@@ -23,4 +23,6 @@
 messages -> WebDatabaseManagerProxy {
     DidGetDatabasesByOrigin(Vector<WebKit::OriginAndDatabases> originAndDatabases, uint64_t callbackID);
     DidGetDatabaseOrigins(Vector<WTF::String> originIdentifiers, uint64_t callbackID)
+    DidModifyOrigin(WTF::String originIdentifier)
+    DidModifyDatabase(WTF::String originIdentifier, WTF::String databaseIdentifier)
 }
diff --git a/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp b/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp
new file mode 100644 (file)
index 0000000..8ba3a0e
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 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. 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 INC. 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.
+ */
+
+#include "WebDatabaseManagerProxyClient.h"
+
+#include "WKAPICast.h"
+
+namespace WebKit {
+
+void WebDatabaseManagerProxyClient::didModifyOrigin(WebDatabaseManagerProxy* databaseManager, WebSecurityOrigin* origin)
+{
+    if (!m_client.didModifyOrigin)
+        return;
+
+    m_client.didModifyOrigin(toAPI(databaseManager), toAPI(origin), m_client.clientInfo);
+}
+
+void WebDatabaseManagerProxyClient::didModifyDatabase(WebDatabaseManagerProxy* databaseManager, WebSecurityOrigin* origin, const String& databaseIdentifier)
+{
+    if (!m_client.didModifyDatabase)
+        return;
+
+    m_client.didModifyDatabase(toAPI(databaseManager), toAPI(origin), toAPI(databaseIdentifier.impl()), m_client.clientInfo);
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h b/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h
new file mode 100644 (file)
index 0000000..f02c130
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 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. 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 INC. 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 WebDatabaseManagerProxyClient_h
+#define WebDatabaseManagerProxyClient_h
+
+#include "APIClient.h"
+#include "WKDatabaseManager.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebDatabaseManagerProxy;
+class WebSecurityOrigin;
+
+class WebDatabaseManagerProxyClient : public APIClient<WKDatabaseManagerClient> {
+public:
+    void didModifyOrigin(WebDatabaseManagerProxy*, WebSecurityOrigin*);
+    void didModifyDatabase(WebDatabaseManagerProxy*, WebSecurityOrigin*, const String& databaseIdentifier);
+};
+
+} // namespace WebKit
+
+#endif // WebDatabaseManagerProxyClient_h
index 5882a0afb8c84d2deaae0ef11d00f6ce05bcf329..3bda5e6075d74edeec2ca5518c7af208057bd300 100644 (file)
@@ -335,6 +335,7 @@ HEADERS += \
     UIProcess/WebContextMenuProxy.h \
     UIProcess/WebContextUserMessageCoders.h \
     UIProcess/WebDatabaseManagerProxy.h \
+    UIProcess/WebDatabaseManagerProxyClient.h \
     UIProcess/WebDownloadClient.h \
     UIProcess/WebEditCommandProxy.h \
     UIProcess/WebFindClient.h \
@@ -533,6 +534,7 @@ SOURCES += \
     UIProcess/WebContextInjectedBundleClient.cpp \
     UIProcess/WebContextMenuProxy.cpp \
     UIProcess/WebDatabaseManagerProxy.cpp \
+    UIProcess/WebDatabaseManagerProxyClient.cpp \
     UIProcess/WebDownloadClient.cpp \
     UIProcess/WebEditCommandProxy.cpp \
     UIProcess/WebFindClient.cpp \
index c0c18724955af45b88afc7e5ebcff87f6495152b..5643410cc8e6fdbd8f8166633136c2c82de60953 100644 (file)
                BCA8C6A911E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */; };
                BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */; };
                BCA8C6B011E3C08700812FB7 /* InjectedBundlePageUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */; };
+               BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */; };
+               BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */; };
                BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8049D122F0D6B00103529 /* MutableArray.cpp */; };
                BCB0AD34122F285800B1341E /* MutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8049E122F0D6B00103529 /* MutableArray.h */; };
                BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0AEE7122F53E300B1341E /* MutableDictionary.h */; };
                BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageLoaderClient.h; sourceTree = "<group>"; };
                BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageUIClient.cpp; sourceTree = "<group>"; };
                BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageUIClient.h; sourceTree = "<group>"; };
+               BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxyClient.h; sourceTree = "<group>"; };
+               BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyClient.cpp; sourceTree = "<group>"; };
                BCB0AEE7122F53E300B1341E /* MutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableDictionary.h; sourceTree = "<group>"; };
                BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutableDictionary.cpp; sourceTree = "<group>"; };
                BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextUserMessageCoders.h; sourceTree = "<group>"; };
                                BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */,
                                BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */,
                                BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */,
+                               BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */,
+                               BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */,
                                F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */,
                                F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */,
                                F62A765B12B1ABC30005F1B6 /* WebDatabaseManagerProxy.messages.in */,
                                1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */,
                                1AA41AB512C02EC4002BE67B /* SelectionState.h in Headers */,
                                BCCF672D12C7EDF7008F9C35 /* OriginAndDatabases.h in Headers */,
+                               BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BC858A2112C0357B00EDEB2E /* WebResourceLoadClient.cpp in Sources */,
                                1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */,
                                BCCF673312C7F15C008F9C35 /* OriginAndDatabases.cpp in Sources */,
+                               BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index fab0ae191c6f42febbcb56ab4cc26f25d3d1b185..cc61b04de99084a368a57138ac1df3759a5c918d 100644 (file)
@@ -48,6 +48,11 @@ WebDatabaseManager& WebDatabaseManager::shared()
 WebDatabaseManager::WebDatabaseManager()
 {
     DatabaseTracker::initializeTracker(databaseDirectory());
+    DatabaseTracker::tracker().setClient(this);
+}
+
+WebDatabaseManager::~WebDatabaseManager()
+{
 }
 
 void WebDatabaseManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
@@ -146,4 +151,16 @@ void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsig
     DatabaseTracker::tracker().setQuota(origin.get(), quota);
 }
 
+void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
+{
+    // NOTE: This may be called on a non-main thread.
+    WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidModifyOrigin(origin->databaseIdentifier()), 0);
+}
+
+void WebDatabaseManager::dispatchDidModifyDatabase(WebCore::SecurityOrigin* origin, const String& databaseIdentifier)
+{
+    // NOTE: This may be called on a non-main thread.
+    WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidModifyDatabase(origin->databaseIdentifier(), databaseIdentifier), 0);
+}
+
 } // namespace WebKit
index 686892a7577607becdf4c567d9a229cff3fb72cc..47016455cc959348ba75b020d91f08c6314a5ded 100644 (file)
@@ -27,6 +27,7 @@
 #define WebDatabaseManager_h
 
 #include "Arguments.h"
+#include <WebCore/DatabaseTrackerClient.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
 
@@ -38,7 +39,7 @@ class MessageID;
 
 namespace WebKit {
 
-class WebDatabaseManager {
+class WebDatabaseManager : public WebCore::DatabaseTrackerClient {
     WTF_MAKE_NONCOPYABLE(WebDatabaseManager);
 public:
     static WebDatabaseManager& shared();
@@ -47,6 +48,7 @@ public:
 
 private:
     WebDatabaseManager();
+    virtual ~WebDatabaseManager();
 
     // Implemented in generated WebDatabaseManagerMessageReceiver.cpp
     void didReceiveWebDatabaseManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
@@ -58,6 +60,10 @@ private:
     void deleteAllDatabases() const;
     void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const;
 
+    // WebCore::DatabaseTrackerClient
+    virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
+    virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier);
+
     String databaseDirectory() const;
 };
 
index 2e325dd31a14755dd3d8ef80a26de4d096ff5886..0c88c520dfe9867c7b6262b611d9b3da045d4da2 100755 (executable)
                                RelativePath="..\UIProcess\WebDatabaseManagerProxy.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\UIProcess\WebDatabaseManagerProxyClient.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\UIProcess\WebDatabaseManagerProxyClient.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\UIProcess\WebDatabaseManagerProxy.messages.in"
                                >