More work on UI side storage
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 22:56:20 +0000 (22:56 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 22:56:20 +0000 (22:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108700

Reviewed by Sam Weinig.

* DerivedSources.make:
Add StorageManager.messages.in.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add new overload.

* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::didReceiveMessageOnConnectionWorkQueue):
Call the right function.

(WebKit::StorageManager::createStorageArea):
(WebKit::StorageManager::destroyStorageArea):
Add stubs.

* UIProcess/Storage/StorageManager.messages.in: Added.
Add new messages files.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

* WebProcess/Storage/StorageAreaProxy.cpp:
(WebKit::StorageAreaProxy::~StorageAreaProxy):
Add another FIXME.

(WebKit::StorageAreaProxy::canAccessStorage):
(WebKit::StorageAreaProxy::incrementAccessCount):
(WebKit::StorageAreaProxy::decrementAccessCount):
Implement these.

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

Source/WebKit2/ChangeLog
Source/WebKit2/DerivedSources.make
Source/WebKit2/Platform/CoreIPC/HandleMessage.h
Source/WebKit2/UIProcess/Storage/StorageManager.cpp
Source/WebKit2/UIProcess/Storage/StorageManager.h
Source/WebKit2/UIProcess/Storage/StorageManager.messages.in [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Storage/StorageAreaProxy.cpp

index 87d8bd1..5e28368 100644 (file)
@@ -1,3 +1,40 @@
+2013-02-01  Anders Carlsson  <andersca@apple.com>
+
+        More work on UI side storage
+        https://bugs.webkit.org/show_bug.cgi?id=108700
+
+        Reviewed by Sam Weinig.
+
+        * DerivedSources.make:
+        Add StorageManager.messages.in.
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        Add new overload.
+
+        * UIProcess/Storage/StorageManager.cpp:
+        (WebKit::StorageManager::didReceiveMessageOnConnectionWorkQueue):
+        Call the right function.
+
+        (WebKit::StorageManager::createStorageArea):
+        (WebKit::StorageManager::destroyStorageArea):
+        Add stubs.
+
+        * UIProcess/Storage/StorageManager.messages.in: Added.
+        Add new messages files.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Storage/StorageAreaProxy.cpp:
+        (WebKit::StorageAreaProxy::~StorageAreaProxy):
+        Add another FIXME.
+
+        (WebKit::StorageAreaProxy::canAccessStorage):
+        (WebKit::StorageAreaProxy::incrementAccessCount):
+        (WebKit::StorageAreaProxy::decrementAccessCount):
+        Implement these.
+
 2013-02-01  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         [Gtk] [WK2] Fix build after r141619
index 2ae517f..ee1c170 100644 (file)
@@ -53,6 +53,7 @@ VPATH = \
     $(WebKit2)/UIProcess/Notifications \
     $(WebKit2)/UIProcess/Plugins \
     $(WebKit2)/UIProcess/SharedWorkers \
+    $(WebKit2)/UIProcess/Storage \
     $(WebKit2)/UIProcess/mac \
 #
 
@@ -75,6 +76,7 @@ MESSAGE_RECEIVERS = \
     PluginProxy \
     SharedWorkerProcess \
     SharedWorkerProcessProxy \
+    StorageManager \
     WebApplicationCacheManager \
     WebApplicationCacheManagerProxy \
     WebCookieManager \
index f3934c4..848abab 100644 (file)
@@ -235,6 +235,12 @@ void callMemberFunction(Connection* connection, const Arguments2<P1, P2>& args,
     (object->*function)(connection, args.argument1, args.argument2);
 }
 
+template<typename C, typename MF, typename P1, typename P2, typename P3>
+void callMemberFunction(Connection* connection, const Arguments3<P1, P2, P3>& args, C* object, MF function)
+{
+    (object->*function)(connection, args.argument1, args.argument2, args.argument3);
+}
+
 template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4>
 void callMemberFunction(Connection* connection, const Arguments4<P1, P2, P3, P4>& args, C* object, MF function)
 {
index fef5341..a5c7126 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "StorageManager.h"
 
+#include "StorageManagerMessages.h"
+
 namespace WebKit {
 
 PassRefPtr<StorageManager> StorageManager::create()
@@ -41,4 +43,18 @@ StorageManager::~StorageManager()
 {
 }
 
+void StorageManager::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+{
+    if (decoder.messageReceiverName() == Messages::StorageManager::messageReceiverName())
+        didReceiveStorageManagerMessageOnConnectionWorkQueue(connection, decoder, didHandleMessage);
+}
+
+void StorageManager::createStorageArea(CoreIPC::Connection*, uint64_t storageAreaID, uint64_t storageNamespaceID, const SecurityOriginData&)
+{
+}
+
+void StorageManager::destroyStorageArea(CoreIPC::Connection*, uint64_t storageAreaID)
+{
+}
+
 } // namespace WebKit
index df9d5ea..d283b49 100644 (file)
 #ifndef StorageManager_h
 #define StorageManager_h
 
+#include "Connection.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/ThreadSafeRefCounted.h>
 
 namespace WebKit {
+struct SecurityOriginData;
 
-class StorageManager : public ThreadSafeRefCounted<StorageManager> {
+class StorageManager : public ThreadSafeRefCounted<StorageManager>, public CoreIPC::Connection::QueueClient {
 public:
     static PassRefPtr<StorageManager> create();
     ~StorageManager();
 
 private:
     StorageManager();
+
+    // CoreIPC::Connection::QueueClient.
+    virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage) OVERRIDE;
+
+    void didReceiveStorageManagerMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+
+    // Message handlers.
+    void createStorageArea(CoreIPC::Connection*, uint64_t storageAreaID, uint64_t storageNamespaceID, const SecurityOriginData&);
+    void destroyStorageArea(CoreIPC::Connection*, uint64_t storageAreaID);
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in b/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in
new file mode 100644 (file)
index 0000000..3f77dab
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (C) 2013 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 -> StorageManager LegacyReceiver {
+    CreateStorageArea(uint64_t storageAreaID, uint64_t storageNamespaceID, WebKit::SecurityOriginData securityOriginData) DispatchOnConnectionQueue
+    DestroyStorageArea(uint64_t storageAreaID) DispatchOnConnectionQueue
+}
index 32c4cf2..4b687ee 100644 (file)
                1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */; };
                1AB16AED164B41E400290D62 /* RemoteGraphicsLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16AEB164B41E400290D62 /* RemoteGraphicsLayer.mm */; };
                1AB16AEE164B41E400290D62 /* RemoteGraphicsLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AEC164B41E400290D62 /* RemoteGraphicsLayer.h */; };
+               1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */; };
+               1AB31A9716BC688100F6DBC9 /* StorageManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */; };
                1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */; };
                1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */; };
                1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */; };
                1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeContext.h; sourceTree = "<group>"; };
                1AB16AEB164B41E400290D62 /* RemoteGraphicsLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteGraphicsLayer.mm; sourceTree = "<group>"; };
                1AB16AEC164B41E400290D62 /* RemoteGraphicsLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteGraphicsLayer.h; sourceTree = "<group>"; };
+               1AB31A9316BC65AB00F6DBC9 /* StorageManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageManager.messages.in; sourceTree = "<group>"; };
+               1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageManagerMessageReceiver.cpp; path = StorageManagerMessageReceiver.cpp; sourceTree = "<group>"; };
+               1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageManagerMessages.h; path = StorageManagerMessages.h; sourceTree = "<group>"; };
                1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxy.h; sourceTree = "<group>"; };
                1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxy.cpp; sourceTree = "<group>"; };
                1AB7D5E91288B8C000CFD08C /* DownloadProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DownloadProxy.messages.in; sourceTree = "<group>"; };
                        children = (
                                1A44B95916B73F9F00B7BBD8 /* StorageManager.cpp */,
                                1A44B95A16B73F9F00B7BBD8 /* StorageManager.h */,
+                               1AB31A9316BC65AB00F6DBC9 /* StorageManager.messages.in */,
                        );
                        path = Storage;
                        sourceTree = "<group>";
                                E1EDFDB21628AD730039ECDA /* SharedWorkerProcessMessages.h */,
                                E1EDFDB31628AD730039ECDA /* SharedWorkerProcessProxyMessageReceiver.cpp */,
                                E1EDFDB41628AD730039ECDA /* SharedWorkerProcessProxyMessages.h */,
+                               1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */,
+                               1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */,
                                512E3568130B57F000ABD19A /* WebApplicationCacheManagerMessageReceiver.cpp */,
                                512E3569130B57F000ABD19A /* WebApplicationCacheManagerMessages.h */,
                                512E35F6130B642E00ABD19A /* WebApplicationCacheManagerProxyMessageReceiver.cpp */,
                                BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */,
                                A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */,
                                1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */,
+                               1AB31A9716BC688100F6DBC9 /* StorageManagerMessages.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BC8283AC16B4BF3F00A278FE /* NetworkServiceEntryPoint.mm in Sources */,
                                BC82844D16B5081C00A278FE /* PluginServiceEntryPoint.mm in Sources */,
                                BCBECDE716B6416800047A1A /* XPCServiceEntryPoint.mm in Sources */,
+                               1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 43d3532..8c5de17 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "StorageAreaProxy.h"
 
+#include <WebCore/Frame.h>
 #include <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
@@ -44,6 +45,7 @@ StorageAreaProxy::StorageAreaProxy(StorageNamespaceProxy*, PassRefPtr<SecurityOr
 
 StorageAreaProxy::~StorageAreaProxy()
 {
+    // FIXME: Implement.
 }
 
 unsigned StorageAreaProxy::length(ExceptionCode&, Frame* sourceFrame) const
@@ -92,11 +94,9 @@ bool StorageAreaProxy::contains(const String& key, ExceptionCode&, Frame* source
     return false;
 }
 
-bool StorageAreaProxy::canAccessStorage(Frame*) const
+bool StorageAreaProxy::canAccessStorage(Frame* frame) const
 {
-    // FIXME: Implement this.
-    ASSERT_NOT_REACHED();
-    return false;
+    return frame && frame->page();
 }
 
 size_t StorageAreaProxy::memoryBytesUsedByCache() const
@@ -108,14 +108,12 @@ size_t StorageAreaProxy::memoryBytesUsedByCache() const
 
 void StorageAreaProxy::incrementAccessCount()
 {
-    // FIXME: Implement this.
-    ASSERT_NOT_REACHED();
+    // Storage access is handled in the UI process, so there's nothing to do here.
 }
 
 void StorageAreaProxy::decrementAccessCount()
 {
-    // FIXME: Implement this.
-    ASSERT_NOT_REACHED();
+    // Storage access is handled in the UI process, so there's nothing to do here.
 }
 
 void StorageAreaProxy::closeDatabaseIfIdle()