Title: [138415] trunk/Source/WebKit2
Revision
138415
Author
[email protected]
Date
2012-12-22 18:36:11 -0800 (Sat, 22 Dec 2012)

Log Message

Give the ChildProcess a MessageReceiverMap
https://bugs.webkit.org/show_bug.cgi?id=105681

Reviewed by Dan Bernstein.

Moving the MessageReceiverMap to the ChildProcess will help shared code
between the WebProcess and NetworkProcess.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
Pass 'this' instead of the MessageReceiverMap, now that ChildProcess
can be used to access the MessageReceiverMap.

* NetworkProcess/NetworkProcess.h:
(NetworkProcess):
Remove the now extraneous MessageReceiverMap.

* Shared/ChildProcess.cpp:
(WebKit::ChildProcess::ChildProcess):
(WebKit):
(WebKit::ChildProcess::~ChildProcess):
(WebKit::ChildProcess::addMessageReceiver):
(WebKit::ChildProcess::removeMessageReceiver):
* Shared/ChildProcess.h:
(ChildProcess):
Add a MessageReceiverMap and helper functions from WebProcess.

* WebProcess/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
* WebProcess/Authentication/AuthenticationManager.h:
(AuthenticationManager):
Fix the FIXME, passing the ChildProcess rather than the MessageReceiverMap.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
* WebProcess/WebProcess.h:
(WebProcess):
Remove the MessageReceiverMap and helper functions.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (138414 => 138415)


--- trunk/Source/WebKit2/ChangeLog	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-23 02:36:11 UTC (rev 138415)
@@ -1,3 +1,44 @@
+2012-12-22  Sam Weinig  <[email protected]>
+
+        Give the ChildProcess a MessageReceiverMap
+        https://bugs.webkit.org/show_bug.cgi?id=105681
+
+        Reviewed by Dan Bernstein.
+
+        Moving the MessageReceiverMap to the ChildProcess will help shared code
+        between the WebProcess and NetworkProcess.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        Pass 'this' instead of the MessageReceiverMap, now that ChildProcess
+        can be used to access the MessageReceiverMap.
+
+        * NetworkProcess/NetworkProcess.h:
+        (NetworkProcess):
+        Remove the now extraneous MessageReceiverMap.
+
+        * Shared/ChildProcess.cpp:
+        (WebKit::ChildProcess::ChildProcess):
+        (WebKit):
+        (WebKit::ChildProcess::~ChildProcess):
+        (WebKit::ChildProcess::addMessageReceiver):
+        (WebKit::ChildProcess::removeMessageReceiver):
+        * Shared/ChildProcess.h:
+        (ChildProcess):
+        Add a MessageReceiverMap and helper functions from WebProcess.
+
+        * WebProcess/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::AuthenticationManager):
+        * WebProcess/Authentication/AuthenticationManager.h:
+        (AuthenticationManager):
+        Fix the FIXME, passing the ChildProcess rather than the MessageReceiverMap.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess):
+        * WebProcess/WebProcess.h:
+        (WebProcess):
+        Remove the MessageReceiverMap and helper functions.
+
 2012-12-22  Alexey Proskuryakov  <[email protected]>
 
         Windows build fix.

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (138414 => 138415)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2012-12-23 02:36:11 UTC (rev 138415)
@@ -54,7 +54,7 @@
 NetworkProcess::NetworkProcess()
     : m_hasSetCacheModel(false)
     , m_cacheModel(CacheModelDocumentViewer)
-    , m_downloadsAuthenticationManager(m_messageReceiverMap)
+    , m_downloadsAuthenticationManager(this)
 {
 }
 

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (138414 => 138415)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2012-12-23 02:36:11 UTC (rev 138415)
@@ -101,8 +101,6 @@
     // The connection to the UI process.
     RefPtr<CoreIPC::Connection> m_uiConnection;
 
-    CoreIPC::MessageReceiverMap m_messageReceiverMap;
-
     // Connections to WebProcesses.
     Vector<RefPtr<NetworkConnectionToWebProcess> > m_webProcessConnections;
 

Modified: trunk/Source/WebKit2/Shared/ChildProcess.cpp (138414 => 138415)


--- trunk/Source/WebKit2/Shared/ChildProcess.cpp	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/Shared/ChildProcess.cpp	2012-12-23 02:36:11 UTC (rev 138415)
@@ -34,6 +34,36 @@
 
 namespace WebKit {
 
+ChildProcess::ChildProcess()
+    : m_terminationTimeout(0)
+    , m_terminationCounter(0)
+    , m_terminationTimer(RunLoop::main(), this, &ChildProcess::terminationTimerFired)
+{
+    // FIXME: The termination timer should not be scheduled on the main run loop.
+    // It won't work with the threaded mode, but it's not really useful anyway as is.
+    
+    platformInitialize();
+}
+
+ChildProcess::~ChildProcess()
+{
+}
+
+void ChildProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver* messageReceiver)
+{
+    m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver);
+}
+
+void ChildProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver* messageReceiver)
+{
+    m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver);
+}
+
+void ChildProcess::removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID)
+{
+    m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID);
+}
+
 void ChildProcess::disableTermination()
 {
     m_terminationCounter++;
@@ -56,21 +86,6 @@
     m_terminationTimer.startOneShot(m_terminationTimeout);
 }
 
-ChildProcess::ChildProcess()
-    : m_terminationTimeout(0)
-    , m_terminationCounter(0)
-    , m_terminationTimer(RunLoop::main(), this, &ChildProcess::terminationTimerFired)
-{
-    // FIXME: The termination timer should not be scheduled on the main run loop.
-    // It won't work with the threaded mode, but it's not really useful anyway as is.
-    
-    platformInitialize();
-}
-
-ChildProcess::~ChildProcess()
-{
-}
-
 void ChildProcess::terminationTimerFired()
 {
     if (!shouldTerminate())

Modified: trunk/Source/WebKit2/Shared/ChildProcess.h (138414 => 138415)


--- trunk/Source/WebKit2/Shared/ChildProcess.h	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/Shared/ChildProcess.h	2012-12-23 02:36:11 UTC (rev 138415)
@@ -27,6 +27,7 @@
 #define ChildProcess_h
 
 #include "Connection.h"
+#include "MessageReceiverMap.h"
 #include <WebCore/RunLoop.h>
 #include <wtf/RetainPtr.h>
 
@@ -62,6 +63,10 @@
         ChildProcess& m_childProcess;
     };
 
+    void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*);
+    void addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver*);
+    void removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID);
+
 #if PLATFORM(MAC)
     bool applicationIsOccluded() const { return !m_processVisibleAssertion; }
     void setApplicationIsOccluded(bool);
@@ -71,10 +76,12 @@
 
 protected:
     explicit ChildProcess();
-    ~ChildProcess();
+    virtual ~ChildProcess();
 
     void setTerminationTimeout(double seconds) { m_terminationTimeout = seconds; }
 
+    CoreIPC::MessageReceiverMap m_messageReceiverMap;
+
 private:
     void terminationTimerFired();
 

Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp (138414 => 138415)


--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp	2012-12-23 02:36:11 UTC (rev 138415)
@@ -27,10 +27,10 @@
 #include "AuthenticationManager.h"
 
 #include "AuthenticationManagerMessages.h"
+#include "ChildProcess.h"
 #include "Download.h"
 #include "DownloadProxyMessages.h"
 #include "MessageID.h"
-#include "MessageReceiverMap.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebPage.h"
@@ -48,9 +48,9 @@
     return uniqueAuthenticationChallengeID++;
 }
 
-AuthenticationManager::AuthenticationManager(CoreIPC::MessageReceiverMap& messageReceiverMap)
+AuthenticationManager::AuthenticationManager(ChildProcess* childProcess)
 {
-    messageReceiverMap.addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
+    childProcess->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), this);
 }
 
 void AuthenticationManager::setConnection(CoreIPC::Connection* connection)

Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h (138414 => 138415)


--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h	2012-12-23 02:36:11 UTC (rev 138415)
@@ -43,6 +43,7 @@
 
 namespace WebKit {
 
+class ChildProcess;
 class Download;
 class PlatformCertificateInfo;
 class WebFrame;
@@ -51,8 +52,7 @@
     WTF_MAKE_NONCOPYABLE(AuthenticationManager);
 
 public:
-    // FIXME: ChildProcess should just have a MessageReceiverMap, and this should take a ChildProcess.
-    explicit AuthenticationManager(CoreIPC::MessageReceiverMap&);
+    explicit AuthenticationManager(ChildProcess*);
 
     void setConnection(CoreIPC::Connection*);
 
@@ -64,7 +64,6 @@
     void cancelChallenge(uint64_t challengeID);
 
 private:
-
     // CoreIPC::MessageReceiver
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (138414 => 138415)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-12-23 02:36:11 UTC (rev 138415)
@@ -149,7 +149,7 @@
 #if USE(SOUP)
     , m_soupRequestManager(this)
 #endif
-    , m_authenticationManager(m_messageReceiverMap)
+    , m_authenticationManager(this)
 {
 #if USE(PLATFORM_STRATEGIES)
     // Initialize our platform strategies.
@@ -180,21 +180,6 @@
     m_authenticationManager.setConnection(m_connection.get());
 }
 
-void WebProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver* messageReceiver)
-{
-    m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver);
-}
-
-void WebProcess::addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver* messageReceiver)
-{
-    m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver);
-}
-
-void WebProcess::removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID)
-{
-    m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID);
-}
-
 void WebProcess::didCreateDownload()
 {
     disableTermination();

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (138414 => 138415)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2012-12-23 02:19:00 UTC (rev 138414)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2012-12-23 02:36:11 UTC (rev 138415)
@@ -118,11 +118,6 @@
 
     CoreIPC::Connection* connection() const { return m_connection.get(); }
     WebCore::RunLoop* runLoop() const { return m_runLoop; }
-
-    void addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver*);
-    void addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver*);
-    void removeMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID);
-
     WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_webConnection.get(); }
 
     WebPage* webPage(uint64_t pageID) const;
@@ -327,8 +322,6 @@
 #endif
 
     RefPtr<CoreIPC::Connection> m_connection;
-    CoreIPC::MessageReceiverMap m_messageReceiverMap;
-
     RefPtr<WebConnectionToUIProcess> m_webConnection;
 
     HashMap<uint64_t, RefPtr<WebPage> > m_pageMap;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to