Move a few more WebProcess sub-objects to be MessageReceivers
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2012 17:22:19 +0000 (17:22 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2012 17:22:19 +0000 (17:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100186

Reviewed by Anders Carlsson.

* WebProcess/Battery/WebBatteryManager.cpp:
(WebKit::WebBatteryManager::WebBatteryManager):
* WebProcess/Battery/WebBatteryManager.h:
(WebBatteryManager):
* WebProcess/IconDatabase/WebIconDatabaseProxy.cpp:
(WebKit::WebIconDatabaseProxy::WebIconDatabaseProxy):
(WebKit):
* WebProcess/IconDatabase/WebIconDatabaseProxy.h:
(WebIconDatabaseProxy):
* WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:
(WebKit::WebNetworkInfoManager::WebNetworkInfoManager):
* WebProcess/NetworkInfo/WebNetworkInfoManager.h:
(WebNetworkInfoManager):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::WebNotificationManager):
* WebProcess/Notifications/WebNotificationManager.h:
(WebNotificationManager):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage):
* WebProcess/soup/WebSoupRequestManager.cpp:
(WebKit::WebSoupRequestManager::WebSoupRequestManager):
* WebProcess/soup/WebSoupRequestManager.h:
(WebSoupRequestManager):

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

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp
Source/WebKit2/WebProcess/Battery/WebBatteryManager.h
Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp
Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h
Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp
Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp
Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h

index 87f7554..6c81837 100644 (file)
@@ -1,3 +1,34 @@
+2012-10-23  Sam Weinig  <sam@webkit.org>
+
+        Move a few more WebProcess sub-objects to be MessageReceivers
+        https://bugs.webkit.org/show_bug.cgi?id=100186
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/Battery/WebBatteryManager.cpp:
+        (WebKit::WebBatteryManager::WebBatteryManager):
+        * WebProcess/Battery/WebBatteryManager.h:
+        (WebBatteryManager):
+        * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp:
+        (WebKit::WebIconDatabaseProxy::WebIconDatabaseProxy):
+        (WebKit):
+        * WebProcess/IconDatabase/WebIconDatabaseProxy.h:
+        (WebIconDatabaseProxy):
+        * WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:
+        (WebKit::WebNetworkInfoManager::WebNetworkInfoManager):
+        * WebProcess/NetworkInfo/WebNetworkInfoManager.h:
+        (WebNetworkInfoManager):
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::WebNotificationManager):
+        * WebProcess/Notifications/WebNotificationManager.h:
+        (WebNotificationManager):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveMessage):
+        * WebProcess/soup/WebSoupRequestManager.cpp:
+        (WebKit::WebSoupRequestManager::WebSoupRequestManager):
+        * WebProcess/soup/WebSoupRequestManager.h:
+        (WebSoupRequestManager):
+
 2012-10-23  Anders Carlsson  <andersca@apple.com>
 
         encode should take an ArgumentEncoder reference
index 0892f21..3cb06b3 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(BATTERY_STATUS)
 
+#include "WebBatteryManagerMessages.h"
 #include "WebBatteryManagerProxyMessages.h"
 #include "WebPage.h"
 #include "WebProcess.h"
@@ -42,6 +43,7 @@ namespace WebKit {
 WebBatteryManager::WebBatteryManager(WebProcess* process)
     : m_process(process)
 {
+    m_process->addMessageReceiver(Messages::WebBatteryManager::messageReceiverName(), this);
 }
 
 WebBatteryManager::~WebBatteryManager()
index 45fab18..d47dea4 100644 (file)
 
 #if ENABLE(BATTERY_STATUS)
 
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebBatteryStatus.h"
 #include "WebCoreArgumentCoders.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/AtomicString.h>
 
-namespace CoreIPC {
-class Connection;
-class MessageDecoder;
-}
-
 namespace WebKit {
 
 class WebPage;
 class WebProcess;
 
-class WebBatteryManager {
+class WebBatteryManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebBatteryManager);
 
 public:
@@ -58,9 +53,10 @@ public:
     void didChangeBatteryStatus(const WTF::AtomicString& eventType, const WebBatteryStatus::Data&);
     void updateBatteryStatus(const WebBatteryStatus::Data&);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
 private:
+    // CoreIPC::MessageReceiver
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+
     // Implemented in generated WebBatteryManagerMessageReceiver.cpp
     void didReceiveWebBatteryManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 
index a04793e..c9360b3 100644 (file)
@@ -27,8 +27,8 @@
 #include "WebIconDatabaseProxy.h"
 
 #include "DataReference.h"
-#include "MessageID.h"
 #include "WebIconDatabaseMessages.h"
+#include "WebIconDatabaseProxyMessages.h"
 #include "WebProcess.h"
 #include <WebCore/SharedBuffer.h>
 #include <wtf/text/WTFString.h>
@@ -45,6 +45,7 @@ WebIconDatabaseProxy::WebIconDatabaseProxy(WebProcess* process)
     : m_isEnabled(false)
     , m_process(process)
 {
+    m_process->addMessageReceiver(Messages::WebIconDatabaseProxy::messageReceiverName(), this);
 }
 
 bool WebIconDatabaseProxy::isEnabled() const
@@ -61,7 +62,6 @@ void WebIconDatabaseProxy::setEnabled(bool enabled)
     setGlobalIconDatabase(enabled ? this : 0);
 }
 
-
 void WebIconDatabaseProxy::retainIconForPageURL(const String& pageURL)
 {
     m_process->connection()->send(Messages::WebIconDatabase::RetainIconForPageURL(pageURL), 0);
index cd9f717..16f8ea7 100644 (file)
 #define WebIconDatabaseProxy_h
 
 #include "APIObject.h"
-
+#include "MessageReceiver.h"
 #include <WebCore/IconDatabaseBase.h>
-
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
-namespace CoreIPC {
-class Connection;
-class MessageDecoder;
-class MessageID;
-}
-
 namespace WebKit {
 
 class WebProcess;
 
-class WebIconDatabaseProxy : public WebCore::IconDatabaseBase {
+class WebIconDatabaseProxy : public WebCore::IconDatabaseBase, private CoreIPC::MessageReceiver {
 public:
     explicit WebIconDatabaseProxy(WebProcess*);
     virtual ~WebIconDatabaseProxy();
 
     virtual bool isEnabled() const;
     void setEnabled(bool);
-    
-    
+
     virtual void retainIconForPageURL(const String&);
     virtual void releaseIconForPageURL(const String&);
     virtual void setIconURLForPageURL(const String&, const String&);
@@ -69,10 +61,12 @@ public:
     virtual void loadDecisionForIconURL(const String&, PassRefPtr<WebCore::IconLoadDecisionCallback>);
     void receivedIconLoadDecision(int decision, uint64_t callbackID);
     virtual void iconDataForIconURL(const String&, PassRefPtr<WebCore::IconDataCallback>);
-        
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-    
+
 private:
+    // CoreIPC::MessageReceiver
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+
+    // Implemented in generated WebIconDatabaseProxyMessageReceiver.cpp
     void didReceiveWebIconDatabaseProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
     
     // Callbacks from the UIProcess
index 631f022..cba67fe 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NETWORK_INFO)
 
+#include "WebNetworkInfoManagerMessages.h"
 #include "WebNetworkInfoManagerProxyMessages.h"
 #include "WebPage.h"
 #include "WebProcess.h"
@@ -42,6 +43,7 @@ namespace WebKit {
 WebNetworkInfoManager::WebNetworkInfoManager(WebProcess* process)
     : m_process(process)
 {
+    m_process->addMessageReceiver(Messages::WebNetworkInfoManager::messageReceiverName(), this);
 }
 
 WebNetworkInfoManager::~WebNetworkInfoManager()
index dfe9afa..ee3282f 100644 (file)
 
 #if ENABLE(NETWORK_INFO)
 
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebNetworkInfo.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/AtomicString.h>
 
-namespace CoreIPC {
-class Connection;
-class MessageDecoder;
-}
-
 namespace WebKit {
 
 class WebProcess;
 class WebPage;
 
-class WebNetworkInfoManager {
+class WebNetworkInfoManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebNetworkInfoManager);
 public:
     explicit WebNetworkInfoManager(WebProcess*);
@@ -56,10 +51,10 @@ public:
 
     double bandwidth(WebPage*) const;
     bool metered(WebPage*) const;
-
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
 private:
+    // CoreIPC::MessageReceiver
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+
     // Implemented in generated WebNetworkInfoManagerMessageReceiver.cpp
     void didReceiveWebNetworkInfoManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 
index fb42bcc..eaa4349 100644 (file)
@@ -31,6 +31,7 @@
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
 #include "WebNotification.h"
+#include "WebNotificationManagerMessages.h"
 #include "WebNotificationManagerProxyMessages.h"
 #include "WebPageProxyMessages.h"
 #include <WebCore/Document.h>
@@ -57,6 +58,9 @@ static uint64_t generateNotificationID()
 WebNotificationManager::WebNotificationManager(WebProcess* process)
     : m_process(process)
 {
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    m_process->addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), this);
+#endif
 }
 
 WebNotificationManager::~WebNotificationManager()
index a3f658f..9f505aa 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef WebNotificationManager_h
 #define WebNotificationManager_h
 
-#include "MessageID.h"
+#include "MessageReceiver.h"
 #include <WebCore/NotificationClient.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 
-namespace CoreIPC {
-class Connection;
-class MessageDecoder;
-}
-
 namespace WebCore {
 class Notification;
 class SecurityOrigin;
@@ -49,7 +44,7 @@ namespace WebKit {
 class WebPage;
 class WebProcess;
 
-class WebNotificationManager {
+class WebNotificationManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebNotificationManager);
 public:
     explicit WebNotificationManager(WebProcess*);
@@ -63,7 +58,6 @@ public:
     // This callback comes from WebCore, not messaged from the UI process.
     void didDestroyNotification(WebCore::Notification*, WebPage*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
     void didUpdateNotificationDecision(const String& originString, bool allowed);
 
     // Looks in local cache for permission. If not found, returns DefaultDenied.
@@ -73,6 +67,9 @@ public:
     uint64_t notificationIDForTesting(WebCore::Notification*);
 
 private:
+    // CoreIPC::MessageReceiver
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+
     // Implemented in generated WebNotificationManagerMessageReceiver.cpp
     void didReceiveWebNotificationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
     
index 33be759..45d2111 100644 (file)
@@ -692,25 +692,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
     }
 #endif
 
-#if ENABLE(BATTERY_STATUS)
-    if (messageID.is<CoreIPC::MessageClassWebBatteryManager>()) {
-        m_batteryManager.didReceiveMessage(connection, messageID, decoder);
-        return;
-    }
-#endif
-
-#if ENABLE(NETWORK_INFO)
-    if (messageID.is<CoreIPC::MessageClassWebNetworkInfoManager>()) {
-        m_networkInfoManager.didReceiveMessage(connection, messageID, decoder);
-        return;
-    }
-#endif
-
-    if (messageID.is<CoreIPC::MessageClassWebIconDatabaseProxy>()) {
-        m_iconDatabaseProxy.didReceiveMessage(connection, messageID, decoder);
-        return;
-    }
-
     if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManager>()) {
         WebKeyValueStorageManager::shared().didReceiveMessage(connection, messageID, decoder);
         return;
@@ -720,25 +701,11 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
         WebMediaCacheManager::shared().didReceiveMessage(connection, messageID, decoder);
         return;
     }
-
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    if (messageID.is<CoreIPC::MessageClassWebNotificationManager>()) {
-        m_notificationManager.didReceiveMessage(connection, messageID, decoder);
-        return;
-    }
-#endif
     
     if (messageID.is<CoreIPC::MessageClassWebResourceCacheManager>()) {
         WebResourceCacheManager::shared().didReceiveMessage(connection, messageID, decoder);
         return;
     }
-
-#if USE(SOUP)
-    if (messageID.is<CoreIPC::MessageClassWebSoupRequestManager>()) {
-        m_soupRequestManager.didReceiveMessage(connection, messageID, decoder);
-        return;
-    }
-#endif
     
     if (messageID.is<CoreIPC::MessageClassWebPageGroupProxy>()) {
         uint64_t pageGroupID = decoder.destinationID();
index b9b3587..c7d10c6 100644 (file)
@@ -27,6 +27,7 @@
 #include "WebKitSoupRequestInputStream.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
+#include "WebSoupRequestManagerMessages.h"
 #include "WebSoupRequestManagerProxyMessages.h"
 #include <WebCore/ResourceHandle.h>
 #include <WebCore/ResourceRequest.h>
@@ -80,6 +81,7 @@ WebSoupRequestManager::WebSoupRequestManager(WebProcess* process)
     : m_process(process)
     , m_schemes(adoptGRef(g_ptr_array_new_with_free_func(g_free)))
 {
+    m_process->addMessageReceiver(Messages::WebSoupRequestManager::messageReceiverName(), this);
 }
 
 WebSoupRequestManager::~WebSoupRequestManager()
index cae652e..8178411 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef WebSoupRequestManager_h
 #define WebSoupRequestManager_h
 
+#include "DataReference.h"
+#include "MessageReceiver.h"
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 typedef struct _GInputStream GInputStream;
 typedef struct _GSimpleAsyncResult GSimpleAsyncResult;
 
-namespace CoreIPC {
-class Connection;
-class DataReference;
-class MessageDecoder;
-class MessageID;
-}
-
 namespace WebKit {
 
 class WebProcess;
 struct WebSoupRequestAsyncData;
 
-class WebSoupRequestManager {
+class WebSoupRequestManager : private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebSoupRequestManager);
 public:
     explicit WebSoupRequestManager(WebProcess*);
@@ -50,9 +45,11 @@ public:
     void send(GSimpleAsyncResult*, GCancellable*);
     GInputStream* finish(GSimpleAsyncResult*);
 
-    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
 private:
+    // CoreIPC::MessageReceiver
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+
+    // Implemented in generated WebSoupRequestManagerMessageReceiver.cpp
     void didReceiveWebSoupRequestManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 
     void registerURIScheme(const String& scheme);