[WK2] Make the WebSoupRequestManager a supplement to the WebProcess
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2013 17:16:54 +0000 (17:16 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2013 17:16:54 +0000 (17:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115717

Reviewed by Andreas Kling.

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

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess): Add  the WebSoupRequestManager as a supplement.
* WebProcess/WebProcess.h:
(WebProcess): Remove the m_soupRequestManager member variable and its getter method.
* WebProcess/soup/WebKitSoupRequestGeneric.cpp:
(webkitSoupRequestGenericSendAsync): Access the WebSoupRequestManager as a supplement.
(webkitSoupRequestGenericSendFinish): Ditto.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Access the WebSoupRequestManager as a supplement.
* WebProcess/soup/WebSoupRequestManager.cpp:
(WebKit::WebSoupRequestManager::supplementName): Specify the supplement's name.
* WebProcess/soup/WebSoupRequestManager.h:
(WebSoupRequestManager): Inherit from the WebProcessSupplement interface.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp
Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp
Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp
Source/WebKit2/WebProcess/soup/WebSoupRequestManager.h

index 4542b4a..0928ab0 100644 (file)
@@ -1,3 +1,29 @@
+2013-05-10  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WK2] Make the WebSoupRequestManager a supplement to the WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=115717
+
+        Reviewed by Andreas Kling.
+
+        WebSoupRequestManager should inherit from WebProcessSupplement and should be used as such
+        by the WebProcess. This removes the need for the m_soupRequestManager member variable in
+        the WebProcess class and brings the WebSoupRequestManager in line with other manager classes
+        of which instances are controlled by the WebProcess class.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess): Add  the WebSoupRequestManager as a supplement.
+        * WebProcess/WebProcess.h:
+        (WebProcess): Remove the m_soupRequestManager member variable and its getter method.
+        * WebProcess/soup/WebKitSoupRequestGeneric.cpp:
+        (webkitSoupRequestGenericSendAsync): Access the WebSoupRequestManager as a supplement.
+        (webkitSoupRequestGenericSendFinish): Ditto.
+        * WebProcess/soup/WebProcessSoup.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess): Access the WebSoupRequestManager as a supplement.
+        * WebProcess/soup/WebSoupRequestManager.cpp:
+        (WebKit::WebSoupRequestManager::supplementName): Specify the supplement's name.
+        * WebProcess/soup/WebSoupRequestManager.h:
+        (WebSoupRequestManager): Inherit from the WebProcessSupplement interface.
+
 2013-05-10  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Remove unnecessary GLIB_CHECK_VERSION #ifdefs
index 94361f6..d8cc61c 100644 (file)
 #include "SecItemShim.h"
 #endif
 
+#if USE(SOUP)
+#include "WebSoupRequestManager.h"
+#endif
+
 using namespace JSC;
 using namespace WebCore;
 
@@ -173,9 +177,6 @@ WebProcess::WebProcess()
 #if ENABLE(PLUGIN_PROCESS)
     , m_pluginProcessConnectionManager(PluginProcessConnectionManager::create())
 #endif
-#if USE(SOUP)
-    , m_soupRequestManager(this)
-#endif
     , m_inWindowPageCount(0)
     , m_nonVisibleProcessCleanupTimer(this, &WebProcess::nonVisibleProcessCleanupTimerFired)
 {
@@ -212,6 +213,9 @@ WebProcess::WebProcess()
 #if ENABLE(NETWORK_INFO)
     addSupplement<WebNetworkInfoManager>();
 #endif
+#if USE(SOUP)
+    addSupplement<WebSoupRequestManager>();
+#endif
 }
 
 void WebProcess::initializeProcess(const ChildProcessInitializationParameters& parameters)
index 151af6f..c10b4b7 100644 (file)
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/AtomicStringHash.h>
 
-#if USE(SOUP)
-#include "WebSoupRequestManager.h"
-#endif
-
 #if PLATFORM(QT)
 QT_BEGIN_NAMESPACE
 class QNetworkAccessManager;
@@ -144,9 +140,6 @@ public:
 #if PLATFORM(QT)
     QNetworkAccessManager* networkAccessManager() { return m_networkAccessManager; }
 #endif
-#if USE(SOUP)
-    WebSoupRequestManager& soupRequestManager() { return m_soupRequestManager; }
-#endif
 
     void clearResourceCaches(ResourceCachesToClear = AllResourceCaches);
     
@@ -316,10 +309,6 @@ private:
     RefPtr<PluginProcessConnectionManager> m_pluginProcessConnectionManager;
 #endif
 
-#if USE(SOUP)
-    WebSoupRequestManager m_soupRequestManager;
-#endif
-    
     int m_inWindowPageCount;
     WebCore::Timer<WebProcess> m_nonVisibleProcessCleanupTimer;
 };
index 8b251b8..2492da6 100644 (file)
@@ -21,6 +21,7 @@
 #include "WebKitSoupRequestGeneric.h"
 
 #include "WebProcess.h"
+#include "WebSoupRequestManager.h"
 #include <wtf/text/CString.h>
 
 using namespace WebKit;
@@ -48,7 +49,7 @@ static void webkit_soup_request_generic_init(WebKitSoupRequestGeneric* request)
 static void webkitSoupRequestGenericSendAsync(SoupRequest* request, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData)
 {
     GSimpleAsyncResult* result = g_simple_async_result_new(G_OBJECT(request), callback, userData, reinterpret_cast<void*>(webkitSoupRequestGenericSendAsync));
-    WebProcess::shared().soupRequestManager().send(result, cancellable);
+    WebProcess::shared().supplement<WebSoupRequestManager>()->send(result, cancellable);
 }
 
 static GInputStream* webkitSoupRequestGenericSendFinish(SoupRequest*, GAsyncResult* result, GError** error)
@@ -59,7 +60,7 @@ static GInputStream* webkitSoupRequestGenericSendFinish(SoupRequest*, GAsyncResu
     if (g_simple_async_result_propagate_error(simpleResult, error))
         return 0;
 
-    return WebProcess::shared().soupRequestManager().finish(simpleResult);
+    return WebProcess::shared().supplement<WebSoupRequestManager>()->finish(simpleResult);
 }
 
 static goffset webkitSoupRequestGenericGetContentLength(SoupRequest* request)
index 0701eba..c7bea92 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "WebCookieManager.h"
 #include "WebProcessCreationParameters.h"
+#include "WebSoupRequestManager.h"
 #include <WebCore/FileSystem.h>
 #include <WebCore/Language.h>
 #include <WebCore/MemoryCache.h>
@@ -184,7 +185,7 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
         setSoupSessionAcceptLanguage(parameters.languages);
 
     for (size_t i = 0; i < parameters.urlSchemesRegistered.size(); i++)
-        m_soupRequestManager.registerURIScheme(parameters.urlSchemesRegistered[i]);
+        supplement<WebSoupRequestManager>()->registerURIScheme(parameters.urlSchemesRegistered[i]);
 
     if (!parameters.cookiePersistentStoragePath.isEmpty()) {
         supplement<WebCookieManager>()->setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
index 744082a..35d205a 100644 (file)
@@ -75,6 +75,11 @@ struct WebSoupRequestAsyncData {
     GRefPtr<GInputStream> stream;
 };
 
+const char* WebSoupRequestManager::supplementName()
+{
+    return "WebSoupRequestManager";
+}
+
 WebSoupRequestManager::WebSoupRequestManager(WebProcess* process)
     : m_process(process)
     , m_schemes(adoptGRef(g_ptr_array_new_with_free_func(g_free)))
index 08cd343..6ca7ec8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "DataReference.h"
 #include "MessageReceiver.h"
+#include "WebProcessSupplement.h"
 #include <WebCore/ResourceError.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
@@ -37,12 +38,14 @@ namespace WebKit {
 class WebProcess;
 struct WebSoupRequestAsyncData;
 
-class WebSoupRequestManager : private CoreIPC::MessageReceiver {
+class WebSoupRequestManager : public WebProcessSupplement, private CoreIPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebSoupRequestManager);
 public:
     explicit WebSoupRequestManager(WebProcess*);
     ~WebSoupRequestManager();
 
+    static const char* supplementName();
+
     void send(GSimpleAsyncResult*, GCancellable*);
     GInputStream* finish(GSimpleAsyncResult*);