[WK2] Make the WebNetworkInfoManager a supplement to the WebProcess
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 May 2013 08:06:00 +0000 (08:06 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 May 2013 08:06:00 +0000 (08:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115716

Reviewed by Andreas Kling.

WebNetworkInfoManager should inherit from WebProcessSupplement and should be used
as such by the WebProcess. This removes the need for the m_networkInfoManager member
variable in the WebProcess class and brings the WebNetworkInfoManager in line with
other manager classes of which instances are controlled by the WebProcess class.

* WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:
(WebKit::WebNetworkInfoManager::supplementName): Specify the supplement's name.
(WebKit):
* WebProcess/NetworkInfo/WebNetworkInfoManager.h:
(WebKit): Alphabetically reorder the two forwarding declarations.
(WebNetworkInfoManager): Inherit from the WebProcessSupplement interface.
* WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp:
(WebKit::WebNetworkInfoClient::bandwidth): Access the WebNetworkInfoManager as a supplement.
(WebKit::WebNetworkInfoClient::metered): Ditto.
(WebKit::WebNetworkInfoClient::startUpdating): Ditto.
(WebKit::WebNetworkInfoClient::stopUpdating): Ditto.
(WebKit::WebNetworkInfoClient::networkInfoControllerDestroyed): Ditto.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess): Add the WebNetworkInfoManager instance as a supplement.
* WebProcess/WebProcess.h:
(WebProcess): Remove the m_networkInfoManager member variable and its getter method.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp
Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h
Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h

index ea3a31e..2664b7e 100644 (file)
@@ -1,5 +1,34 @@
 2013-05-08  Zan Dobersek  <zdobersek@igalia.com>
 
+        [WK2] Make the WebNetworkInfoManager a supplement to the WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=115716
+
+        Reviewed by Andreas Kling.
+
+        WebNetworkInfoManager should inherit from WebProcessSupplement and should be used
+        as such by the WebProcess. This removes the need for the m_networkInfoManager member
+        variable in the WebProcess class and brings the WebNetworkInfoManager in line with
+        other manager classes of which instances are controlled by the WebProcess class.
+
+        * WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:
+        (WebKit::WebNetworkInfoManager::supplementName): Specify the supplement's name.
+        (WebKit):
+        * WebProcess/NetworkInfo/WebNetworkInfoManager.h:
+        (WebKit): Alphabetically reorder the two forwarding declarations.
+        (WebNetworkInfoManager): Inherit from the WebProcessSupplement interface.
+        * WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp:
+        (WebKit::WebNetworkInfoClient::bandwidth): Access the WebNetworkInfoManager as a supplement.
+        (WebKit::WebNetworkInfoClient::metered): Ditto.
+        (WebKit::WebNetworkInfoClient::startUpdating): Ditto.
+        (WebKit::WebNetworkInfoClient::stopUpdating): Ditto.
+        (WebKit::WebNetworkInfoClient::networkInfoControllerDestroyed): Ditto.
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess): Add the WebNetworkInfoManager instance as a supplement.
+        * WebProcess/WebProcess.h:
+        (WebProcess): Remove the m_networkInfoManager member variable and its getter method.
+
+2013-05-08  Zan Dobersek  <zdobersek@igalia.com>
+
         [WK2] Make the WebBatteryManager a supplement to the WebProcess
         https://bugs.webkit.org/show_bug.cgi?id=115715
 
index cacab2a..6dbe7b0 100644 (file)
@@ -40,6 +40,11 @@ using namespace WebCore;
 
 namespace WebKit {
 
+const char* WebNetworkInfoManager::supplementName()
+{
+    return "WebNetworkInfoManager";
+}
+
 WebNetworkInfoManager::WebNetworkInfoManager(WebProcess* process)
     : m_process(process)
 {
index 889105f..2768153 100644 (file)
 #include "MessageReceiver.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebNetworkInfo.h"
+#include "WebProcessSupplement.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebKit {
 
-class WebProcess;
 class WebPage;
+class WebProcess;
 
-class WebNetworkInfoManager : private CoreIPC::MessageReceiver {
+class WebNetworkInfoManager : public WebProcessSupplement, private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebNetworkInfoManager);
 public:
     explicit WebNetworkInfoManager(WebProcess*);
     ~WebNetworkInfoManager();
 
+    static const char* supplementName();
+
     void registerWebPage(WebPage*);
     void unregisterWebPage(WebPage*);
 
index 7561c14..2fd1a72 100644 (file)
@@ -40,27 +40,27 @@ WebNetworkInfoClient::~WebNetworkInfoClient()
 
 double WebNetworkInfoClient::bandwidth() const
 {
-    return WebProcess::shared().networkInfoManager().bandwidth(m_page);
+    return WebProcess::shared().supplement<WebNetworkInfoManager>()->bandwidth(m_page);
 }
 
 bool WebNetworkInfoClient::metered() const
 {
-    return WebProcess::shared().networkInfoManager().metered(m_page);
+    return WebProcess::shared().supplement<WebNetworkInfoManager>()->metered(m_page);
 }
 
 void WebNetworkInfoClient::startUpdating()
 {
-    WebProcess::shared().networkInfoManager().registerWebPage(m_page);
+    WebProcess::shared().supplement<WebNetworkInfoManager>()->registerWebPage(m_page);
 }
 
 void WebNetworkInfoClient::stopUpdating()
 {
-    WebProcess::shared().networkInfoManager().unregisterWebPage(m_page);
+    WebProcess::shared().supplement<WebNetworkInfoManager>()->unregisterWebPage(m_page);
 }
 
 void WebNetworkInfoClient::networkInfoControllerDestroyed()
 {
-    WebProcess::shared().networkInfoManager().unregisterWebPage(m_page);
+    WebProcess::shared().supplement<WebNetworkInfoManager>()->unregisterWebPage(m_page);
     delete this;
 }
 
index ada374c..f5017c0 100644 (file)
@@ -86,6 +86,7 @@
 #include <wtf/text/StringHash.h>
 
 #if ENABLE(NETWORK_INFO)
+#include "WebNetworkInfoManager.h"
 #include "WebNetworkInfoManagerMessages.h"
 #endif
 
@@ -164,9 +165,6 @@ WebProcess::WebProcess()
     , m_networkAccessManager(0)
 #endif
     , m_textCheckerState()
-#if ENABLE(NETWORK_INFO)
-    , m_networkInfoManager(this)
-#endif
     , m_iconDatabaseProxy(new WebIconDatabaseProxy(this))
 #if ENABLE(NETWORK_PROCESS)
     , m_usesNetworkProcess(false)
@@ -211,6 +209,9 @@ WebProcess::WebProcess()
 #if ENABLE(BATTERY_STATUS)
     addSupplement<WebBatteryManager>();
 #endif
+#if ENABLE(NETWORK_INFO)
+    addSupplement<WebNetworkInfoManager>();
+#endif
 }
 
 void WebProcess::initializeProcess(const ChildProcessInitializationParameters& parameters)
index 1c7a91f..047e3d8 100644 (file)
@@ -57,10 +57,6 @@ QT_END_NAMESPACE
 #include <dispatch/dispatch.h>
 #endif
 
-#if ENABLE(NETWORK_INFO)
-#include "WebNetworkInfoManager.h"
-#endif
-
 namespace WebCore {
 class PageGroup;
 class ResourceRequest;
@@ -148,9 +144,6 @@ public:
 #if PLATFORM(QT)
     QNetworkAccessManager* networkAccessManager() { return m_networkAccessManager; }
 #endif
-#if ENABLE(NETWORK_INFO)
-    WebNetworkInfoManager& networkInfoManager() { return m_networkInfoManager; }
-#endif
 #if USE(SOUP)
     WebSoupRequestManager& soupRequestManager() { return m_soupRequestManager; }
 #endif
@@ -310,9 +303,6 @@ private:
 
     TextCheckerState m_textCheckerState;
 
-#if ENABLE(NETWORK_INFO)
-    WebNetworkInfoManager m_networkInfoManager;
-#endif
     WebIconDatabaseProxy* m_iconDatabaseProxy;
 
 #if ENABLE(NETWORK_PROCESS)