Title: [149720] trunk/Source/WebKit2
Revision
149720
Author
[email protected]
Date
2013-05-08 01:06:00 -0700 (Wed, 08 May 2013)

Log Message

[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.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (149719 => 149720)


--- trunk/Source/WebKit2/ChangeLog	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-08 08:06:00 UTC (rev 149720)
@@ -1,5 +1,34 @@
 2013-05-08  Zan Dobersek  <[email protected]>
 
+        [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  <[email protected]>
+
         [WK2] Make the WebBatteryManager a supplement to the WebProcess
         https://bugs.webkit.org/show_bug.cgi?id=115715
 

Modified: trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp (149719 => 149720)


--- trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp	2013-05-08 08:06:00 UTC (rev 149720)
@@ -40,6 +40,11 @@
 
 namespace WebKit {
 
+const char* WebNetworkInfoManager::supplementName()
+{
+    return "WebNetworkInfoManager";
+}
+
 WebNetworkInfoManager::WebNetworkInfoManager(WebProcess* process)
     : m_process(process)
 {

Modified: trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h (149719 => 149720)


--- trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.h	2013-05-08 08:06:00 UTC (rev 149720)
@@ -31,21 +31,24 @@
 #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 WebPage;
 class WebProcess;
-class WebPage;
 
-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*);
 

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp (149719 => 149720)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp	2013-05-08 08:06:00 UTC (rev 149720)
@@ -40,27 +40,27 @@
 
 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;
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (149719 => 149720)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2013-05-08 08:06:00 UTC (rev 149720)
@@ -86,6 +86,7 @@
 #include <wtf/text/StringHash.h>
 
 #if ENABLE(NETWORK_INFO)
+#include "WebNetworkInfoManager.h"
 #include "WebNetworkInfoManagerMessages.h"
 #endif
 
@@ -164,9 +165,6 @@
     , 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 @@
 #if ENABLE(BATTERY_STATUS)
     addSupplement<WebBatteryManager>();
 #endif
+#if ENABLE(NETWORK_INFO)
+    addSupplement<WebNetworkInfoManager>();
+#endif
 }
 
 void WebProcess::initializeProcess(const ChildProcessInitializationParameters& parameters)

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (149719 => 149720)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2013-05-08 08:02:28 UTC (rev 149719)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2013-05-08 08:06:00 UTC (rev 149720)
@@ -57,10 +57,6 @@
 #include <dispatch/dispatch.h>
 #endif
 
-#if ENABLE(NETWORK_INFO)
-#include "WebNetworkInfoManager.h"
-#endif
-
 namespace WebCore {
 class PageGroup;
 class ResourceRequest;
@@ -148,9 +144,6 @@
 #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 @@
 
     TextCheckerState m_textCheckerState;
 
-#if ENABLE(NETWORK_INFO)
-    WebNetworkInfoManager m_networkInfoManager;
-#endif
     WebIconDatabaseProxy* m_iconDatabaseProxy;
 
 #if ENABLE(NETWORK_PROCESS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to