Make all of the WebContext sub objects MessageReceivers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2012 19:06:58 +0000 (19:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2012 19:06:58 +0000 (19:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98661

Patch by Sam Weinig <sam@webkit.org> on 2012-10-10
Reviewed by Anders Carlsson.

Start work towards simplified message dispatch.

* Platform/CoreIPC/MessageReceiverMap.cpp:
(CoreIPC::MessageReceiverMap::clearAllMessageReceivers):
(CoreIPC::MessageReceiverMap::knowsHowToHandleMessage):
(CoreIPC::MessageReceiverMap::dispatchSyncMessage):
* Platform/CoreIPC/MessageReceiverMap.h:
Add additional helper methods.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::~WebContext):
(WebKit::WebContext::addMessageReceiver):
(WebKit::WebContext::knowsHowToHandleMessage):
(WebKit::WebContext::didReceiveMessage):
(WebKit::WebContext::didReceiveSyncMessage):
* UIProcess/WebContext.h:
Add a MessageReceiverMap that chains to the main on in WebProcessProxy. Simplifies
didReceiveMessage and didReceiveSyncMessage.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveMessage):
(WebKit::WebProcessProxy::didReceiveSyncMessage):
Use the new WebContext methods to simplify dispatch.

* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
* UIProcess/Notifications/WebNotificationManagerProxy.h:
(WebNotificationManagerProxy):
* UIProcess/WebApplicationCacheManagerProxy.cpp:
(WebKit::WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy):
* UIProcess/WebApplicationCacheManagerProxy.h:
(WebApplicationCacheManagerProxy):
* UIProcess/WebBatteryManagerProxy.cpp:
(WebKit::WebBatteryManagerProxy::WebBatteryManagerProxy):
* UIProcess/WebBatteryManagerProxy.h:
(WebBatteryManagerProxy):
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::WebCookieManagerProxy):
* UIProcess/WebCookieManagerProxy.h:
(WebCookieManagerProxy):
* UIProcess/WebDatabaseManagerProxy.cpp:
(WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy):
(WebKit::WebDatabaseManagerProxy::didReceiveMessage):
(WebKit):
* UIProcess/WebDatabaseManagerProxy.h:
(WebDatabaseManagerProxy):
* UIProcess/WebGeolocationManagerProxy.cpp:
(WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy):
* UIProcess/WebGeolocationManagerProxy.h:
(WebGeolocationManagerProxy):
* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::WebIconDatabase):
* UIProcess/WebIconDatabase.h:
(WebIconDatabase):
(WebKit::WebIconDatabase::type):
* UIProcess/WebKeyValueStorageManagerProxy.cpp:
(WebKit::WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy):
* UIProcess/WebKeyValueStorageManagerProxy.h:
(WebKeyValueStorageManagerProxy):
* UIProcess/WebMediaCacheManagerProxy.cpp:
(WebKit::WebMediaCacheManagerProxy::WebMediaCacheManagerProxy):
* UIProcess/WebMediaCacheManagerProxy.h:
(WebMediaCacheManagerProxy):
* UIProcess/WebNetworkInfoManagerProxy.cpp:
(WebKit::WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy):
(WebKit::WebNetworkInfoManagerProxy::didReceiveSyncMessage):
* UIProcess/WebNetworkInfoManagerProxy.h:
(WebNetworkInfoManagerProxy):
* UIProcess/WebResourceCacheManagerProxy.cpp:
(WebKit::WebResourceCacheManagerProxy::WebResourceCacheManagerProxy):
(WebKit::WebResourceCacheManagerProxy::didReceiveMessage):
(WebKit):
* UIProcess/WebResourceCacheManagerProxy.h:
(WebResourceCacheManagerProxy):
* UIProcess/WebVibrationProxy.cpp:
(WebKit::WebVibrationProxy::WebVibrationProxy):
* UIProcess/WebVibrationProxy.h:
(WebVibrationProxy):
* UIProcess/soup/WebSoupRequestManagerProxy.cpp:
(WebKit::WebSoupRequestManagerProxy::WebSoupRequestManagerProxy):
(WebKit::WebSoupRequestManagerProxy::didReceiveMessage):
(WebKit):
* UIProcess/soup/WebSoupRequestManagerProxy.h:
(WebSoupRequestManagerProxy):
* WebProcess/Authentication/AuthenticationManager.h:
(AuthenticationManager):
* WebProcess/Geolocation/WebGeolocationManager.h:
(WebGeolocationManager):
Make all the WebContext sub-objects MessageReceivers to simplify dispatch.

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

34 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h
Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp
Source/WebKit2/UIProcess/WebBatteryManagerProxy.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit2/UIProcess/WebCookieManagerProxy.h
Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h
Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h
Source/WebKit2/UIProcess/WebIconDatabase.cpp
Source/WebKit2/UIProcess/WebIconDatabase.h
Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h
Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
Source/WebKit2/UIProcess/WebVibrationProxy.cpp
Source/WebKit2/UIProcess/WebVibrationProxy.h
Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp
Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h

index 0448677..7b4ca2b 100644 (file)
@@ -1,3 +1,100 @@
+2012-10-10  Sam Weinig  <sam@webkit.org>
+
+        Make all of the WebContext sub objects MessageReceivers
+        https://bugs.webkit.org/show_bug.cgi?id=98661
+
+        Reviewed by Anders Carlsson.
+
+        Start work towards simplified message dispatch.
+
+        * Platform/CoreIPC/MessageReceiverMap.cpp:
+        (CoreIPC::MessageReceiverMap::clearAllMessageReceivers):
+        (CoreIPC::MessageReceiverMap::knowsHowToHandleMessage):
+        (CoreIPC::MessageReceiverMap::dispatchSyncMessage):
+        * Platform/CoreIPC/MessageReceiverMap.h:
+        Add additional helper methods.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::~WebContext):
+        (WebKit::WebContext::addMessageReceiver):
+        (WebKit::WebContext::knowsHowToHandleMessage):
+        (WebKit::WebContext::didReceiveMessage):
+        (WebKit::WebContext::didReceiveSyncMessage):
+        * UIProcess/WebContext.h:
+        Add a MessageReceiverMap that chains to the main on in WebProcessProxy. Simplifies
+        didReceiveMessage and didReceiveSyncMessage.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveMessage):
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+        Use the new WebContext methods to simplify dispatch.
+
+        * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+        (WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
+        * UIProcess/Notifications/WebNotificationManagerProxy.h:
+        (WebNotificationManagerProxy):
+        * UIProcess/WebApplicationCacheManagerProxy.cpp:
+        (WebKit::WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy):
+        * UIProcess/WebApplicationCacheManagerProxy.h:
+        (WebApplicationCacheManagerProxy):
+        * UIProcess/WebBatteryManagerProxy.cpp:
+        (WebKit::WebBatteryManagerProxy::WebBatteryManagerProxy):
+        * UIProcess/WebBatteryManagerProxy.h:
+        (WebBatteryManagerProxy):
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::WebCookieManagerProxy):
+        * UIProcess/WebCookieManagerProxy.h:
+        (WebCookieManagerProxy):
+        * UIProcess/WebDatabaseManagerProxy.cpp:
+        (WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy):
+        (WebKit::WebDatabaseManagerProxy::didReceiveMessage):
+        (WebKit):
+        * UIProcess/WebDatabaseManagerProxy.h:
+        (WebDatabaseManagerProxy):
+        * UIProcess/WebGeolocationManagerProxy.cpp:
+        (WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy):
+        * UIProcess/WebGeolocationManagerProxy.h:
+        (WebGeolocationManagerProxy):
+        * UIProcess/WebIconDatabase.cpp:
+        (WebKit::WebIconDatabase::WebIconDatabase):
+        * UIProcess/WebIconDatabase.h:
+        (WebIconDatabase):
+        (WebKit::WebIconDatabase::type):
+        * UIProcess/WebKeyValueStorageManagerProxy.cpp:
+        (WebKit::WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy):
+        * UIProcess/WebKeyValueStorageManagerProxy.h:
+        (WebKeyValueStorageManagerProxy):
+        * UIProcess/WebMediaCacheManagerProxy.cpp:
+        (WebKit::WebMediaCacheManagerProxy::WebMediaCacheManagerProxy):
+        * UIProcess/WebMediaCacheManagerProxy.h:
+        (WebMediaCacheManagerProxy):
+        * UIProcess/WebNetworkInfoManagerProxy.cpp:
+        (WebKit::WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy):
+        (WebKit::WebNetworkInfoManagerProxy::didReceiveSyncMessage):
+        * UIProcess/WebNetworkInfoManagerProxy.h:
+        (WebNetworkInfoManagerProxy):
+        * UIProcess/WebResourceCacheManagerProxy.cpp:
+        (WebKit::WebResourceCacheManagerProxy::WebResourceCacheManagerProxy):
+        (WebKit::WebResourceCacheManagerProxy::didReceiveMessage):
+        (WebKit):
+        * UIProcess/WebResourceCacheManagerProxy.h:
+        (WebResourceCacheManagerProxy):
+        * UIProcess/WebVibrationProxy.cpp:
+        (WebKit::WebVibrationProxy::WebVibrationProxy):
+        * UIProcess/WebVibrationProxy.h:
+        (WebVibrationProxy):
+        * UIProcess/soup/WebSoupRequestManagerProxy.cpp:
+        (WebKit::WebSoupRequestManagerProxy::WebSoupRequestManagerProxy):
+        (WebKit::WebSoupRequestManagerProxy::didReceiveMessage):
+        (WebKit):
+        * UIProcess/soup/WebSoupRequestManagerProxy.h:
+        (WebSoupRequestManagerProxy):
+        * WebProcess/Authentication/AuthenticationManager.h:
+        (AuthenticationManager):
+        * WebProcess/Geolocation/WebGeolocationManager.h:
+        (WebGeolocationManager):
+        Make all the WebContext sub-objects MessageReceivers to simplify dispatch.
+
 2012-10-10  Simon Fraser  <simon.fraser@apple.com>
 
         Add the mangled symbol name for Frame::layerTreeAsText() to the confusingly named
index 5ce77dc..2ea3e55 100644 (file)
@@ -44,6 +44,16 @@ void MessageReceiverMap::addMessageReceiver(MessageClass messageClass, MessageRe
     m_globalMessageReceiverMap.set(messageClass, messageReceiver);
 }
 
+void MessageReceiverMap::clearAllMessageReceivers()
+{
+    m_globalMessageReceiverMap.clear();
+}
+
+bool MessageReceiverMap::knowsHowToHandleMessage(MessageID messageID) const
+{
+    return m_globalMessageReceiverMap.contains(messageID.messageClass());
+}
+
 bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messageID, ArgumentDecoder* argumentDecoder)
 {
     if (MessageReceiver* messageReceiver = m_globalMessageReceiverMap.get(messageID.messageClass())) {
@@ -54,4 +64,14 @@ bool MessageReceiverMap::dispatchMessage(Connection* connection, MessageID messa
     return false;
 }
 
+bool MessageReceiverMap::dispatchSyncMessage(Connection* connection, MessageID messageID, ArgumentDecoder* argumentDecoder, OwnPtr<ArgumentEncoder>& reply)
+{
+    if (MessageReceiver* messageReceiver = m_globalMessageReceiverMap.get(messageID.messageClass())) {
+        messageReceiver->didReceiveSyncMessage(connection, messageID, argumentDecoder, reply);
+        return true;
+    }
+
+    return false;
+}
+
 } // namespace CoreIPC
index 77fe4cd..e739132 100644 (file)
 #define MessageReceiverMap_h
 
 #include "MessageID.h"
+#include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 
 namespace CoreIPC {
 
+class ArgumentEncoder;
 class ArgumentDecoder;
 class Connection;
 class MessageReceiver;
@@ -41,8 +43,11 @@ public:
     ~MessageReceiverMap();
 
     void addMessageReceiver(MessageClass, MessageReceiver*);
+    void clearAllMessageReceivers();
+    bool knowsHowToHandleMessage(MessageID) const;
 
-    bool dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+    bool dispatchMessage(Connection*, MessageID, ArgumentDecoder*);
+    bool dispatchSyncMessage(Connection*, MessageID, ArgumentDecoder*, OwnPtr<ArgumentEncoder>&);
 
 private:
     // Message receivers that don't require a destination ID.
index 88e2cf1..07e1f84 100644 (file)
@@ -47,6 +47,7 @@ PassRefPtr<WebNotificationManagerProxy> WebNotificationManagerProxy::create(WebC
 WebNotificationManagerProxy::WebNotificationManagerProxy(WebContext* context)
     : m_context(context)
 {
+    m_context->addMessageReceiver(CoreIPC::MessageClassWebNotificationManagerProxy, this);
 }
 
 void WebNotificationManagerProxy::invalidate()
index d61b6f6..620915d 100644 (file)
@@ -27,7 +27,7 @@
 #define WebNotificationManagerProxy_h
 
 #include "APIObject.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebNotificationProvider.h"
 #include <WebCore/NotificationClient.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class ArgumentEncoder;
-class Connection;
-}
-
 namespace WebKit {
 
 class ImmutableArray;
@@ -48,7 +42,7 @@ class WebContext;
 class WebPageProxy;
 class WebSecurityOrigin;
 
-class WebNotificationManagerProxy : public APIObject {
+class WebNotificationManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeNotificationManager;
     
@@ -68,13 +62,13 @@ public:
     void providerDidUpdateNotificationPolicy(const WebSecurityOrigin*, bool allowed);
     void providerDidRemoveNotificationPolicies(ImmutableArray* origins);
     
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
 private:
     explicit WebNotificationManagerProxy(WebContext*);
     
     virtual Type type() const { return APIType; }
-    
+
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebNotificationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     
     // Message handlers
index f43c819..4fc41ba 100644 (file)
@@ -41,6 +41,7 @@ PassRefPtr<WebApplicationCacheManagerProxy> WebApplicationCacheManagerProxy::cre
 WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy(WebContext* context)
     : m_webContext(context)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebApplicationCacheManagerProxy, this);
 }
 
 WebApplicationCacheManagerProxy::~WebApplicationCacheManagerProxy()
index 597f8d7..4646218 100644 (file)
@@ -29,7 +29,7 @@
 #include "APIObject.h"
 #include "GenericCallback.h"
 #include "ImmutableArray.h"
-
+#include "MessageReceiver.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
@@ -49,7 +49,7 @@ class WebSecurityOrigin;
 
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 
-class WebApplicationCacheManagerProxy : public APIObject {
+class WebApplicationCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeApplicationCacheManager;
 
@@ -63,8 +63,6 @@ public:
     void deleteEntriesForOrigin(WebSecurityOrigin*);
     void deleteAllEntries();
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -73,7 +71,9 @@ private:
     virtual Type type() const { return APIType; }
 
     void didGetApplicationCacheOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
-    
+
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebApplicationCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     WebContext* m_webContext;
index c3897e8..b42b7b0 100644 (file)
@@ -42,6 +42,7 @@ WebBatteryManagerProxy::WebBatteryManagerProxy(WebContext* context)
     : m_isUpdating(false)
     , m_context(context)
 {
+    m_context->addMessageReceiver(CoreIPC::MessageClassWebBatteryManagerProxy, this);
 }
 
 WebBatteryManagerProxy::~WebBatteryManagerProxy()
index 9fa5bdc..65c6614 100644 (file)
 #if ENABLE(BATTERY_STATUS)
 
 #include "APIObject.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebBatteryProvider.h"
 #include <wtf/Forward.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-}
-
 namespace WebKit {
 
 class WebContext;
 class WebBatteryStatus;
+class WebBatteryManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 
-class WebBatteryManagerProxy : public APIObject {
 public:
     static const Type APIType = TypeBatteryManager;
 
@@ -58,13 +53,14 @@ public:
     void providerDidChangeBatteryStatus(const WTF::AtomicString&, WebBatteryStatus*);
     void providerUpdateBatteryStatus(WebBatteryStatus*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
 private:
     explicit WebBatteryManagerProxy(WebContext*);
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+
     // Implemented in generated WebBatteryManagerProxyMessageReceiver.cpp
     void didReceiveWebBatteryManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
index fe04411..32a5248 100644 (file)
@@ -121,36 +121,39 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
     , m_cacheModel(CacheModelDocumentViewer)
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
-    , m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this))
+#if PLATFORM(WIN)
+    , m_shouldPaintNativeControls(true)
+    , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways)
+#endif
+    , m_processTerminationEnabled(true)
+{
+    
+    // NOTE: These sub-objects must be initialized after m_messageReceiverMap..
+    m_applicationCacheManagerProxy = WebApplicationCacheManagerProxy::create(this);
 #if ENABLE(BATTERY_STATUS)
-    , m_batteryManagerProxy(WebBatteryManagerProxy::create(this))
+    m_batteryManagerProxy = WebBatteryManagerProxy::create(this);
 #endif
-    , m_cookieManagerProxy(WebCookieManagerProxy::create(this))
+    m_cookieManagerProxy = WebCookieManagerProxy::create(this);
 #if ENABLE(SQL_DATABASE)
-    , m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
+    m_databaseManagerProxy = WebDatabaseManagerProxy::create(this);
 #endif
-    , m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this))
-    , m_iconDatabase(WebIconDatabase::create(this))
-    , m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this))
-    , m_mediaCacheManagerProxy(WebMediaCacheManagerProxy::create(this))
+    m_geolocationManagerProxy = WebGeolocationManagerProxy::create(this);
+    m_iconDatabase = WebIconDatabase::create(this);
+    m_keyValueStorageManagerProxy = WebKeyValueStorageManagerProxy::create(this);
+    m_mediaCacheManagerProxy = WebMediaCacheManagerProxy::create(this);
 #if ENABLE(NETWORK_INFO)
-    , m_networkInfoManagerProxy(WebNetworkInfoManagerProxy::create(this))
+    m_networkInfoManagerProxy = WebNetworkInfoManagerProxy::create(this);
 #endif
-    , m_notificationManagerProxy(WebNotificationManagerProxy::create(this))
-    , m_pluginSiteDataManager(WebPluginSiteDataManager::create(this))
-    , m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this))
+    m_notificationManagerProxy = WebNotificationManagerProxy::create(this);
+    m_pluginSiteDataManager = WebPluginSiteDataManager::create(this);
+    m_resourceCacheManagerProxy = WebResourceCacheManagerProxy::create(this);
 #if USE(SOUP)
-    , m_soupRequestManagerProxy(WebSoupRequestManagerProxy::create(this))
+    m_soupRequestManagerProxy = WebSoupRequestManagerProxy::create(this);
 #endif
 #if ENABLE(VIBRATION)
-    , m_vibrationProxy(WebVibrationProxy::create(this))
-#endif
-#if PLATFORM(WIN)
-    , m_shouldPaintNativeControls(true)
-    , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways)
+    m_vibrationProxy = WebVibrationProxy::create(this);
 #endif
-    , m_processTerminationEnabled(true)
-{
+    
 #if !LOG_DISABLED
     WebKit::initializeLogChannelsIfNecessary();
 #endif
@@ -175,6 +178,8 @@ WebContext::~WebContext()
 
     removeLanguageChangeObserver(this);
 
+    m_messageReceiverMap.clearAllMessageReceivers();
+
     m_applicationCacheManagerProxy->invalidate();
     m_applicationCacheManagerProxy->clearContext();
 
@@ -728,8 +733,26 @@ HashSet<String, CaseFoldingHash> WebContext::pdfAndPostScriptMIMETypes()
     return mimeTypes;
 }
 
+void WebContext::addMessageReceiver(CoreIPC::MessageClass messageClass, CoreIPC::MessageReceiver* messageReceiver)
+{
+    m_messageReceiverMap.addMessageReceiver(messageClass, messageReceiver);
+}
+
+bool WebContext::knowsHowToHandleMessage(CoreIPC::MessageID messageID) const
+{
+    if (m_messageReceiverMap.knowsHowToHandleMessage(messageID))
+        return true;
+
+    return messageID.is<CoreIPC::MessageClassWebContext>()
+        || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
+        || messageID.is<CoreIPC::MessageClassDownloadProxy>();
+}
+
 void WebContext::didReceiveMessage(WebProcessProxy* process, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
+    if (m_messageReceiverMap.dispatchMessage(process->connection(), messageID, arguments))
+        return;
+
     if (messageID.is<CoreIPC::MessageClassWebContext>()) {
         didReceiveWebContextMessage(process->connection(), messageID, arguments);
         return;
@@ -742,81 +765,6 @@ void WebContext::didReceiveMessage(WebProcessProxy* process, CoreIPC::MessageID
         return;
     }
 
-    if (messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()) {
-        m_applicationCacheManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-#if ENABLE(BATTERY_STATUS)
-    if (messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()) {
-        m_batteryManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-#endif
-
-    if (messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()) {
-        m_cookieManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-#if ENABLE(SQL_DATABASE)
-    if (messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) {
-        m_databaseManagerProxy->didReceiveWebDatabaseManagerProxyMessage(process->connection(), messageID, arguments);
-        return;
-    }
-#endif
-
-    if (messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()) {
-        m_geolocationManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-    
-    if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
-        m_iconDatabase->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-    if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()) {
-        m_keyValueStorageManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-    if (messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()) {
-        m_mediaCacheManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-#if ENABLE(NETWORK_INFO)
-    if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) {
-        m_networkInfoManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-#endif
-    
-    if (messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()) {
-        m_notificationManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-    if (messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
-        m_resourceCacheManagerProxy->didReceiveWebResourceCacheManagerProxyMessage(process->connection(), messageID, arguments);
-        return;
-    }
-
-#if USE(SOUP)
-    if (messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>()) {
-        m_soupRequestManagerProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-#endif
-
-#if ENABLE(VIBRATION)
-    if (messageID.is<CoreIPC::MessageClassWebVibrationProxy>()) {
-        m_vibrationProxy->didReceiveMessage(process->connection(), messageID, arguments);
-        return;
-    }
-#endif
-
     switch (messageID.get<WebContextLegacyMessage::Kind>()) {
         case WebContextLegacyMessage::PostMessage: {
             String messageName;
@@ -837,6 +785,9 @@ void WebContext::didReceiveMessage(WebProcessProxy* process, CoreIPC::MessageID
 
 void WebContext::didReceiveSyncMessage(WebProcessProxy* process, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
 {
+    if (m_messageReceiverMap.dispatchSyncMessage(process->connection(), messageID, arguments, reply))
+        return;
+
     if (messageID.is<CoreIPC::MessageClassWebContext>()) {
         didReceiveSyncWebContextMessage(process->connection(), messageID, arguments, reply);
         return;
@@ -848,18 +799,6 @@ void WebContext::didReceiveSyncMessage(WebProcessProxy* process, CoreIPC::Messag
         return;
     }
 
-    if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
-        m_iconDatabase->didReceiveSyncMessage(process->connection(), messageID, arguments, reply);
-        return;
-    }
-
-#if ENABLE(NETWORK_INFO)
-    if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()) {
-        m_networkInfoManagerProxy->didReceiveSyncMessage(process->connection(), messageID, arguments, reply);
-        return;
-    }
-#endif
-    
     switch (messageID.get<WebContextLegacyMessage::Kind>()) {
         case WebContextLegacyMessage::PostSynchronousMessage: {
             // FIXME: We should probably encode something in the case that the arguments do not decode correctly.
index ad1fff9..3957876 100644 (file)
 
 #include "APIObject.h"
 #include "GenericCallback.h"
+#include "MessageReceiver.h"
+#include "MessageReceiverMap.h"
 #include "PluginInfoStore.h"
 #include "ProcessModel.h"
 #include "VisitedLinkProvider.h"
-#include "WebContextInjectedBundleClient.h"
 #include "WebContextConnectionClient.h"
+#include "WebContextInjectedBundleClient.h"
 #include "WebDownloadClient.h"
 #include "WebHistoryClient.h"
 #include "WebProcessProxy.h"
@@ -84,6 +86,9 @@ public:
 
     static const Vector<WebContext*>& allContexts();
 
+    void addMessageReceiver(CoreIPC::MessageClass, CoreIPC::MessageReceiver*);
+    bool knowsHowToHandleMessage(CoreIPC::MessageID) const;
+
     void initializeInjectedBundleClient(const WKContextInjectedBundleClient*);
     void initializeConnectionClient(const WKContextConnectionClient*);
     void initializeHistoryClient(const WKContextHistoryClient*);
@@ -360,6 +365,8 @@ private:
     bool m_processTerminationEnabled;
     
     HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks;
+
+    CoreIPC::MessageReceiverMap m_messageReceiverMap;
 };
 
 template<typename U> inline void WebContext::sendToAllProcesses(const U& message)
index cc9b23e..aa33ce6 100644 (file)
@@ -41,6 +41,7 @@ PassRefPtr<WebCookieManagerProxy> WebCookieManagerProxy::create(WebContext* cont
 WebCookieManagerProxy::WebCookieManagerProxy(WebContext* context)
     : m_webContext(context)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebCookieManagerProxy, this);
 }
 
 WebCookieManagerProxy::~WebCookieManagerProxy()
index cf1c15b..6981c0d 100644 (file)
@@ -29,6 +29,7 @@
 #include "APIObject.h"
 #include "GenericCallback.h"
 #include "ImmutableArray.h"
+#include "MessageReceiver.h"
 #include "WebCookieManagerProxyClient.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -48,7 +49,7 @@ class WebProcessProxy;
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 typedef GenericCallback<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy> HTTPCookieAcceptPolicyCallback;
 
-class WebCookieManagerProxy : public APIObject {
+class WebCookieManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeCookieManager;
 
@@ -74,8 +75,6 @@ public:
     void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
 #endif
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -88,6 +87,8 @@ private:
 
     void cookiesDidChange();
     
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebCookieManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
 #if PLATFORM(MAC)
index b4331d4..a3fda65 100644 (file)
@@ -94,6 +94,7 @@ PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext*
 WebDatabaseManagerProxy::WebDatabaseManagerProxy(WebContext* webContext)
     : m_webContext(webContext)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebDatabaseManagerProxy, this);
 }
 
 WebDatabaseManagerProxy::~WebDatabaseManagerProxy()
@@ -231,6 +232,11 @@ void WebDatabaseManagerProxy::didModifyDatabase(const String& originIdentifier,
     m_client.didModifyDatabase(this, origin.get(), databaseIdentifier);
 }
 
+void WebDatabaseManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+    didReceiveWebDatabaseManagerProxyMessage(connection, messageID, arguments);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(SQL_DATABASE)
index fe920bb..b724a84 100644 (file)
 #include "APIObject.h"
 #include "Arguments.h"
 #include "GenericCallback.h"
+#include "MessageReceiver.h"
 #include "OriginAndDatabases.h"
 #include "WebDatabaseManagerProxyClient.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-class MessageID;
-}
-
 namespace WebKit {
 
 class WebContext;
@@ -50,7 +45,7 @@ class WebSecurityOrigin;
 
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 
-class WebDatabaseManagerProxy : public APIObject {
+class WebDatabaseManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeDatabaseManager;
 
@@ -78,8 +73,6 @@ public:
     static String databaseDetailsExpectedUsageKey();
     static String databaseDetailsCurrentUsageKey();
 
-    void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -87,6 +80,10 @@ private:
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+    void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
     // Message handlers.
     void didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabases, uint64_t callbackID);
     void didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID);
index af49f9b..e20d1ee 100644 (file)
@@ -40,6 +40,7 @@ WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context)
     : m_isUpdating(false)
     , m_context(context)
 {
+    m_context->addMessageReceiver(CoreIPC::MessageClassWebGeolocationManagerProxy, this);
 }
 
 WebGeolocationManagerProxy::~WebGeolocationManagerProxy()
index 65d7b7a..8f4102b 100644 (file)
 #define WebGeolocationManagerProxy_h
 
 #include "APIObject.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebGeolocationProvider.h"
 #include <wtf/text/WTFString.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-}
-
 namespace WebKit {
 
 class WebContext;
 class WebGeolocationPosition;
 
-class WebGeolocationManagerProxy : public APIObject {
+class WebGeolocationManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeGeolocationManager;
 
@@ -56,13 +51,14 @@ public:
     void providerDidChangePosition(WebGeolocationPosition*);
     void providerDidFailToDeterminePosition(const String& errorMessage = String());
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
 private:
     explicit WebGeolocationManagerProxy(WebContext*);
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+
     // Implemented in generated WebGeolocationManagerProxyMessageReceiver.cpp
     void didReceiveWebGeolocationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
index e6f062e..8b71e89 100644 (file)
@@ -54,6 +54,7 @@ WebIconDatabase::WebIconDatabase(WebContext* context)
     , m_urlImportCompleted(false)
     , m_databaseCleanupDisabled(false)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebIconDatabase, this);
 }
 
 void WebIconDatabase::invalidate()
index b07a7db..8643a48 100644 (file)
@@ -54,7 +54,7 @@ namespace WebKit {
 
 class WebContext;
 
-class WebIconDatabase : public APIObject, public WebCore::IconDatabaseClient {
+class WebIconDatabase : public APIObject, public WebCore::IconDatabaseClient, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeIconDatabase;
 
@@ -90,23 +90,25 @@ public:
 
     void initializeIconDatabaseClient(const WKIconDatabaseClient*);
 
+private:
+    WebIconDatabase(WebContext*);
+
+    virtual Type type() const { return APIType; }
+
     // WebCore::IconDatabaseClient
     virtual void didImportIconURLForPageURL(const String&);
     virtual void didImportIconDataForPageURL(const String&);
     virtual void didChangeIconForPageURL(const String&);
     virtual void didRemoveAllIcons();
     virtual void didFinishURLImport();
-    
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-    void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
 
-private:
-    WebIconDatabase(WebContext*);
-
-    virtual Type type() const { return APIType; }
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+    virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE;
 
     void didReceiveWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     void didReceiveSyncWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
+
     void notifyIconDataReadyForPageURL(const String&);
 
     WebContext* m_webContext;
index 8b3332a..454d082 100644 (file)
@@ -41,6 +41,7 @@ PassRefPtr<WebKeyValueStorageManagerProxy> WebKeyValueStorageManagerProxy::creat
 WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy(WebContext* context)
     : m_webContext(context)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebKeyValueStorageManagerProxy, this);
 }
 
 WebKeyValueStorageManagerProxy::~WebKeyValueStorageManagerProxy()
index 2be77c3..9c63142 100644 (file)
 #include "APIObject.h"
 #include "GenericCallback.h"
 #include "ImmutableArray.h"
-
+#include "MessageReceiver.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
-namespace CoreIPC {
-    class ArgumentDecoder;
-    class Connection;
-    class MessageID;
-}
-
 namespace WebKit {
 
 struct SecurityOriginData;
@@ -49,7 +43,7 @@ class WebSecurityOrigin;
 
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 
-class WebKeyValueStorageManagerProxy : public APIObject {
+class WebKeyValueStorageManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeKeyValueStorageManager;
 
@@ -63,8 +57,6 @@ public:
     void deleteEntriesForOrigin(WebSecurityOrigin*);
     void deleteAllEntries();
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -73,7 +65,9 @@ private:
     virtual Type type() const { return APIType; }
 
     void didGetKeyValueStorageOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
-    
+
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebKeyValueStorageManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     WebContext* m_webContext;
index ce4a78c..81cf98f 100644 (file)
@@ -40,6 +40,7 @@ PassRefPtr<WebMediaCacheManagerProxy> WebMediaCacheManagerProxy::create(WebConte
 WebMediaCacheManagerProxy::WebMediaCacheManagerProxy(WebContext* context)
     : m_webContext(context)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebMediaCacheManagerProxy, this);
 }
 
 WebMediaCacheManagerProxy::~WebMediaCacheManagerProxy()
index adc68c4..48e88e0 100644 (file)
 #include "APIObject.h"
 #include "GenericCallback.h"
 #include "ImmutableArray.h"
-
+#include "MessageReceiver.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
-namespace CoreIPC {
-    class ArgumentDecoder;
-    class Connection;
-    class MessageID;
-}
-
 namespace WebKit {
 
 class WebContext;
@@ -47,7 +41,7 @@ class WebProcessProxy;
 
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 
-class WebMediaCacheManagerProxy : public APIObject {
+class WebMediaCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeMediaCacheManager;
 
@@ -61,8 +55,6 @@ public:
     void clearCacheForHostname(const String&);
     void clearCacheForAllHostnames();
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -71,7 +63,9 @@ private:
     virtual Type type() const { return APIType; }
 
     void didGetHostnamesWithMediaCache(const Vector<String>&, uint64_t callbackID);
-    
+
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebMediaCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     WebContext* m_webContext;
index 9bacced..21a399b 100644 (file)
@@ -43,6 +43,7 @@ WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy(WebContext* context)
     : m_isUpdating(false)
     , m_context(context)
 {
+    m_context->addMessageReceiver(CoreIPC::MessageClassWebNetworkInfoManagerProxy, this);
 }
 
 WebNetworkInfoManagerProxy::~WebNetworkInfoManagerProxy()
@@ -72,7 +73,7 @@ void WebNetworkInfoManagerProxy::didReceiveMessage(CoreIPC::Connection* connecti
     didReceiveWebNetworkInfoManagerProxyMessage(connection, messageID, arguments);
 }
 
-void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, WTF::OwnPtr<CoreIPC::ArgumentEncoder>& reply)
+void WebNetworkInfoManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
 {
     didReceiveSyncWebNetworkInfoManagerProxyMessage(connection, messageID, arguments, reply);
 }
index b729855..2c4ef7c 100644 (file)
 #if ENABLE(NETWORK_INFO)
 
 #include "APIObject.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebNetworkInfoProvider.h"
 #include <wtf/Forward.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class ArgumentEncoder;
-class Connection;
-}
-
 namespace WebKit {
 
 class WebContext;
 class WebNetworkInfo;
 
-class WebNetworkInfoManagerProxy : public APIObject {
+class WebNetworkInfoManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeNetworkInfoManager;
 
@@ -58,17 +52,18 @@ public:
 
     void providerDidChangeNetworkInformation(const WTF::AtomicString& eventType, WebNetworkInfo*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-    void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&);
-
 private:
     explicit WebNetworkInfoManagerProxy(WebContext*);
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+    virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&) OVERRIDE;
+
     // Implemented in generated WebNetworkInfoManagerProxyMessageReceiver.cpp
     void didReceiveWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-    void didReceiveSyncWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&);
+    void didReceiveSyncWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
 
     void startUpdating();
     void stopUpdating();
index 76cb427..2e0c94f 100644 (file)
@@ -375,36 +375,14 @@ void WebProcessProxy::didClearPluginSiteData(uint64_t callbackID)
 
 void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
-    if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
-        didReceiveWebProcessProxyMessage(connection, messageID, arguments);
+    // FIXME: Come up with a better way to chain to the WebContext.
+    if (m_context->knowsHowToHandleMessage(messageID)) {
+        m_context->didReceiveMessage(this, messageID, arguments);
         return;
     }
 
-    if (messageID.is<CoreIPC::MessageClassWebContext>()
-        || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
-        || messageID.is<CoreIPC::MessageClassDownloadProxy>()
-        || messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()
-#if ENABLE(BATTERY_STATUS)
-        || messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()
-#endif
-        || messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()
-        || messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()
-        || messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()
-        || messageID.is<CoreIPC::MessageClassWebIconDatabase>()
-        || messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()
-        || messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()
-#if ENABLE(NETWORK_INFO)
-        || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()
-#endif
-        || messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()
-#if USE(SOUP)
-        || messageID.is<CoreIPC::MessageClassWebSoupRequestManagerProxy>()
-#endif
-#if ENABLE(VIBRATION)
-        || messageID.is<CoreIPC::MessageClassWebVibrationProxy>()
-#endif
-        || messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
-        m_context->didReceiveMessage(this, messageID, arguments);
+    if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
+        didReceiveWebProcessProxyMessage(connection, messageID, arguments);
         return;
     }
 
@@ -421,17 +399,14 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
 
 void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
 {
-    if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
-        didReceiveSyncWebProcessProxyMessage(connection, messageID, arguments, reply);
+    // FIXME: Come up with a better way to chain to the WebContext.
+    if (m_context->knowsHowToHandleMessage(messageID)) {
+        m_context->didReceiveSyncMessage(this, messageID, arguments, reply);
         return;
     }
 
-    if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
-#if ENABLE(NETWORK_INFO)
-        || messageID.is<CoreIPC::MessageClassWebNetworkInfoManagerProxy>()
-#endif
-        || messageID.is<CoreIPC::MessageClassDownloadProxy>() || messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
-        m_context->didReceiveSyncMessage(this, messageID, arguments, reply);
+    if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) {
+        didReceiveSyncWebProcessProxyMessage(connection, messageID, arguments, reply);
         return;
     }
 
index 1230bf3..3c29807 100644 (file)
@@ -45,6 +45,7 @@ PassRefPtr<WebResourceCacheManagerProxy> WebResourceCacheManagerProxy::create(We
 WebResourceCacheManagerProxy::WebResourceCacheManagerProxy(WebContext* webContext)
     : m_webContext(webContext)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebResourceCacheManagerProxy, this);
 }
 
 WebResourceCacheManagerProxy::~WebResourceCacheManagerProxy()
@@ -94,4 +95,9 @@ void WebResourceCacheManagerProxy::clearCacheForAllOrigins(ResourceCachesToClear
     m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(cachesToClear));
 }
 
+void WebResourceCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+    didReceiveWebResourceCacheManagerProxyMessage(connection, messageID, arguments);
+}
+
 } // namespace WebKit
index f0c7bb5..9e59b64 100644 (file)
 #include "APIObject.h"
 #include "Arguments.h"
 #include "GenericCallback.h"
+#include "MessageReceiver.h"
 #include "ResourceCachesToClear.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-class MessageID;
-}
-
 namespace WebKit {
 
 struct SecurityOriginData;
@@ -48,7 +43,7 @@ class WebSecurityOrigin;
 
 typedef GenericCallback<WKArrayRef> ArrayCallback;
 
-class WebResourceCacheManagerProxy : public APIObject {
+class WebResourceCacheManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeCacheManager;
 
@@ -62,8 +57,6 @@ public:
     void clearCacheForOrigin(WebSecurityOrigin*, ResourceCachesToClear);
     void clearCacheForAllOrigins(ResourceCachesToClear);
 
-    void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
     bool shouldTerminate(WebProcessProxy*) const;
 
 private:
@@ -71,6 +64,10 @@ private:
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+    void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
     // Message handlers.
     void didGetCacheOrigins(const Vector<SecurityOriginData>& originIdentifiers, uint64_t callbackID);
 
index 9a5f7f2..0590f30 100644 (file)
@@ -40,6 +40,7 @@ PassRefPtr<WebVibrationProxy> WebVibrationProxy::create(WebContext* context)
 WebVibrationProxy::WebVibrationProxy(WebContext* context)
     : m_context(context)
 {
+    m_context->addMessageReceiver(CoreIPC::MessageClassWebVibrationProxy, this);
 }
 
 WebVibrationProxy::~WebVibrationProxy()
index 4e69e96..676d3a4 100644 (file)
 #if ENABLE(VIBRATION)
 
 #include "APIObject.h"
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebVibrationProvider.h"
 #include <wtf/Forward.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-}
-
 namespace WebKit {
 
 class WebContext;
 
-class WebVibrationProxy : public APIObject {
+class WebVibrationProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeVibration;
 
@@ -54,13 +49,14 @@ public:
 
     void initializeProvider(const WKVibrationProvider*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
 private:
     explicit WebVibrationProxy(WebContext*);
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
+
     // Implemented in generated WebVibrationProxyMessageReceiver.cpp
     void didReceiveWebVibrationProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
index 19e7ee6..e2bf342 100644 (file)
@@ -35,6 +35,7 @@ WebSoupRequestManagerProxy::WebSoupRequestManagerProxy(WebContext* context)
     : m_webContext(context)
     , m_loadFailed(false)
 {
+    m_webContext->addMessageReceiver(CoreIPC::MessageClassWebSoupRequestManagerProxy, this);
 }
 
 WebSoupRequestManagerProxy::~WebSoupRequestManagerProxy()
index dab8bf4..6a3d6e8 100644 (file)
 #define WebSoupRequestManagerProxy_h
 
 #include "APIObject.h"
+#include "MessageReceiver.h"
 #include "WebSoupRequestManagerClient.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-class MessageID;
-}
-
 namespace WebKit {
 
 class WebContext;
 class WebData;
 
-class WebSoupRequestManagerProxy : public APIObject {
+class WebSoupRequestManagerProxy : public APIObject, private CoreIPC::MessageReceiver {
 public:
     static const Type APIType = TypeSoupRequestManager;
 
@@ -55,13 +50,14 @@ public:
     void didFailToLoadURIRequest(uint64_t requestID);
 
     void didReceiveURIRequest(const String& uriString, WebPageProxy*, uint64_t requestID);
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
 private:
     WebSoupRequestManagerProxy(WebContext*);
 
     virtual Type type() const { return APIType; }
 
+    // CoreIPC::MessageReceiver
+    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
     void didReceiveWebSoupRequestManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     WebContext* m_webContext;
index 9186d42..93afe44 100644 (file)
@@ -62,9 +62,8 @@ public:
 private:
     AuthenticationManager();
 
-    // MessageReceiver
+    // CoreIPC::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 c42496e..8a1405d 100644 (file)
 
 #include "MessageReceiver.h"
 #include "WebGeolocationPosition.h"
-#include <wtf/HashSet.h>
+#include <wtf/Forward.h>
 #include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 
-namespace CoreIPC {
-class ArgumentDecoder;
-class Connection;
-}
-
 namespace WebCore {
 class Geolocation;
 }
 
-namespace WTF {
-class String;
-}
-
 namespace WebKit {
 
 class WebProcess;
@@ -61,16 +53,15 @@ public:
 
     void requestPermission(WebCore::Geolocation*);
 
-
 private:
-    // MessageReceiver
+    // CoreIPC::MessageReceiver
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) OVERRIDE;
 
     // Implemented in generated WebGeolocationManagerMessageReceiver.cpp
     void didReceiveWebGeolocationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
     void didChangePosition(const WebGeolocationPosition::Data&);
-    void didFailToDeterminePosition(const WTF::String& errorMessage);
+    void didFailToDeterminePosition(const String& errorMessage);
 
     WebProcess* m_process;
     bool m_didAddMessageReceiver;