Commit 01c50313 authored by zandobersek@gmail.com's avatar zandobersek@gmail.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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 25f2be0a
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
......
......@@ -131,6 +131,10 @@
#include "SecItemShim.h"
#endif
#if USE(SOUP)
#include "WebSoupRequestManager.h"
#endif
using namespace JSC;
using namespace WebCore;
......@@ -172,9 +176,6 @@ WebProcess::WebProcess()
#endif
#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)
......
......@@ -43,10 +43,6 @@
#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;
};
......
......@@ -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)
......
......@@ -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,
......
......@@ -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)))
......
......@@ -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*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment