Attempt to simplify IPC message dispatching logic in WebKit2
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 21:02:35 +0000 (21:02 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 21:02:35 +0000 (21:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98097

Reviewed by Sam Weinig.

Move the Connection::MessageReceiver class to its own header file. Add a MessageReceiverMap helper class
that will be used for dispatching messages based on message class (and eventually destination ID).

Convert AuthenticationManager and WebGeolocationManager over to this new mechanism.

* CMakeLists.txt:
* GNUmakefile.list.am:
Add new files.

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::dispatchMessage):
Check with the message receiver map first before calling Connection::Client::didReceiveMessage.

* Platform/CoreIPC/Connection.h:
(CoreIPC::Connection::addMessageReceiver):
Call through to the message receiver map.

* Platform/CoreIPC/MessageID.h:
(CoreIPC::MessageID::messageClass):
Rename MessageClassReserved to MessageClassInvalid.

(MessageID):
* Platform/CoreIPC/MessageReceiver.h:
Move MessageReceiver from Connection.h to its own file.

* Platform/CoreIPC/MessageReceiverMap.cpp:
New helper class.

(CoreIPC::MessageReceiverMap::addMessageReceiver):
Add the receiver to the map of receivers.

(CoreIPC::MessageReceiverMap::dispatchMessage):
Check if we have any registered receivers for this message class.

* Platform/CoreIPC/MessageReceiverMap.h:
New file.

* Target.pri:
Add new files.

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

* WebProcess/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
* WebProcess/Authentication/AuthenticationManager.h:
(AuthenticationManager):
Register the authentication manager as a message receiver.

* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::WebGeolocationManager):
* WebProcess/Geolocation/WebGeolocationManager.h:
(WebGeolocationManager):
Register the geolocation manager as a message receiver.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage):
Remove checks for authentication manager and geolocation manager messages.

* win/WebKit2.vcproj:
Add new files.

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

17 files changed:
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.list.am
Source/WebKit2/Platform/CoreIPC/Connection.cpp
Source/WebKit2/Platform/CoreIPC/Connection.h
Source/WebKit2/Platform/CoreIPC/MessageID.h
Source/WebKit2/Platform/CoreIPC/MessageReceiver.h [new file with mode: 0644]
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp [new file with mode: 0644]
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h [new file with mode: 0644]
Source/WebKit2/Target.pri
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/win/WebKit2.vcproj

index d0096ac..119b541 100644 (file)
@@ -123,6 +123,7 @@ SET(WebKit2_SOURCES
     Platform/CoreIPC/BinarySemaphore.cpp
     Platform/CoreIPC/Connection.cpp
     Platform/CoreIPC/DataReference.cpp
+    Platform/CoreIPC/MessageReceiverMap.cpp
 
     PluginProcess/PluginControllerProxy.cpp
     PluginProcess/PluginCreationParameters.cpp
index ccaa6ac..96ffa26 100644 (file)
@@ -1,3 +1,72 @@
+2012-10-01  Anders Carlsson  <andersca@apple.com>
+
+        Attempt to simplify IPC message dispatching logic in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=98097
+
+        Reviewed by Sam Weinig.
+
+        Move the Connection::MessageReceiver class to its own header file. Add a MessageReceiverMap helper class
+        that will be used for dispatching messages based on message class (and eventually destination ID).
+
+        Convert AuthenticationManager and WebGeolocationManager over to this new mechanism.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        Add new files.
+
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::dispatchMessage):
+        Check with the message receiver map first before calling Connection::Client::didReceiveMessage.
+
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::addMessageReceiver):
+        Call through to the message receiver map.
+
+        * Platform/CoreIPC/MessageID.h:
+        (CoreIPC::MessageID::messageClass):
+        Rename MessageClassReserved to MessageClassInvalid.
+
+        (MessageID):
+        * Platform/CoreIPC/MessageReceiver.h:
+        Move MessageReceiver from Connection.h to its own file.
+
+        * Platform/CoreIPC/MessageReceiverMap.cpp:
+        New helper class.
+
+        (CoreIPC::MessageReceiverMap::addMessageReceiver):
+        Add the receiver to the map of receivers.
+
+        (CoreIPC::MessageReceiverMap::dispatchMessage):
+        Check if we have any registered receivers for this message class.
+
+        * Platform/CoreIPC/MessageReceiverMap.h:
+        New file.
+
+        * Target.pri:
+        Add new files.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::AuthenticationManager):
+        * WebProcess/Authentication/AuthenticationManager.h:
+        (AuthenticationManager):
+        Register the authentication manager as a message receiver.
+
+        * WebProcess/Geolocation/WebGeolocationManager.cpp:
+        (WebKit::WebGeolocationManager::WebGeolocationManager):
+        * WebProcess/Geolocation/WebGeolocationManager.h:
+        (WebGeolocationManager):
+        Register the geolocation manager as a message receiver.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveMessage):
+        Remove checks for authentication manager and geolocation manager messages.
+
+        * win/WebKit2.vcproj:
+        Add new files.
+
 2012-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Programs/WebKit2APITests/TestCookieManager fails
index 13c6fa7..eabae40 100644 (file)
@@ -254,6 +254,9 @@ webkit2_sources += \
        Source/WebKit2/Platform/CoreIPC/DataReference.h \
        Source/WebKit2/Platform/CoreIPC/HandleMessage.h \
        Source/WebKit2/Platform/CoreIPC/MessageID.h \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiver.h \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiverMap.h \
        Source/WebKit2/Platform/CoreIPC/MessageSender.h \
        Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp \
        Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \
@@ -1214,6 +1217,9 @@ webkit2_plugin_process_sources += \
        Source/WebKit2/Platform/CoreIPC/DataReference.h \
        Source/WebKit2/Platform/CoreIPC/HandleMessage.h \
        Source/WebKit2/Platform/CoreIPC/MessageID.h \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiver.h \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp \
+       Source.WebKit2/Platform/CoreIPC/MessageReceiverMap.h \
        Source/WebKit2/Platform/CoreIPC/MessageSender.h \
        Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp \
        Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \
index b19eb75..d34ce95 100644 (file)
@@ -668,6 +668,15 @@ void Connection::enqueueIncomingMessage(IncomingMessage& incomingMessage)
     m_clientRunLoop->dispatch(WTF::bind(&Connection::dispatchOneMessage, this));
 }
 
+void Connection::dispatchMessage(MessageID messageID, ArgumentDecoder* argumentDecoder)
+{
+    // Try the message receiver map first.
+    if (m_messageReceiverMap.dispatchMessage(this, messageID, argumentDecoder))
+        return;
+
+    m_client->didReceiveMessage(this, messageID, argumentDecoder);
+}
+
 void Connection::dispatchMessage(IncomingMessage& message)
 {
     OwnPtr<ArgumentDecoder> arguments = message.releaseArguments();
@@ -688,7 +697,7 @@ void Connection::dispatchMessage(IncomingMessage& message)
     if (message.messageID().isSync())
         dispatchSyncMessage(message.messageID(), arguments.get());
     else
-        m_client->didReceiveMessage(this, message.messageID(), arguments.get());
+        dispatchMessage(message.messageID(), arguments.get());
 
     m_didReceiveInvalidMessage |= arguments->isInvalid();
     m_inDispatchMessageCount--;
index 8850de0..8c38800 100644 (file)
@@ -31,9 +31,9 @@
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include "Arguments.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
+#include "MessageReceiverMap.h"
 #include "WorkQueue.h"
-#include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/Threading.h>
@@ -85,15 +85,6 @@ while (0)
 
 class Connection : public ThreadSafeRefCounted<Connection> {
 public:
-    class MessageReceiver {
-    public:
-        virtual void didReceiveMessage(Connection*, MessageID, ArgumentDecoder*) = 0;
-        virtual void didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, OwnPtr<ArgumentEncoder>&) { ASSERT_NOT_REACHED(); }
-
-    protected:
-        virtual ~MessageReceiver() { }
-    };
-    
     class Client : public MessageReceiver {
     public:
         virtual void didClose(Connection*) = 0;
@@ -181,6 +172,11 @@ public:
     void addQueueClient(QueueClient*);
     void removeQueueClient(QueueClient*);
 
+    void addMessageReceiver(MessageClass messageClass, MessageReceiver* messageReceiver)
+    {
+        m_messageReceiverMap.addMessageReceiver(messageClass, messageReceiver);
+    }
+
     bool open();
     void invalidate();
     void markCurrentlyDispatchedMessageAsInvalid();
@@ -279,8 +275,9 @@ private:
 
     // Called on the listener thread.
     void dispatchConnectionDidClose();
-    void dispatchMessage(IncomingMessage&);
     void dispatchOneMessage();
+    void dispatchMessage(IncomingMessage&);
+    void dispatchMessage(MessageID, ArgumentDecoder*);
     void dispatchSyncMessage(MessageID, ArgumentDecoder*);
     void didFailToSendSyncMessage();
 
@@ -311,6 +308,8 @@ private:
     Mutex m_incomingMessagesLock;
     Deque<IncomingMessage> m_incomingMessages;
 
+    MessageReceiverMap m_messageReceiverMap;
+
     // Outgoing messages.
     Mutex m_outgoingMessagesLock;
     Deque<OutgoingMessage> m_outgoingMessages;
index 22d306b..18d2d79 100644 (file)
@@ -29,7 +29,7 @@
 namespace CoreIPC {
 
 enum MessageClass {
-    MessageClassReserved = 0,
+    MessageClassInvalid = 0,
 
     // Messages sent by Core IPC.
     MessageClassCoreIPC,
@@ -180,6 +180,11 @@ public:
     bool shouldDispatchMessageWhenWaitingForSyncReply() const { return getFlags() & DispatchMessageWhenWaitingForSyncReply; }
     bool isSync() const { return getFlags() & SyncMessage; }
 
+    MessageClass messageClass() const
+    {
+        return static_cast<MessageClass>(getClass());
+    }
+
 private:
     static inline unsigned stripMostSignificantBit(unsigned value)
     {
diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiver.h b/Source/WebKit2/Platform/CoreIPC/MessageReceiver.h
new file mode 100644 (file)
index 0000000..f7b61cc
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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. 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 MessageReceiver_h
+#define MessageReceiver_h
+
+#include "MessageID.h"
+#include <wtf/Assertions.h>
+#include <wtf/OwnPtr.h>
+
+namespace CoreIPC {
+
+class ArgumentDecoder;
+class ArgumentEncoder;
+class Connection;
+
+class MessageReceiver {
+public:
+    virtual ~MessageReceiver() { }
+
+    virtual void didReceiveMessage(Connection*, MessageID, ArgumentDecoder*) = 0;
+    virtual void didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, OwnPtr<ArgumentEncoder>&)
+    {
+        ASSERT_NOT_REACHED();
+    }
+};
+
+} // namespace CoreIPC
+
+#endif // MessageReceiver_h
diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp
new file mode 100644 (file)
index 0000000..5ce77dc
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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. 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 "config.h"
+#include "MessageReceiverMap.h"
+
+#include "MessageReceiver.h"
+
+namespace CoreIPC {
+
+MessageReceiverMap::MessageReceiverMap()
+{
+}
+
+MessageReceiverMap::~MessageReceiverMap()
+{
+}
+
+void MessageReceiverMap::addMessageReceiver(MessageClass messageClass, MessageReceiver* messageReceiver)
+{
+    ASSERT(!m_globalMessageReceiverMap.contains(messageClass));
+    m_globalMessageReceiverMap.set(messageClass, messageReceiver);
+}
+
+bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messageID, ArgumentDecoder* argumentDecoder)
+{
+    if (MessageReceiver* messageReceiver = m_globalMessageReceiverMap.get(messageID.messageClass())) {
+        messageReceiver->didReceiveMessage(connection, messageID, argumentDecoder);
+        return true;
+    }
+
+    return false;
+}
+
+} // namespace CoreIPC
diff --git a/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h b/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h
new file mode 100644 (file)
index 0000000..77fe4cd
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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. 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 MessageReceiverMap_h
+#define MessageReceiverMap_h
+
+#include "MessageID.h"
+#include <wtf/HashMap.h>
+
+namespace CoreIPC {
+
+class ArgumentDecoder;
+class Connection;
+class MessageReceiver;
+
+class MessageReceiverMap {
+public:
+    MessageReceiverMap();
+    ~MessageReceiverMap();
+
+    void addMessageReceiver(MessageClass, MessageReceiver*);
+
+    bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+    // Message receivers that don't require a destination ID.
+    HashMap<unsigned, MessageReceiver*> m_globalMessageReceiverMap;
+};
+
+};
+
+#endif // MessageReceiverMap_h
index 15fa0b1..4f39307 100644 (file)
@@ -26,6 +26,8 @@ HEADERS += \
     Platform/CoreIPC/DataReference.h \
     Platform/CoreIPC/HandleMessage.h \
     Platform/CoreIPC/MessageID.h \
+    Platform/CoreIPC/MessageReceiver.h \
+    Platform/CoreIPC/MessageReceiverMap.h \
     Platform/CoreIPC/MessageSender.h \
     Platform/Logging.h \
     Platform/Module.h \
@@ -382,6 +384,7 @@ SOURCES += \
     Platform/CoreIPC/Attachment.cpp \
     Platform/CoreIPC/Connection.cpp \
     Platform/CoreIPC/DataReference.cpp \
+    Platform/CoreIPC/MessageReceiverMap.cpp \
     Platform/Logging.cpp \
     Platform/Module.cpp \
     Platform/WorkQueue.cpp \
index 44fa970..d329b30 100644 (file)
                1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD205125E5A2F004515E6 /* APIClient.h */; };
                1A3E736111CC2659007BD539 /* WebPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */; };
                1A3E736211CC2659007BD539 /* WebPlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */; };
+               1A3EED0E161A535400AEB4F5 /* MessageReceiverMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3EED0C161A535300AEB4F5 /* MessageReceiverMap.cpp */; };
+               1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */; };
+               1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */; };
                1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A433F0C113C53DD00FACDE9 /* WebErrors.h */; };
                1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */; };
                1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */; };
                1A3DD205125E5A2F004515E6 /* APIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = "<group>"; };
                1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlatformStrategies.h; sourceTree = "<group>"; };
                1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformStrategies.cpp; sourceTree = "<group>"; };
+               1A3EED0C161A535300AEB4F5 /* MessageReceiverMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageReceiverMap.cpp; sourceTree = "<group>"; };
+               1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageReceiverMap.h; sourceTree = "<group>"; };
+               1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageReceiver.h; sourceTree = "<group>"; };
                1A433F0C113C53DD00FACDE9 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
                1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextInputWindowController.h; sourceTree = "<group>"; };
                1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; };
                                1A8EFDF91253CAA200F7067F /* DataReference.h */,
                                C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */,
                                BC032DA410F437D10058C15A /* MessageID.h */,
+                               1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */,
+                               1A3EED0C161A535300AEB4F5 /* MessageReceiverMap.cpp */,
+                               1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */,
                                1A119A94127B796200A9ECB1 /* MessageSender.h */,
                        );
                        path = CoreIPC;
                                BC59548915C7868500FD1E3E /* WebKit2.h in Headers */,
                                BCDC308815FD6A8B006B6695 /* WebProcessInitialization.h in Headers */,
                                BCDC308C15FD6CD1006B6695 /* WebProcessServiceEntryPoints.h in Headers */,
+                               1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */,
+                               1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */,
                                BCDC308715FD6A8B006B6695 /* WebProcessInitialization.mm in Sources */,
                                BCDC308B15FD6CD1006B6695 /* WebProcessServiceEntryPoints.mm in Sources */,
+                               1A3EED0E161A535400AEB4F5 /* MessageReceiverMap.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 44e8306..a6858ac 100644 (file)
@@ -55,6 +55,7 @@ AuthenticationManager& AuthenticationManager::shared()
 
 AuthenticationManager::AuthenticationManager()
 {
+    WebProcess::shared().connection()->addMessageReceiver(CoreIPC::MessageClassAuthenticationManager, this);
 }
 
 void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
index 192c91a..9186d42 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef AuthenticationManager_h
 #define AuthenticationManager_h
 
+#include "MessageReceiver.h"
 #include <wtf/HashMap.h>
 
 namespace CoreIPC {
@@ -45,14 +46,12 @@ class Download;
 class PlatformCertificateInfo;
 class WebFrame;
 
-class AuthenticationManager {
+class AuthenticationManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(AuthenticationManager);
 
 public:
     static AuthenticationManager& shared();
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
     void didReceiveAuthenticationChallenge(Download*, const WebCore::AuthenticationChallenge&);
 
@@ -63,6 +62,9 @@ public:
 private:
     AuthenticationManager();
 
+    // MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+
     void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
index f07c406..2b75b04 100644 (file)
@@ -42,6 +42,7 @@ namespace WebKit {
 WebGeolocationManager::WebGeolocationManager(WebProcess* process)
     : m_process(process)
 {
+    WebProcess::shared().connection()->addMessageReceiver(CoreIPC::MessageClassWebGeolocationManager, this);
 }
 
 WebGeolocationManager::~WebGeolocationManager()
index 5c3dfae..eeb9a29 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef WebGeolocationManager_h
 #define WebGeolocationManager_h
 
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebGeolocationPosition.h"
 #include <wtf/HashSet.h>
 #include <wtf/HashMap.h>
@@ -50,7 +50,7 @@ namespace WebKit {
 class WebProcess;
 class WebPage;
 
-class WebGeolocationManager {
+class WebGeolocationManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebGeolocationManager);
 public:
     explicit WebGeolocationManager(WebProcess*);
@@ -61,9 +61,11 @@ public:
 
     void requestPermission(WebCore::Geolocation*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
 private:
+    // MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+
     // Implemented in generated WebGeolocationManagerMessageReceiver.cpp
     void didReceiveWebGeolocationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
index de18324..0061388 100644 (file)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "WebProcess.h"
 
-#include "AuthenticationManager.h"
 #include "DownloadManager.h"
 #include "InjectedBundle.h"
 #include "InjectedBundleMessageKinds.h"
@@ -638,11 +637,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
         return;
     }
 
-    if (messageID.is<CoreIPC::MessageClassAuthenticationManager>()) {
-        AuthenticationManager::shared().didReceiveMessage(connection, messageID, arguments);
-        return;
-    }
-
     if (messageID.is<CoreIPC::MessageClassWebApplicationCacheManager>()) {
         WebApplicationCacheManager::shared().didReceiveMessage(connection, messageID, arguments);
         return;
@@ -660,11 +654,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
     }
 #endif
 
-    if (messageID.is<CoreIPC::MessageClassWebGeolocationManager>()) {
-        m_geolocationManager.didReceiveMessage(connection, messageID, arguments);
-        return;
-    }
-
 #if ENABLE(BATTERY_STATUS)
     if (messageID.is<CoreIPC::MessageClassWebBatteryManager>()) {
         m_batteryManager.didReceiveMessage(connection, messageID, arguments);
index f1b0f65..bd09e08 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\Platform\CoreIPC\MessageReceiver.h"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\Platform\CoreIPC\MessageReceiverMap.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\Platform\CoreIPC\MessageReceiverMap.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\Platform\CoreIPC\MessageSender.h"
                                        >
                                </File>