[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
jberlin at webkit.org
jberlin at webkit.org
Wed Dec 22 18:26:27 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c09242b60e67a67bd2997c351ed809c77885088d
Author: jberlin at webkit.org <jberlin at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 10 23:12:15 2010 +0000
WebKit2: Need a WebKit2 equivalent of the WebKit1 WebDatabaseManager
https://bugs.webkit.org/show_bug.cgi?id=50606
Reviewed by Adam Roben and Sam Weinig.
Add a WebDatabaseManagerProxy owned by the WebContext.
Expose API (similar to the WebKit1 API) to get a list of origins for which there are
Databases, delete all the databases for a given origin, and delete all the databases.
Add WebDatabaseManager and WebDatabaseManagerProxy as messages receivers.
* DerivedSources.make:
* Platform/CoreIPC/MessageID.h:
Add the WebDatabaseManagerProxy as a UIProcess type (DatabaseManager).
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextGetDatabaseManager):
Expose API to get the DatabaseManager.
* UIProcess/API/C/WKContext.h:
* UIProcess/API/C/WKDatabaseManager.cpp: Added.
(WKDatabaseManagerGetTypeID):
(WKDatabaseManagerGetDatabaseOrigins):
(callGetDatabaseOriginsBlockBlockAndDispose):
(WKDatabaseManagerGetDatabaseOrigins_b):
(WKDatabaseManagerDeleteDatabasesForOrigin):
(WKDatabaseManagerDeleteAllDatabases):
* UIProcess/API/C/WKDatabaseManager.h: Added.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
Create the WebDatabaseManagerProxy.
(WebKit::WebContext::processDidClose):
Invalidate the WebDatabaseManagerProxy.
(WebKit::WebContext::didReceiveMessage):
Forward messages to the WebDatabaseManagerProxy.
* UIProcess/WebContext.h:
(WebKit::WebContext::databaseManagerProxy):
* UIProcess/WebDatabaseManagerProxy.cpp: Added.
(WebKit::WebDatabaseManagerProxy::create):
(WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy):
(WebKit::WebDatabaseManagerProxy::~WebDatabaseManagerProxy):
(WebKit::WebDatabaseManagerProxy::invalidate):
Invalidate the map of callbacks for getDatabaseOrigins.
(WebKit::WebDatabaseManagerProxy::getDatabaseOrigins):
Store the callback and send the request for the origins which have databases to the
WebProcess.
(WebKit::WebDatabaseManagerProxy::didGetDatabaseOrigins):
Call the callback function with the SecurityOrigins created from the identifiers received.
(WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin):
If the origin exists, send the message on to the WebProcess to delete the databases
associated with that origin.
(WebKit::WebDatabaseManagerProxy::deleteAllDatabases):
Send the message to the WebProcess to delete all the databases.
* UIProcess/WebDatabaseManagerProxy.h: Added.
(WebKit::WebDatabaseManagerProxy::type):
* UIProcess/WebDatabaseManagerProxy.messages.in: Added.
* UIProcess/WebPageProxy.cpp:
Move invalidateCallbackMap from here ...
* UIProcess/GenericCallback.h:
(WebKit::invalidateCallbackMap):
.. to here so that it can be used elsewhere (e.g. by WebDatabaseManagerProxy).
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveMessage):
Forward on all messages destined for the WebDatabaseManagerProxy to the WebContext.
* WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
(WebKit::WebDatabaseManager::didReceiveMessage):
(WebKit::WebDatabaseManager::getDatabaseOrigins):
Send an array of the identifiers for the SecurityOrigins for which there are databases to
the UIProcess.
(WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
If the SecurityOrigin with that identifier exists, tell the DatabaseTracker to delete the
databases for that origin.
(WebKit::WebDatabaseManager::deleteAllDatabases):
Tell the DatabaseTracker to delete the databases for that origin.
* WebProcess/WebCoreSupport/WebDatabaseManager.h:
* WebProcess/WebCoreSupport/WebDatabaseManager.messages.in: Added.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage):
* WebKit2.pro:
Add WKDatabaseManager.cpp/.h and WebDatabaseManagerProxy.cpp/.h
* WebKit2.xcodeproj/project.pbxproj:
Ditto, also add WebDatabaseManagerProxy.messages.in and WebDatabaseManager.messages.in.
* win/WebKit2.vcproj:
Ditto.
* win/WebKit2Generated.make:
Make sure WKDatabaseManager.h is copied into WebKitBuild on Windows.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 005f594..a39d3ab 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,102 @@
+2010-12-10 Jessie Berlin <jberlin at apple.com>
+
+ Reviewed by Adam Roben and Sam Weinig.
+
+ WebKit2: Need a WebKit2 equivalent of the WebKit1 WebDatabaseManager
+ https://bugs.webkit.org/show_bug.cgi?id=50606
+
+ Add a WebDatabaseManagerProxy owned by the WebContext.
+
+ Expose API (similar to the WebKit1 API) to get a list of origins for which there are
+ Databases, delete all the databases for a given origin, and delete all the databases.
+
+ Add WebDatabaseManager and WebDatabaseManagerProxy as messages receivers.
+ * DerivedSources.make:
+ * Platform/CoreIPC/MessageID.h:
+
+ Add the WebDatabaseManagerProxy as a UIProcess type (DatabaseManager).
+ * Shared/API/c/WKBase.h:
+ * Shared/APIObject.h:
+ * UIProcess/API/C/WKAPICast.h:
+
+ * UIProcess/API/C/WKContext.cpp:
+ (WKContextGetDatabaseManager):
+ Expose API to get the DatabaseManager.
+ * UIProcess/API/C/WKContext.h:
+
+ * UIProcess/API/C/WKDatabaseManager.cpp: Added.
+ (WKDatabaseManagerGetTypeID):
+ (WKDatabaseManagerGetDatabaseOrigins):
+ (callGetDatabaseOriginsBlockBlockAndDispose):
+ (WKDatabaseManagerGetDatabaseOrigins_b):
+ (WKDatabaseManagerDeleteDatabasesForOrigin):
+ (WKDatabaseManagerDeleteAllDatabases):
+ * UIProcess/API/C/WKDatabaseManager.h: Added.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::WebContext):
+ Create the WebDatabaseManagerProxy.
+ (WebKit::WebContext::processDidClose):
+ Invalidate the WebDatabaseManagerProxy.
+ (WebKit::WebContext::didReceiveMessage):
+ Forward messages to the WebDatabaseManagerProxy.
+ * UIProcess/WebContext.h:
+ (WebKit::WebContext::databaseManagerProxy):
+
+ * UIProcess/WebDatabaseManagerProxy.cpp: Added.
+ (WebKit::WebDatabaseManagerProxy::create):
+ (WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy):
+ (WebKit::WebDatabaseManagerProxy::~WebDatabaseManagerProxy):
+ (WebKit::WebDatabaseManagerProxy::invalidate):
+ Invalidate the map of callbacks for getDatabaseOrigins.
+ (WebKit::WebDatabaseManagerProxy::getDatabaseOrigins):
+ Store the callback and send the request for the origins which have databases to the
+ WebProcess.
+ (WebKit::WebDatabaseManagerProxy::didGetDatabaseOrigins):
+ Call the callback function with the SecurityOrigins created from the identifiers received.
+ (WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin):
+ If the origin exists, send the message on to the WebProcess to delete the databases
+ associated with that origin.
+ (WebKit::WebDatabaseManagerProxy::deleteAllDatabases):
+ Send the message to the WebProcess to delete all the databases.
+ * UIProcess/WebDatabaseManagerProxy.h: Added.
+ (WebKit::WebDatabaseManagerProxy::type):
+ * UIProcess/WebDatabaseManagerProxy.messages.in: Added.
+
+ * UIProcess/WebPageProxy.cpp:
+ Move invalidateCallbackMap from here ...
+ * UIProcess/GenericCallback.h:
+ (WebKit::invalidateCallbackMap):
+ .. to here so that it can be used elsewhere (e.g. by WebDatabaseManagerProxy).
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didReceiveMessage):
+ Forward on all messages destined for the WebDatabaseManagerProxy to the WebContext.
+
+ * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
+ (WebKit::WebDatabaseManager::didReceiveMessage):
+ (WebKit::WebDatabaseManager::getDatabaseOrigins):
+ Send an array of the identifiers for the SecurityOrigins for which there are databases to
+ the UIProcess.
+ (WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
+ If the SecurityOrigin with that identifier exists, tell the DatabaseTracker to delete the
+ databases for that origin.
+ (WebKit::WebDatabaseManager::deleteAllDatabases):
+ Tell the DatabaseTracker to delete the databases for that origin.
+ * WebProcess/WebCoreSupport/WebDatabaseManager.h:
+ * WebProcess/WebCoreSupport/WebDatabaseManager.messages.in: Added.
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::didReceiveMessage):
+
+ * WebKit2.pro:
+ Add WKDatabaseManager.cpp/.h and WebDatabaseManagerProxy.cpp/.h
+ * WebKit2.xcodeproj/project.pbxproj:
+ Ditto, also add WebDatabaseManagerProxy.messages.in and WebDatabaseManager.messages.in.
+ * win/WebKit2.vcproj:
+ Ditto.
+ * win/WebKit2Generated.make:
+ Make sure WKDatabaseManager.h is copied into WebKitBuild on Windows.
+
2010-12-10 Ada Chan <adachan at apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebKit2/DerivedSources.make b/WebKit2/DerivedSources.make
index ba78b63..413d3f0 100644
--- a/WebKit2/DerivedSources.make
+++ b/WebKit2/DerivedSources.make
@@ -25,6 +25,7 @@ VPATH = \
$(WebKit2)/Shared/Plugins \
$(WebKit2)/WebProcess/Authentication \
$(WebKit2)/WebProcess/Plugins \
+ $(WebKit2)/WebProcess/WebCoreSupport \
$(WebKit2)/WebProcess/WebPage \
$(WebKit2)/WebProcess \
$(WebKit2)/UIProcess \
@@ -41,6 +42,8 @@ MESSAGE_RECEIVERS = \
PluginProcessProxy \
PluginProxy \
WebContext \
+ WebDatabaseManager \
+ WebDatabaseManagerProxy \
WebInspector \
WebInspectorProxy \
WebPage \
diff --git a/WebKit2/Platform/CoreIPC/MessageID.h b/WebKit2/Platform/CoreIPC/MessageID.h
index 2724b0f..3ba6297 100644
--- a/WebKit2/Platform/CoreIPC/MessageID.h
+++ b/WebKit2/Platform/CoreIPC/MessageID.h
@@ -38,6 +38,7 @@ enum MessageClass {
MessageClassAuthenticationManager,
MessageClassDrawingArea,
MessageClassInjectedBundle,
+ MessageClassWebDatabaseManager,
MessageClassWebInspector,
MessageClassWebPage,
MessageClassWebProcess,
@@ -47,6 +48,7 @@ enum MessageClass {
MessageClassDownloadProxy,
MessageClassWebContext,
MessageClassWebContextLegacy,
+ MessageClassWebDatabaseManagerProxy,
MessageClassWebInspectorProxy,
MessageClassWebPageProxy,
MessageClassWebProcessProxy,
diff --git a/WebKit2/Shared/API/c/WKBase.h b/WebKit2/Shared/API/c/WKBase.h
index 9a44d8f..f8d025d 100644
--- a/WebKit2/Shared/API/c/WKBase.h
+++ b/WebKit2/Shared/API/c/WKBase.h
@@ -66,6 +66,7 @@ typedef const struct OpaqueWKBackForwardList* WKBackForwardListRef;
typedef const struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
typedef const struct OpaqueWKContext* WKContextRef;
typedef const struct OpaqueWKCredential* WKCredentialRef;
+typedef const struct OpaqueWKDatabaseManager* WKDatabaseManagerRef;
typedef const struct OpaqueWKDownload* WKDownloadRef;
typedef const struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef;
typedef const struct OpaqueWKFrame* WKFrameRef;
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 07fe654..11cc0d9 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -62,6 +62,7 @@ public:
TypeBackForwardList,
TypeBackForwardListItem,
TypeContext,
+ TypeDatabaseManager,
TypeDownload,
TypeFormSubmissionListener,
TypeFrame,
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index fc33f39..a29d040 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -47,6 +47,7 @@ class WebBackForwardList;
class WebBackForwardListItem;
class WebContext;
class WebCredential;
+class WebDatabaseManagerProxy;
class WebFormSubmissionListenerProxy;
class WebFramePolicyListenerProxy;
class WebFrameProxy;
@@ -64,6 +65,7 @@ WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
WK_ADD_API_MAPPING(WKContextRef, WebContext)
WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
+WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy)
WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
diff --git a/WebKit2/UIProcess/API/C/WKContext.cpp b/WebKit2/UIProcess/API/C/WKContext.cpp
index 3752fa8..300cc94 100644
--- a/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -141,3 +141,8 @@ void WKContextClearApplicationCache(WKContextRef contextRef)
{
toImpl(contextRef)->clearApplicationCache();
}
+
+WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->databaseManagerProxy());
+}
diff --git a/WebKit2/UIProcess/API/C/WKContext.h b/WebKit2/UIProcess/API/C/WKContext.h
index 6bf9142..d63eebd 100644
--- a/WebKit2/UIProcess/API/C/WKContext.h
+++ b/WebKit2/UIProcess/API/C/WKContext.h
@@ -118,6 +118,8 @@ WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
WK_EXPORT void WKContextClearResourceCaches(WKContextRef context);
WK_EXPORT void WKContextClearApplicationCache(WKContextRef context);
+WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context);
+
#ifdef __cplusplus
}
#endif
diff --git a/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
new file mode 100644
index 0000000..bc789a1
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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 "WKDatabaseManager.h"
+
+#include "WebDatabaseManagerProxy.h"
+#include "WKAPICast.h"
+
+#ifdef __BLOCKS__
+#include <Block.h>
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKDatabaseManagerGetTypeID()
+{
+ return toAPI(WebDatabaseManagerProxy::APIType);
+}
+
+void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabaseOriginsFunction callback)
+{
+ toImpl(databaseManager)->getDatabaseOrigins(DatabaseOriginsCallback::create(context, callback));
+}
+
+#ifdef __BLOCKS__
+static void callGetDatabaseOriginsBlockBlockAndDispose(WKArrayRef resultValue, WKErrorRef error, void* context)
+{
+ WKDatabaseManagerGetDatabaseOriginsBlock block = (WKDatabaseManagerGetDatabaseOriginsBlock)context;
+ block(resultValue, error);
+ Block_release(block);
+}
+
+void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block)
+{
+ WKDatabaseManagerGetDatabaseOrigins(databaseManager, Block_copy(block), callGetDatabaseOriginsBlockBlockAndDispose);
+}
+#endif
+
+void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin)
+{
+ toImpl(databaseManager)->deleteDatabasesForOrigin(toImpl(origin));
+}
+
+void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManager)
+{
+ toImpl(databaseManager)->deleteAllDatabases();
+}
+
diff --git a/WebKit2/UIProcess/API/C/WKDatabaseManager.h b/WebKit2/UIProcess/API/C/WKDatabaseManager.h
new file mode 100644
index 0000000..4b73c2a
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKDatabaseManager.h
@@ -0,0 +1,50 @@
+/*
+ * 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 WKDatabaseManager_h
+#define WKDatabaseManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID();
+
+typedef void (*WKDatabaseManagerGetDatabaseOriginsFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction function);
+#ifdef __BLOCKS__
+typedef void (^WKDatabaseManagerGetDatabaseOriginsBlock)(WKArrayRef, WKErrorRef);
+WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block);
+#endif
+WK_EXPORT void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin);
+WK_EXPORT void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKDatabaseManager_h
diff --git a/WebKit2/UIProcess/GenericCallback.h b/WebKit2/UIProcess/GenericCallback.h
index f7befe5..b72314a 100644
--- a/WebKit2/UIProcess/GenericCallback.h
+++ b/WebKit2/UIProcess/GenericCallback.h
@@ -29,6 +29,7 @@
#include "WKAPICast.h"
#include "WebError.h"
+#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -89,6 +90,16 @@ private:
uint64_t m_callbackID;
};
+template<typename T>
+void invalidateCallbackMap(HashMap<uint64_t, T>& map)
+{
+ Vector<T> callbacksVector;
+ copyValuesToVector(map, callbacksVector);
+ for (size_t i = 0, size = callbacksVector.size(); i < size; ++i)
+ callbacksVector[i]->invalidate();
+ map.clear();
+}
+
} // namespace WebKit
#endif // GenericCallback_h
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index 930d2fd..3cae3a6 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -33,6 +33,7 @@
#include "WebContextMessageKinds.h"
#include "WebContextUserMessageCoders.h"
#include "WebCoreArgumentCoders.h"
+#include "WebDatabaseManagerProxy.h"
#include "WebPageGroup.h"
#include "WebPageNamespace.h"
#include "WebProcessCreationParameters.h"
@@ -84,6 +85,7 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_cacheModel(CacheModelDocumentViewer)
, m_clearResourceCachesForNewWebProcess(false)
, m_clearApplicationCacheForNewWebProcess(false)
+ , m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
#if PLATFORM(WIN)
, m_shouldPaintNativeControls(true)
#endif
@@ -206,6 +208,8 @@ void WebContext::processDidClose(WebProcessProxy* process)
m_downloads.clear();
+ m_databaseManagerProxy->invalidate();
+
m_process = 0;
}
@@ -437,6 +441,11 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) {
+ m_databaseManagerProxy->didReceiveWebDatabaseManagerProxyMessage(connection, messageID, arguments);
+ return;
+ }
+
switch (messageID.get<WebContextLegacyMessage::Kind>()) {
case WebContextLegacyMessage::PostMessage: {
String messageName;
diff --git a/WebKit2/UIProcess/WebContext.h b/WebKit2/UIProcess/WebContext.h
index 91aed59..1aa5527 100644
--- a/WebKit2/UIProcess/WebContext.h
+++ b/WebKit2/UIProcess/WebContext.h
@@ -47,6 +47,7 @@ struct WKContextStatistics;
namespace WebKit {
class DownloadProxy;
+class WebDatabaseManagerProxy;
class WebPageGroup;
class WebPageNamespace;
class WebPageProxy;
@@ -124,6 +125,8 @@ public:
static HashSet<String, CaseFoldingHash> pdfAndPostScriptMIMETypes();
+ WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); }
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
@@ -181,7 +184,9 @@ private:
bool m_clearResourceCachesForNewWebProcess;
bool m_clearApplicationCacheForNewWebProcess;
-
+
+ RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy;
+
#if PLATFORM(WIN)
bool m_shouldPaintNativeControls;
#endif
diff --git a/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
new file mode 100644
index 0000000..9aff4ab
--- /dev/null
+++ b/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
@@ -0,0 +1,98 @@
+/*
+ * 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 "WebDatabaseManagerProxy.h"
+
+#include "ImmutableArray.h"
+#include "WebDatabaseManagerMessages.h"
+#include "WebContext.h"
+#include "WebSecurityOrigin.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext* webContext)
+{
+ return adoptRef(new WebDatabaseManagerProxy(webContext));
+}
+
+WebDatabaseManagerProxy::WebDatabaseManagerProxy(WebContext* webContext)
+ : m_webContext(webContext)
+{
+}
+
+WebDatabaseManagerProxy::~WebDatabaseManagerProxy()
+{
+ ASSERT(!m_webContext);
+}
+
+void WebDatabaseManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_databaseOriginsCallbacks);
+
+ m_webContext = 0;
+}
+
+void WebDatabaseManagerProxy::getDatabaseOrigins(PassRefPtr<DatabaseOriginsCallback> prpCallback)
+{
+ RefPtr<DatabaseOriginsCallback> callback = prpCallback;
+ uint64_t callbackID = callback->callbackID();
+ m_databaseOriginsCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabaseOrigins(callbackID), 0);
+}
+
+void WebDatabaseManagerProxy::didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID)
+{
+ RefPtr<DatabaseOriginsCallback> callback = m_databaseOriginsCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ size_t originIdentifiersCount = originIdentifiers.size();
+ Vector<RefPtr<APIObject> > securityOrigins(originIdentifiersCount);
+
+ for (size_t i = 0; i < originIdentifiersCount; ++i)
+ securityOrigins[i] = WebSecurityOrigin::create(originIdentifiers[i]);
+
+ callback->performCallbackWithReturnValue(ImmutableArray::adopt(securityOrigins).get());
+}
+
+void WebDatabaseManagerProxy::deleteDatabasesForOrigin(WebSecurityOrigin* origin)
+{
+ if (!origin)
+ return;
+
+ m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabasesForOrigin(origin->databaseIdentifier()), 0);
+}
+
+void WebDatabaseManagerProxy::deleteAllDatabases()
+{
+ m_webContext->process()->send(Messages::WebDatabaseManager::DeleteAllDatabases(), 0);
+}
+
+} // namespace WebKit
+
diff --git a/WebKit2/UIProcess/WebDatabaseManagerProxy.h b/WebKit2/UIProcess/WebDatabaseManagerProxy.h
new file mode 100644
index 0000000..9b912b9
--- /dev/null
+++ b/WebKit2/UIProcess/WebDatabaseManagerProxy.h
@@ -0,0 +1,78 @@
+/*
+ * 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 WebDatabaseManagerProxy_h
+#define WebDatabaseManagerProxy_h
+
+#include "APIObject.h"
+#include "Arguments.h"
+#include "GenericCallback.h"
+#include "WKBase.h"
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+class MessageID;
+}
+
+namespace WebKit {
+
+class WebContext;
+class WebSecurityOrigin;
+
+typedef GenericCallback<WKArrayRef> DatabaseOriginsCallback;
+
+class WebDatabaseManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeDatabaseManager;
+
+ static PassRefPtr<WebDatabaseManagerProxy> create(WebContext*);
+ virtual ~WebDatabaseManagerProxy();
+
+ void invalidate();
+
+ void getDatabaseOrigins(PassRefPtr<DatabaseOriginsCallback>);
+ void deleteDatabasesForOrigin(WebSecurityOrigin*);
+ void deleteAllDatabases();
+
+ void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebDatabaseManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Message handlers.
+ void didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<DatabaseOriginsCallback> > m_databaseOriginsCallbacks;
+};
+
+} // namespace WebKit
+
+#endif // DatabaseManagerProxy_h
diff --git a/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in b/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in
new file mode 100644
index 0000000..d0f459a
--- /dev/null
+++ b/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in
@@ -0,0 +1,25 @@
+# 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.
+
+messages -> WebDatabaseManagerProxy {
+ DidGetDatabaseOrigins(Vector<WTF::String> originIdentifiers, uint64_t callbackID)
+}
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 8d52cb1..b635601 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -78,16 +78,6 @@ namespace WebKit {
static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy");
#endif
-template<typename T>
-void invalidateCallbackMap(HashMap<uint64_t, T>& map)
-{
- Vector<T> callbacksVector;
- copyValuesToVector(map, callbacksVector);
- for (size_t i = 0, size = callbacksVector.size(); i < size; ++i)
- callbacksVector[i]->invalidate();
- map.clear();
-}
-
PassRefPtr<WebPageProxy> WebPageProxy::create(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, uint64_t pageID)
{
return adoptRef(new WebPageProxy(pageNamespace, pageGroup, pageID));
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 75330c2..6ade713 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -205,7 +205,10 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
return;
}
- if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() || messageID.is<CoreIPC::MessageClassDownloadProxy>()) {
+ if (messageID.is<CoreIPC::MessageClassWebContext>()
+ || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
+ || messageID.is<CoreIPC::MessageClassDownloadProxy>()
+ || messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) {
m_context->didReceiveMessage(connection, messageID, arguments);
return;
}
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index e207a26..becd21a 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -277,6 +277,7 @@ HEADERS += \
UIProcess/API/C/WKContextPrivate.h \
UIProcess/API/C/WKCredential.h \
UIProcess/API/C/WKCredentialTypes.h \
+ UIProcess/API/C/WKDatabaseManager.h \
UIProcess/API/C/WKDownload.h \
UIProcess/API/C/WKFrame.h \
UIProcess/API/C/WKFramePolicyListener.h \
@@ -325,6 +326,7 @@ HEADERS += \
UIProcess/WebContextInjectedBundleClient.h \
UIProcess/WebContextMenuProxy.h \
UIProcess/WebContextUserMessageCoders.h \
+ UIProcess/WebDatabaseManagerProxy.h \
UIProcess/WebDownloadClient.h \
UIProcess/WebEditCommandProxy.h \
UIProcess/WebFindClient.h \
@@ -475,6 +477,7 @@ SOURCES += \
UIProcess/API/C/WKBackForwardListItem.cpp \
UIProcess/API/C/WKContext.cpp \
UIProcess/API/C/WKCredential.cpp \
+ UIProcess/API/C/WKDatabaseManager.cpp \
UIProcess/API/C/WKDownload.cpp \
UIProcess/API/C/WKFrame.cpp \
UIProcess/API/C/WKFramePolicyListener.cpp \
@@ -515,6 +518,7 @@ SOURCES += \
UIProcess/WebContext.cpp \
UIProcess/WebContextInjectedBundleClient.cpp \
UIProcess/WebContextMenuProxy.cpp \
+ UIProcess/WebDatabaseManagerProxy.cpp \
UIProcess/WebDownloadClient.cpp \
UIProcess/WebEditCommandProxy.cpp \
UIProcess/WebFindClient.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 1ffec6d..089e9ab 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -587,6 +587,14 @@
F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */; };
F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */; };
F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ F62A765C12B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */; };
+ F62A765D12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */; };
+ F62A766112B1ABED0005F1B6 /* WKDatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */; };
+ F62A766212B1ABED0005F1B6 /* WKDatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ F62A76B612B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */; };
+ F62A76B712B1B25F0005F1B6 /* WebDatabaseManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */; };
+ F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */; };
+ F62A76B912B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */; };
F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445512A885C8000612D8 /* WebSecurityOrigin.h */; };
F634445C12A885E9000612D8 /* WKSecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */; };
F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445B12A885E9000612D8 /* WKSecurityOrigin.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1243,6 +1251,16 @@
F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentURLPattern.h; sourceTree = "<group>"; };
F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserContentURLPattern.cpp; sourceTree = "<group>"; };
F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentURLPattern.h; sourceTree = "<group>"; };
+ F62A765712B1AB7D0005F1B6 /* WebDatabaseManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDatabaseManager.messages.in; sourceTree = "<group>"; };
+ F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxy.cpp; sourceTree = "<group>"; };
+ F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxy.h; sourceTree = "<group>"; };
+ F62A765B12B1ABC30005F1B6 /* WebDatabaseManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDatabaseManagerProxy.messages.in; sourceTree = "<group>"; };
+ F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKDatabaseManager.cpp; sourceTree = "<group>"; };
+ F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDatabaseManager.h; sourceTree = "<group>"; };
+ F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerMessageReceiver.cpp; sourceTree = "<group>"; };
+ F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerMessages.h; sourceTree = "<group>"; };
+ F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
+ F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxyMessages.h; sourceTree = "<group>"; };
F634445512A885C8000612D8 /* WebSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOrigin.h; sourceTree = "<group>"; };
F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKSecurityOrigin.cpp; sourceTree = "<group>"; };
F634445B12A885E9000612D8 /* WKSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSecurityOrigin.h; sourceTree = "<group>"; };
@@ -1756,6 +1774,7 @@
BC032D6210F4378D0058C15A /* WebContextMenuClient.h */,
F6A25FDA12ADC6CC00DC40CC /* WebDatabaseManager.cpp */,
F6A25FDB12ADC6CC00DC40CC /* WebDatabaseManager.h */,
+ F62A765712B1AB7D0005F1B6 /* WebDatabaseManager.messages.in */,
BC111A56112F4FBB00337BAB /* WebDragClient.cpp */,
BC032D6610F4378D0058C15A /* WebDragClient.h */,
BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */,
@@ -1848,6 +1867,9 @@
BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */,
BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */,
BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */,
+ F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */,
+ F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */,
+ F62A765B12B1ABC30005F1B6 /* WebDatabaseManagerProxy.messages.in */,
1AB7D72B1288CAAD00CFD08C /* WebDownloadClient.cpp */,
1AB7D72A1288CAAD00CFD08C /* WebDownloadClient.h */,
BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */,
@@ -1929,6 +1951,8 @@
512F58F112A88A5400629530 /* WKCredential.cpp */,
512F58F212A88A5400629530 /* WKCredential.h */,
518ACF1012B015F800B04B83 /* WKCredentialTypes.h */,
+ F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */,
+ F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */,
1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */,
1AB7D78B1288CD9A00CFD08C /* WKDownload.h */,
BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */,
@@ -2332,6 +2356,10 @@
1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */,
BCEE7D0B12846F69009827DA /* WebContextMessageReceiver.cpp */,
BCEE7D0C12846F69009827DA /* WebContextMessages.h */,
+ F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */,
+ F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */,
+ F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */,
+ F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */,
1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */,
1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */,
1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */,
@@ -2670,6 +2698,10 @@
F6A25FDD12ADC6CC00DC40CC /* WebDatabaseManager.h in Headers */,
1AAF061412B01131008E49E2 /* PDFViewController.h in Headers */,
1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */,
+ F62A765D12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h in Headers */,
+ F62A766212B1ABED0005F1B6 /* WKDatabaseManager.h in Headers */,
+ F62A76B712B1B25F0005F1B6 /* WebDatabaseManagerMessages.h in Headers */,
+ F62A76B912B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3082,6 +3114,10 @@
51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */,
1AAF061512B01131008E49E2 /* PDFViewController.mm in Sources */,
1AAF0C4B12B16334008E49E2 /* ArgumentCodersCF.cpp in Sources */,
+ F62A765C12B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp in Sources */,
+ F62A766112B1ABED0005F1B6 /* WKDatabaseManager.cpp in Sources */,
+ F62A76B612B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp in Sources */,
+ F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
index fc849b9..984b9b3 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
@@ -25,7 +25,13 @@
#include "WebDatabaseManager.h"
+#include "Connection.h"
+#include "MessageID.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebDatabaseManagerProxyMessages.h"
+#include "WebProcess.h"
#include <WebCore/DatabaseTracker.h>
+#include <WebCore/SecurityOrigin.h>
using namespace WebCore;
@@ -42,4 +48,36 @@ WebDatabaseManager::WebDatabaseManager()
DatabaseTracker::initializeTracker(databaseDirectory());
}
+void WebDatabaseManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebDatabaseManagerMessage(connection, messageID, arguments);
+}
+
+void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const
+{
+ Vector<RefPtr<SecurityOrigin> > origins;
+ DatabaseTracker::tracker().origins(origins);
+
+ size_t numOrigins = origins.size();
+
+ Vector<String> identifiers(numOrigins);
+ for (size_t i = 0; i < numOrigins; ++i)
+ identifiers[i] = origins[i]->databaseIdentifier();
+ WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidGetDatabaseOrigins(identifiers, callbackID), 0);
+}
+
+void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const
+{
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
+ if (!origin)
+ return;
+
+ DatabaseTracker::tracker().deleteOrigin(origin.get());
+}
+
+void WebDatabaseManager::deleteAllDatabases() const
+{
+ DatabaseTracker::tracker().deleteAllDatabases();
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
index 86176f3..eb23601 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
@@ -26,22 +26,33 @@
#ifndef WebDatabaseManager_h
#define WebDatabaseManager_h
+#include "Arguments.h"
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+class MessageID;
+}
+
namespace WebKit {
class WebDatabaseManager : public Noncopyable {
public:
static WebDatabaseManager& shared();
- // FIXME: Add methods to get the origins for which there are databases, delete the databases
- // for an origin, and delete all the databases.
- // https://bugs.webkit.org/show_bug.cgi?id=50606
+ void getDatabaseOrigins(uint64_t callbackID) const;
+ void deleteDatabasesForOrigin(const String& originIdentifier) const;
+ void deleteAllDatabases() const;
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
private:
WebDatabaseManager();
+ void didReceiveWebDatabaseManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
String databaseDirectory() const;
};
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in
new file mode 100644
index 0000000..1aab378
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in
@@ -0,0 +1,27 @@
+# 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.
+
+messages -> WebDatabaseManager {
+ void GetDatabaseOrigins(uint64_t callbackID)
+ void DeleteDatabasesForOrigin(WTF::String originIdentifier)
+ void DeleteAllDatabases()
+}
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 3382d83..c1a8137 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -499,6 +499,11 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebDatabaseManager>()) {
+ WebDatabaseManager::shared().didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+
if (messageID.is<CoreIPC::MessageClassInjectedBundle>()) {
if (!m_injectedBundle)
return;
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index f24372f..88fcd8a 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1150,6 +1150,10 @@
>
</File>
<File
+ RelativePath="..\WebProcess\WebCoreSupport\WebDatabaseManager.messages.in"
+ >
+ </File>
+ <File
RelativePath="..\WebProcess\WebCoreSupport\WebDragClient.cpp"
>
</File>
@@ -1879,6 +1883,18 @@
>
</File>
<File
+ RelativePath="..\UIProcess\WebDatabaseManagerProxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\WebDatabaseManagerProxy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\WebDatabaseManagerProxy.messages.in"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\WebDownloadClient.cpp"
>
</File>
@@ -2057,6 +2073,10 @@
<Filter
Name="API"
>
+ <File
+ RelativePath="..\UIProcess\API\C\WKDatabaseManager.cpp"
+ >
+ </File>
<Filter
Name="C"
>
@@ -2133,6 +2153,10 @@
>
</File>
<File
+ RelativePath="..\UIProcess\API\C\WKDatabaseManager.h"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\API\C\WKDownload.cpp"
>
</File>
@@ -2727,6 +2751,22 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerMessageReceiver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerMessages.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerProxyMessageReceiver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerProxyMessages.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebContextMessageReceiver.cpp"
>
</File>
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index 4e8aca9..a638196 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -41,6 +41,7 @@ all:
xcopy /y /d "..\UIProcess\API\C\WKContextPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKCredential.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKCredentialTypes.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+ xcopy /y /d "..\UIProcess\API\C\WKDatabaseManager.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKDownload.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list