WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Try to fix mac build
wk2-soup-custom-protocols.diff (text/plain), 64.61 KB, created by
Carlos Garcia Campos
on 2014-01-17 05:18:50 PST
(
hide
)
Description:
Try to fix mac build
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2014-01-17 05:18:50 PST
Size:
64.61 KB
patch
obsolete
>diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 28a41b6..34f2d87 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,5 +1,111 @@ > 2014-01-16 Carlos Garcia Campos <cgarcia@igalia.com> > >+ [SOUP] Implement CUSTOM PROTOCOLS >+ https://bugs.webkit.org/show_bug.cgi?id=125583 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add new classes to implement CustomProtocols for soup. The >+ implementation is the same, but using the CustomProtocol API and >+ messages. The current implementation can be removed once all ports >+ using soup switch to using CustomProtocols. >+ >+ * GNUmakefile.am: Add new include paths. >+ * GNUmakefile.list.am: Add new files to compilation. >+ * PlatformGTK.cmake: Add new files to compilation. >+ * Shared/API/c/soup/WKBaseSoup.h: >+ * Shared/APIObject.h: >+ * Shared/Network/CustomProtocols/CustomProtocolManager.h: >+ * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp: Added. >+ (WebKit::generateCustomProtocolID): >+ (WebKit::WebSoupRequestAsyncData::WebSoupRequestAsyncData): >+ (WebKit::WebSoupRequestAsyncData::~WebSoupRequestAsyncData): >+ (WebKit::WebSoupRequestAsyncData::requestFailed): >+ (WebKit::WebSoupRequestAsyncData::releaseTask): >+ (WebKit::CustomProtocolManagerImpl::CustomProtocolManagerImpl): >+ (WebKit::CustomProtocolManagerImpl::~CustomProtocolManagerImpl): >+ (WebKit::CustomProtocolManagerImpl::registerScheme): >+ (WebKit::CustomProtocolManagerImpl::supportsScheme): >+ (WebKit::CustomProtocolManagerImpl::didFailWithError): >+ (WebKit::CustomProtocolManagerImpl::didLoadData): >+ (WebKit::CustomProtocolManagerImpl::didReceiveResponse): >+ (WebKit::CustomProtocolManagerImpl::didFinishLoading): >+ (WebKit::CustomProtocolManagerImpl::send): >+ (WebKit::CustomProtocolManagerImpl::finish): >+ * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h: Added. >+ * Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp: >+ (WebKit::CustomProtocolManager::CustomProtocolManager): >+ (WebKit::CustomProtocolManager::initialize): >+ (WebKit::CustomProtocolManager::registerScheme): >+ (WebKit::CustomProtocolManager::supportsScheme): >+ (WebKit::CustomProtocolManager::didFailWithError): >+ (WebKit::CustomProtocolManager::didLoadData): >+ (WebKit::CustomProtocolManager::didReceiveResponse): >+ (WebKit::CustomProtocolManager::didFinishLoading): >+ * Shared/WebProcessCreationParameters.cpp: >+ (WebKit::WebProcessCreationParameters::encode): >+ (WebKit::WebProcessCreationParameters::decode): >+ * Shared/WebProcessCreationParameters.h: >+ * UIProcess/API/C/soup/WKAPICastSoup.h: >+ * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Copied from Source/WebKit2/UIProcess/soup/WebContextSoup.cpp. >+ (WKSoupCustomProtocolRequestManagerGetTypeID): >+ (WKSoupCustomProtocolRequestManagerSetClient): >+ * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Added. >+ * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h: >+ * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm: >+ (WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy): >+ * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp: >+ (WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy): >+ (WebKit::CustomProtocolManagerProxy::startLoading): >+ (WebKit::CustomProtocolManagerProxy::stopLoading): >+ * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Added. >+ (WebKit::WebSoupCustomProtocolRequestManager::supplementName): >+ (WebKit::WebSoupCustomProtocolRequestManager::create): >+ (WebKit::WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager): >+ (WebKit::WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager): >+ (WebKit::WebSoupCustomProtocolRequestManager::initializeClient): >+ (WebKit::WebSoupCustomProtocolRequestManager::contextDestroyed): >+ (WebKit::WebSoupCustomProtocolRequestManager::processDidClose): >+ (WebKit::WebSoupCustomProtocolRequestManager::refWebContextSupplement): >+ (WebKit::WebSoupCustomProtocolRequestManager::derefWebContextSupplement): >+ (WebKit::WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol): >+ (WebKit::WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol): >+ (WebKit::WebSoupCustomProtocolRequestManager::startLoading): >+ (WebKit::WebSoupCustomProtocolRequestManager::stopLoading): >+ (WebKit::WebSoupCustomProtocolRequestManager::didReceiveResponse): >+ (WebKit::WebSoupCustomProtocolRequestManager::didLoadData): >+ (WebKit::WebSoupCustomProtocolRequestManager::didFailWithError): >+ (WebKit::WebSoupCustomProtocolRequestManager::didFinishLoading): >+ * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Added. >+ (WebKit::WebSoupCustomProtocolRequestManager::registeredSchemesForCustomProtocols): >+ * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Added. >+ (WebKit::WebSoupCustomProtocolRequestManagerClient::startLoading): >+ (WebKit::WebSoupCustomProtocolRequestManagerClient::stopLoading): >+ * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Added. >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::NetworkProcessProxy): >+ * UIProcess/WebContext.cpp: >+ (WebKit::WebContext::WebContext): >+ * UIProcess/WebPageProxy.cpp: >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/WebProcessProxy.cpp: >+ (WebKit::WebProcessProxy::WebProcessProxy): >+ * UIProcess/gtk/WebContextGtk.cpp: >+ (WebKit::WebContext::platformInitializeWebProcess): >+ * UIProcess/soup/WebContextSoup.cpp: >+ (WebKit::WebContext::platformInitializeNetworkProcess): >+ * WebProcess/WebProcess.cpp: >+ (WebKit::WebProcess::WebProcess): >+ * WebProcess/soup/WebKitSoupRequestGeneric.cpp: >+ (webkitSoupRequestGenericSendAsync): >+ (webkitSoupRequestGenericSendFinish): >+ * WebProcess/soup/WebKitSoupRequestGeneric.h: >+ * WebProcess/soup/WebProcessSoup.cpp: >+ (WebKit::WebProcess::platformInitializeWebProcess): >+ >+2014-01-16 Carlos Garcia Campos <cgarcia@igalia.com> >+ > [SOUP] Add stubs for CustomProtocol classes > https://bugs.webkit.org/show_bug.cgi?id=126343 > >diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am >index cbaccbf..1b453c4 100644 >--- a/Source/WebKit2/GNUmakefile.am >+++ b/Source/WebKit2/GNUmakefile.am >@@ -104,6 +104,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP > -I$(srcdir)/Source/WebKit2/Shared/gtk \ > -I$(srcdir)/Source/WebKit2/Shared/Network \ > -I$(srcdir)/Source/WebKit2/Shared/Network/CustomProtocols \ >+ -I$(srcdir)/Source/WebKit2/Shared/Network/CustomProtocols/soup \ > -I$(srcdir)/Source/WebKit2/Shared/Plugins \ > -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape \ > -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape/x11 \ >@@ -122,6 +123,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP > -I$(srcdir)/Source/WebKit2/UIProcess/Launcher/gtk \ > -I$(srcdir)/Source/WebKit2/UIProcess/Network \ > -I$(srcdir)/Source/WebKit2/UIProcess/Network/CustomProtocols \ >+ -I$(srcdir)/Source/WebKit2/UIProcess/Network/CustomProtocols/soup \ > -I$(srcdir)/Source/WebKit2/UIProcess/Notifications \ > -I$(srcdir)/Source/WebKit2/UIProcess/Plugins \ > -I$(srcdir)/Source/WebKit2/UIProcess/Plugins/unix \ >diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am >index 99c118f..44a0155 100644 >--- a/Source/WebKit2/GNUmakefile.list.am >+++ b/Source/WebKit2/GNUmakefile.list.am >@@ -403,6 +403,8 @@ webkit2_sources += \ > Source/WebKit2/Shared/NativeWebMouseEvent.h \ > Source/WebKit2/Shared/NativeWebWheelEvent.h \ > Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h \ >+ Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h \ >+ Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp \ > Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp \ > Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp \ > Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h \ >@@ -521,6 +523,8 @@ webkit2_sources += \ > Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h \ > Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.cpp \ > Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h \ >+ Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp \ >+ Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h \ > Source/WebKit2/UIProcess/API/C/WebKit2_C.h \ > Source/WebKit2/UIProcess/API/C/WKAPICast.h \ > Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h \ >@@ -837,6 +841,10 @@ webkit2_sources += \ > Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h \ > Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h \ > Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp \ >+ Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp \ >+ Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h \ >+ Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp \ >+ Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h \ > Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp \ > Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h \ > Source/WebKit2/UIProcess/Network/soup/NetworkProcessProxySoup.cpp \ >diff --git a/Source/WebKit2/PlatformGTK.cmake b/Source/WebKit2/PlatformGTK.cmake >index 0405feb..258a80c 100644 >--- a/Source/WebKit2/PlatformGTK.cmake >+++ b/Source/WebKit2/PlatformGTK.cmake >@@ -37,6 +37,7 @@ list(APPEND WebKit2_SOURCES > > Shared/Downloads/soup/DownloadSoup.cpp > >+ Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp > Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp > > Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp >@@ -78,6 +79,7 @@ list(APPEND WebKit2_SOURCES > UIProcess/API/C/soup/WKContextSoup.cpp > UIProcess/API/C/soup/WKCookieManagerSoup.cpp > UIProcess/API/C/soup/WKSoupRequestManager.cpp >+ UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp > > UIProcess/API/gtk/PageClientImpl.cpp > UIProcess/API/gtk/PageClientImpl.h >@@ -236,6 +238,8 @@ list(APPEND WebKit2_SOURCES > UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp > > UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp >+ UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp >+ UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp > > UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp > UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp >@@ -397,6 +401,7 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > "${WEBKIT2_DIR}/UIProcess/API/C/soup" > "${WEBKIT2_DIR}/UIProcess/API/cpp/gtk" > "${WEBKIT2_DIR}/UIProcess/API/gtk" >+ "${WEBKIT2_DIR}/UIProcess/Network/CustomProtocols/soup" > "${WEBKIT2_DIR}/UIProcess/gtk" > "${WEBKIT2_DIR}/UIProcess/soup" > "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk" >diff --git a/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h b/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h >index 6189e4c..600f085 100644 >--- a/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h >+++ b/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h >@@ -31,5 +31,6 @@ > #endif > > typedef const struct OpaqueWKSoupRequestManager* WKSoupRequestManagerRef; >+typedef const struct OpaqueWKSoupCustomProtocolRequestManager* WKSoupCustomProtocolRequestManagerRef; > > #endif /* WKBaseSoup_h */ >diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h >index 52bef14..38155d1 100644 >--- a/Source/WebKit2/Shared/APIObject.h >+++ b/Source/WebKit2/Shared/APIObject.h >@@ -158,6 +158,7 @@ public: > View, > #if USE(SOUP) > SoupRequestManager, >+ SoupCustomProtocolRequestManager, > #endif > #if PLATFORM(EFL) > PopupMenuItem, >diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h b/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h >index 83bc91f..fda8107 100644 >--- a/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h >+++ b/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h >@@ -32,13 +32,13 @@ > #include "NetworkProcessSupplement.h" > #include "WebProcessSupplement.h" > #include "WorkQueue.h" >-#include <wtf/HashSet.h> >-#include <wtf/Threading.h> > #include <wtf/text/WTFString.h> > > #if PLATFORM(MAC) > #include <wtf/HashMap.h> >+#include <wtf/HashSet.h> > #include <wtf/RetainPtr.h> >+#include <wtf/Threading.h> > OBJC_CLASS WKCustomProtocol; > #endif > >@@ -55,6 +55,7 @@ class ResourceResponse; > namespace WebKit { > > class ChildProcess; >+class CustomProtocolManagerImpl; > struct NetworkProcessCreationParameters; > > class CustomProtocolManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::Connection::WorkQueueMessageReceiver { >@@ -95,12 +96,13 @@ private: > void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy); > void didFinishLoading(uint64_t customProtocolID); > >- HashSet<String> m_registeredSchemes; >- Mutex m_registeredSchemesMutex; > ChildProcess* m_childProcess; > RefPtr<WorkQueue> m_messageQueue; > > #if PLATFORM(MAC) >+ HashSet<String> m_registeredSchemes; >+ Mutex m_registeredSchemesMutex; >+ > typedef HashMap<uint64_t, RetainPtr<WKCustomProtocol>> CustomProtocolMap; > CustomProtocolMap m_customProtocolMap; > Mutex m_customProtocolMapMutex; >@@ -108,6 +110,9 @@ private: > // WKCustomProtocol objects can be removed from the m_customProtocolMap from multiple threads. > // We return a RetainPtr here because it is unsafe to return a raw pointer since the object might immediately be destroyed from a different thread. > RetainPtr<WKCustomProtocol> protocolForID(uint64_t customProtocolID); >+#else >+ // FIXME: Move mac specific code to CustomProtocolManagerImpl. >+ std::unique_ptr<CustomProtocolManagerImpl> m_impl; > #endif > }; > >diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp >new file mode 100644 >index 0000000..2860d2c >--- /dev/null >+++ b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp >@@ -0,0 +1,208 @@ >+/* >+ * Copyright (C) 2014 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "CustomProtocolManagerImpl.h" >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+#include "ChildProcess.h" >+#include "CustomProtocolManagerProxyMessages.h" >+#include "DataReference.h" >+#include "WebCoreArgumentCoders.h" >+#include "WebKitSoupRequestGeneric.h" >+#include "WebKitSoupRequestInputStream.h" >+#include <WebCore/ResourceError.h> >+#include <WebCore/ResourceRequest.h> >+#include <WebCore/ResourceResponse.h> >+#include <WebCore/SoupNetworkSession.h> >+#include <WebCore/SoupURIUtils.h> >+ >+namespace WebKit { >+ >+static uint64_t generateCustomProtocolID() >+{ >+ static uint64_t uniqueCustomProtocolID = 0; >+ return ++uniqueCustomProtocolID; >+} >+ >+struct WebSoupRequestAsyncData { >+ WebSoupRequestAsyncData(GTask* task, WebKitSoupRequestGeneric* requestGeneric) >+ : task(task) >+ , request(requestGeneric) >+ , cancellable(g_task_get_cancellable(task)) >+ { >+ // If the struct contains a null request, it is because the request failed. >+ g_object_add_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request)); >+ } >+ >+ ~WebSoupRequestAsyncData() >+ { >+ if (request) >+ g_object_remove_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request)); >+ } >+ >+ bool requestFailed() >+ { >+ return g_cancellable_is_cancelled(cancellable.get()) || !request; >+ } >+ >+ GRefPtr<GTask> releaseTask() >+ { >+ GTask* returnValue = task; >+ task = nullptr; >+ return adoptGRef(returnValue); >+ } >+ >+ GTask* task; >+ WebKitSoupRequestGeneric* request; >+ GRefPtr<GCancellable> cancellable; >+ GRefPtr<GInputStream> stream; >+}; >+ >+CustomProtocolManagerImpl::CustomProtocolManagerImpl(ChildProcess* childProcess) >+ : m_childProcess(childProcess) >+ , m_schemes(adoptGRef(g_ptr_array_new_with_free_func(g_free))) >+{ >+} >+ >+CustomProtocolManagerImpl::~CustomProtocolManagerImpl() >+{ >+} >+ >+void CustomProtocolManagerImpl::registerScheme(const String& scheme) >+{ >+ if (m_schemes->len) >+ g_ptr_array_remove_index_fast(m_schemes.get(), m_schemes->len - 1); >+ g_ptr_array_add(m_schemes.get(), g_strdup(scheme.utf8().data())); >+ g_ptr_array_add(m_schemes.get(), nullptr); >+ >+ SoupSession* session = WebCore::SoupNetworkSession::defaultSession().soupSession(); >+ SoupRequestClass* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC)); >+ genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_schemes->pdata)); >+ static_cast<WebKitSoupRequestGenericClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC))->customProtocolManager = this; >+ soup_session_add_feature_by_type(session, WEBKIT_TYPE_SOUP_REQUEST_GENERIC); >+} >+ >+bool CustomProtocolManagerImpl::supportsScheme(const String& scheme) >+{ >+ if (scheme.isNull()) >+ return false; >+ >+ CString cScheme = scheme.utf8(); >+ for (unsigned i = 0; i < m_schemes->len; ++i) { >+ if (cScheme == static_cast<char*>(g_ptr_array_index(m_schemes.get(), i))) >+ return true; >+ } >+ >+ return false; >+} >+ >+void CustomProtocolManagerImpl::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) >+{ >+ WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); >+ ASSERT(data); >+ >+ GRefPtr<GTask> task = data->releaseTask(); >+ ASSERT(task.get()); >+ g_task_return_new_error(task.get(), g_quark_from_string(error.domain().utf8().data()), >+ error.errorCode(), "%s", error.localizedDescription().utf8().data()); >+ >+ m_customProtocolMap.remove(customProtocolID); >+} >+ >+void CustomProtocolManagerImpl::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference) >+{ >+ WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); >+ // The data might have been removed from the request map if a previous chunk failed >+ // and a new message was sent by the UI process before being notified about the failure. >+ if (!data) >+ return; >+ >+ if (!data->stream) { >+ GRefPtr<GTask> task = data->releaseTask(); >+ ASSERT(task.get()); >+ >+ goffset soupContentLength = soup_request_get_content_length(SOUP_REQUEST(g_task_get_source_object(task.get()))); >+ uint64_t contentLength = soupContentLength == -1 ? 0 : static_cast<uint64_t>(soupContentLength); >+ if (!dataReference.size()) { >+ // Empty reply, just create and empty GMemoryInputStream. >+ data->stream = g_memory_input_stream_new(); >+ } else if (dataReference.size() == contentLength) { >+ // We don't expect more data, so we can just create a GMemoryInputStream with all the data. >+ data->stream = g_memory_input_stream_new_from_data(g_memdup(dataReference.data(), dataReference.size()), contentLength, g_free); >+ } else { >+ // We expect more data chunks from the UI process. >+ data->stream = webkitSoupRequestInputStreamNew(contentLength); >+ webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size()); >+ } >+ g_task_return_pointer(task.get(), data->stream.get(), g_object_unref); >+ return; >+ } >+ >+ if (data->requestFailed()) { >+ // ResourceRequest failed or it was cancelled. It doesn't matter here the error or if it was cancelled, >+ // because that's already handled by the resource handle client, we just want to notify the UI process >+ // to stop reading data from the user input stream. If UI process already sent all the data we simply >+ // finish silently. >+ if (!webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()))) >+ m_childProcess->send(Messages::CustomProtocolManagerProxy::StopLoading(customProtocolID), 0); >+ >+ return; >+ } >+ >+ webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size()); >+} >+ >+void CustomProtocolManagerImpl::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response) >+{ >+ WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID); >+ ASSERT(data); >+ ASSERT(data->task); >+ >+ WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(data->task)); >+ webkitSoupRequestGenericSetContentLength(request, response.expectedContentLength() ? response.expectedContentLength() : -1); >+ webkitSoupRequestGenericSetContentType(request, !response.mimeType().isEmpty() ? response.mimeType().utf8().data() : 0); >+} >+ >+void CustomProtocolManagerImpl::didFinishLoading(uint64_t customProtocolID) >+{ >+ ASSERT(m_customProtocolMap.contains(customProtocolID)); >+ m_customProtocolMap.remove(customProtocolID); >+} >+ >+void CustomProtocolManagerImpl::send(GTask* task) >+{ >+ uint64_t customProtocolID = generateCustomProtocolID(); >+ WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(task)); >+ m_customProtocolMap.set(customProtocolID, std::make_unique<WebSoupRequestAsyncData>(task, request)); >+ >+ WebCore::ResourceRequest resourceRequest(WebCore::soupURIToKURL(soup_request_get_uri(SOUP_REQUEST(request)))); >+ m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, resourceRequest), 0); >+} >+ >+GInputStream* CustomProtocolManagerImpl::finish(GTask* task, GError** error) >+{ >+ gpointer inputStream = g_task_propagate_pointer(task, error); >+ return inputStream ? G_INPUT_STREAM(inputStream) : 0; >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h >new file mode 100644 >index 0000000..1d44241 >--- /dev/null >+++ b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2014 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef CustomProtocolManagerImpl_h >+#define CustomProtocolManagerImpl_h >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+#include <wtf/HashMap.h> >+#include <wtf/gobject/GRefPtr.h> >+#include <wtf/text/WTFString.h> >+ >+typedef struct _GTask GTask; >+typedef struct _GInputStream GInputStream; >+ >+namespace IPC { >+class DataReference; >+} // namespace IPC >+ >+namespace WebCore { >+class ResourceError; >+class ResourceResponse; >+} // namespace WebCore >+ >+namespace WebKit { >+ >+class ChildProcess; >+struct WebSoupRequestAsyncData; >+ >+class CustomProtocolManagerImpl { >+ WTF_MAKE_NONCOPYABLE(CustomProtocolManagerImpl); >+public: >+ explicit CustomProtocolManagerImpl(ChildProcess*); >+ ~CustomProtocolManagerImpl(); >+ >+ void registerScheme(const String&); >+ bool supportsScheme(const String&); >+ >+ void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&); >+ void didLoadData(uint64_t customProtocolID, const IPC::DataReference&); >+ void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&); >+ void didFinishLoading(uint64_t customProtocolID); >+ >+ // SoupRequest implementation. >+ void send(GTask*); >+ GInputStream* finish(GTask*, GError**); >+ >+private: >+ ChildProcess* m_childProcess; >+ GRefPtr<GPtrArray> m_schemes; >+ HashMap<uint64_t, std::unique_ptr<WebSoupRequestAsyncData>> m_customProtocolMap; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >+ >+#endif // CustomProtocolManagerImpl_h >diff --git a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp >index 42b5948..6b71ac0 100644 >--- a/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp >+++ b/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerSoup.cpp >@@ -23,15 +23,10 @@ > #if ENABLE(CUSTOM_PROTOCOLS) > > #include "ChildProcess.h" >+#include "CustomProtocolManagerImpl.h" > #include "CustomProtocolManagerMessages.h" >-#include "CustomProtocolManagerProxyMessages.h" >-#include "WebCoreArgumentCoders.h" > #include "WebProcessCreationParameters.h" > #include <WebCore/NotImplemented.h> >-#include <WebCore/ResourceError.h> >-#include <WebCore/ResourceRequest.h> >-#include <WebCore/ResourceResponse.h> >-#include <WebCore/URL.h> > > #if ENABLE(NETWORK_PROCESS) > #include "NetworkProcessCreationParameters.h" >@@ -47,6 +42,7 @@ const char* CustomProtocolManager::supplementName() > CustomProtocolManager::CustomProtocolManager(ChildProcess* childProcess) > : m_childProcess(childProcess) > , m_messageQueue(WorkQueue::create("com.apple.WebKit.CustomProtocolManager")) >+ , m_impl(std::make_unique<CustomProtocolManagerImpl>(childProcess)) > { > } > >@@ -55,19 +51,31 @@ void CustomProtocolManager::initializeConnection(IPC::Connection* connection) > connection->addWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName(), m_messageQueue.get(), this); > } > >-void CustomProtocolManager::initialize(const WebProcessCreationParameters&) >+void CustomProtocolManager::initialize(const WebProcessCreationParameters& parameters) > { >+#if ENABLE(NETWORK_PROCESS) >+ ASSERT(parameters.urlSchemesRegisteredForCustomProtocols.isEmpty() || !parameters.usesNetworkProcess); >+ if (parameters.usesNetworkProcess) { >+ m_childProcess->parentProcessConnection()->removeWorkQueueMessageReceiver(Messages::CustomProtocolManager::messageReceiverName()); >+ m_messageQueue = nullptr; >+ return; >+ } >+#endif >+ for (size_t i = 0; i < parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i) >+ registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]); > } > > #if ENABLE(NETWORK_PROCESS) >-void CustomProtocolManager::initialize(const NetworkProcessCreationParameters&) >+void CustomProtocolManager::initialize(const NetworkProcessCreationParameters& parameters) > { >+ for (size_t i = 0; i < parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i) >+ registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]); > } > #endif > >-void CustomProtocolManager::registerScheme(const String&) >+void CustomProtocolManager::registerScheme(const String& scheme) > { >- notImplemented(); >+ m_impl->registerScheme(scheme); > } > > void CustomProtocolManager::unregisterScheme(const String&) >@@ -75,30 +83,29 @@ void CustomProtocolManager::unregisterScheme(const String&) > notImplemented(); > } > >-bool CustomProtocolManager::supportsScheme(const String&) >+bool CustomProtocolManager::supportsScheme(const String& scheme) > { >- notImplemented(); >- return false; >+ return m_impl->supportsScheme(scheme); > } > >-void CustomProtocolManager::didFailWithError(uint64_t, const WebCore::ResourceError&) >+void CustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) > { >- notImplemented(); >+ m_impl->didFailWithError(customProtocolID, error); > } > >-void CustomProtocolManager::didLoadData(uint64_t, const IPC::DataReference&) >+void CustomProtocolManager::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference) > { >- notImplemented(); >+ m_impl->didLoadData(customProtocolID, dataReference); > } > >-void CustomProtocolManager::didReceiveResponse(uint64_t, const WebCore::ResourceResponse&, uint32_t) >+void CustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t) > { >- notImplemented(); >+ m_impl->didReceiveResponse(customProtocolID, response); > } > >-void CustomProtocolManager::didFinishLoading(uint64_t) >+void CustomProtocolManager::didFinishLoading(uint64_t customProtocolID) > { >- notImplemented(); >+ m_impl->didFinishLoading(customProtocolID); > } > > } // namespace WebKit >diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp >index ed60389..4de0e8a 100644 >--- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp >+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp >@@ -73,7 +73,9 @@ void WebProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) const > encoder << urlSchemesRegisteredForCustomProtocols; > #endif > #if USE(SOUP) >+#if !ENABLE(CUSTOM_PROTOCOLS) > encoder << urlSchemesRegistered; >+#endif > encoder << cookiePersistentStoragePath; > encoder << cookiePersistentStorageType; > encoder.encodeEnum(cookieAcceptPolicy); >@@ -163,8 +165,10 @@ bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProc > return false; > #endif > #if USE(SOUP) >+#if !ENABLE(CUSTOM_PROTOCOLS) > if (!decoder.decode(parameters.urlSchemesRegistered)) > return false; >+#endif > if (!decoder.decode(parameters.cookiePersistentStoragePath)) > return false; > if (!decoder.decode(parameters.cookiePersistentStorageType)) >diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h >index 52ca24e..e4f2d52 100644 >--- a/Source/WebKit2/Shared/WebProcessCreationParameters.h >+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h >@@ -82,7 +82,9 @@ struct WebProcessCreationParameters { > Vector<String> urlSchemesRegisteredForCustomProtocols; > #endif > #if USE(SOUP) >+#if !ENABLE(CUSTOM_PROTOCOLS) > Vector<String> urlSchemesRegistered; >+#endif > String cookiePersistentStoragePath; > uint32_t cookiePersistentStorageType; > HTTPCookieAcceptPolicy cookieAcceptPolicy; >diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h b/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h >index c8a9544..0333335 100644 >--- a/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h >+++ b/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h >@@ -32,9 +32,14 @@ > > namespace WebKit { > >+class WebSoupCustomProtocolRequestManager; > class WebSoupRequestManagerProxy; > >+#if ENABLE(CUSTOM_PROTOCOLS) >+WK_ADD_API_MAPPING(WKSoupCustomProtocolRequestManagerRef, WebSoupCustomProtocolRequestManager) >+#else > WK_ADD_API_MAPPING(WKSoupRequestManagerRef, WebSoupRequestManagerProxy) >+#endif > > } > >diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp b/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp >new file mode 100644 >index 0000000..95b1f81 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WKSoupCustomProtocolRequestManager.h" >+ >+#include "WKAPICast.h" >+#include "WebSoupCustomProtocolRequestManager.h" >+ >+using namespace WebKit; >+ >+WKTypeID WKSoupCustomProtocolRequestManagerGetTypeID() >+{ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ return toAPI(WebSoupCustomProtocolRequestManager::APIType); >+#else >+ return 0; >+#endif >+} >+ >+void WKSoupCustomProtocolRequestManagerSetClient(WKSoupCustomProtocolRequestManagerRef soupRequestManagerRef, const WKSoupCustomProtocolRequestManagerClientBase* wkClient) >+{ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ toImpl(soupRequestManagerRef)->initializeClient(wkClient); >+#else >+ UNUSED_PARAM(soupRequestManagerRef); >+ UNUSED_PARAM(wkClient); >+#endif >+} >diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h b/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h >new file mode 100644 >index 0000000..cb0edc7 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef WKSoupCustomProtocolRequestManager_h >+#define WKSoupCustomProtocolRequestManager_h >+ >+#include <WebKit2/WKBase.h> >+ >+#ifdef __cplusplus >+extern "C" { >+#endif >+ >+typedef void (*WKSoupCustomProtocolRequestManagerStartLoadingCallback)(WKSoupCustomProtocolRequestManagerRef soupManagerRef, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo); >+typedef void (*WKSoupCustomProtocolRequestManagerStopLoadingCallback)(WKSoupCustomProtocolRequestManagerRef soupManagerRef, uint64_t customProtocolID, const void* clientInfo); >+ >+typedef struct WKSoupCustomProtocolRequestManagerClientBase { >+ int version; >+ const void* clientInfo; >+} WKSoupCustomProtocolRequestManagerClientBase; >+ >+typedef struct WKSoupCustomProtocolRequestManagerClientV0 { >+ WKSoupCustomProtocolRequestManagerClientBase base; >+ >+ WKSoupCustomProtocolRequestManagerStartLoadingCallback startLoading; >+ WKSoupCustomProtocolRequestManagerStopLoadingCallback stopLoading; >+} WKSoupCustomProtocolRequestManagerClientV0; >+ >+WK_EXPORT WKTypeID WKSoupCustomProtocolRequestManagerGetTypeID(); >+ >+WK_EXPORT void WKSoupCustomProtocolRequestManagerSetClient(WKSoupCustomProtocolRequestManagerRef, const WKSoupCustomProtocolRequestManagerClientBase*); >+ >+#ifdef __cplusplus >+} >+#endif >+ >+#endif /* WKSoupCustomProtocolRequestManager_h */ >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h b/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h >index 8657d1a..9615a51 100644 >--- a/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h >@@ -43,10 +43,11 @@ class ResourceRequest; > namespace WebKit { > > class ChildProcessProxy; >+class WebContext; > > class CustomProtocolManagerProxy : public IPC::MessageReceiver { > public: >- explicit CustomProtocolManagerProxy(ChildProcessProxy*); >+ explicit CustomProtocolManagerProxy(ChildProcessProxy*, WebContext&); > > void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&); > void stopLoading(uint64_t customProtocolID); >@@ -56,6 +57,7 @@ private: > virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override; > > ChildProcessProxy* m_childProcessProxy; >+ WebContext& m_webContext; > > #if PLATFORM(MAC) > typedef HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader>> LoaderMap; >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm b/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm >index 19822f9..7d0efca 100644 >--- a/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm >@@ -122,8 +122,9 @@ using namespace WebKit; > > namespace WebKit { > >-CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy) >+CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy, WebContext& webContext) > : m_childProcessProxy(childProcessProxy) >+ , m_webContext(webContext) > { > ASSERT(m_childProcessProxy); > m_childProcessProxy->addMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName(), *this); >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp >index 57b99e4..a6b437d 100644 >--- a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp >@@ -25,26 +25,28 @@ > #include "ChildProcessProxy.h" > #include "CustomProtocolManagerMessages.h" > #include "CustomProtocolManagerProxyMessages.h" >-#include <WebCore/NotImplemented.h> >+#include "WebContext.h" >+#include "WebSoupCustomProtocolRequestManager.h" > #include <WebCore/ResourceRequest.h> > > namespace WebKit { > >-CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy) >+CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy, WebContext& webContext) > : m_childProcessProxy(childProcessProxy) >+ , m_webContext(webContext) > { > ASSERT(m_childProcessProxy); > m_childProcessProxy->addMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName(), *this); > } > >-void CustomProtocolManagerProxy::startLoading(uint64_t, const WebCore::ResourceRequest&) >+void CustomProtocolManagerProxy::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request) > { >- notImplemented(); >+ m_webContext.supplement<WebSoupCustomProtocolRequestManager>()->startLoading(customProtocolID, request); > } > >-void CustomProtocolManagerProxy::stopLoading(uint64_t) >+void CustomProtocolManagerProxy::stopLoading(uint64_t customProtocolID) > { >- notImplemented(); >+ m_webContext.supplement<WebSoupCustomProtocolRequestManager>()->stopLoading(customProtocolID); > } > > } // namespace WebKit >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >new file mode 100644 >index 0000000..ad73ad4 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp >@@ -0,0 +1,148 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "WebSoupCustomProtocolRequestManager.h" >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+#include "APIData.h" >+#include "CustomProtocolManagerMessages.h" >+#include "WebContext.h" >+#include <WebCore/ResourceError.h> >+#include <WebCore/ResourceRequest.h> >+#include <WebCore/ResourceResponse.h> >+ >+#if PLATFORM(GTK) >+#include <WebCore/ErrorsGtk.h> >+#endif >+ >+namespace WebKit { >+ >+const char* WebSoupCustomProtocolRequestManager::supplementName() >+{ >+ return "WebSoupCustomProtocolRequestManager"; >+} >+ >+PassRefPtr<WebSoupCustomProtocolRequestManager> WebSoupCustomProtocolRequestManager::create(WebContext* context) >+{ >+ return adoptRef(new WebSoupCustomProtocolRequestManager(context)); >+} >+ >+WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager(WebContext* context) >+ : WebContextSupplement(context) >+{ >+} >+ >+WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager() >+{ >+} >+ >+void WebSoupCustomProtocolRequestManager::initializeClient(const WKSoupCustomProtocolRequestManagerClientBase* client) >+{ >+ m_client.initialize(client); >+} >+ >+// WebContextSupplement >+void WebSoupCustomProtocolRequestManager::contextDestroyed() >+{ >+} >+ >+void WebSoupCustomProtocolRequestManager::processDidClose(WebProcessProxy*) >+{ >+} >+ >+void WebSoupCustomProtocolRequestManager::refWebContextSupplement() >+{ >+ API::Object::ref(); >+} >+ >+void WebSoupCustomProtocolRequestManager::derefWebContextSupplement() >+{ >+ API::Object::deref(); >+} >+ >+void WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol(const String& scheme) >+{ >+ if (!context()) >+ return; >+ >+ context()->registerSchemeForCustomProtocol(scheme); >+ >+ ASSERT(!m_registeredSchemes.contains(scheme)); >+ m_registeredSchemes.append(scheme); >+} >+ >+void WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol(const String& scheme) >+{ >+ if (!context()) >+ return; >+ >+ context()->unregisterSchemeForCustomProtocol(scheme); >+ >+ ASSERT(m_registeredSchemes.contains(scheme)); >+ m_registeredSchemes.remove(m_registeredSchemes.find(scheme)); >+} >+ >+void WebSoupCustomProtocolRequestManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request) >+{ >+ if (!m_client.startLoading(this, customProtocolID, request)) >+ didFailWithError(customProtocolID, WebCore::cannotShowURLError(request)); >+} >+ >+void WebSoupCustomProtocolRequestManager::stopLoading(uint64_t customProtocolID) >+{ >+ m_client.stopLoading(this, customProtocolID); >+} >+ >+void WebSoupCustomProtocolRequestManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response) >+{ >+ if (!context()) >+ return; >+ >+ context()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidReceiveResponse(customProtocolID, response, 0), 0); >+} >+ >+void WebSoupCustomProtocolRequestManager::didLoadData(uint64_t customProtocolID, const API::Data* data) >+{ >+ if (!context()) >+ return; >+ >+ context()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidLoadData(customProtocolID, data->dataReference()), 0); >+} >+ >+void WebSoupCustomProtocolRequestManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) >+{ >+ if (!context()) >+ return; >+ >+ context()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidFailWithError(customProtocolID, error), 0); >+} >+ >+void WebSoupCustomProtocolRequestManager::didFinishLoading(uint64_t customProtocolID) >+{ >+ if (!context()) >+ return; >+ >+ context()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidFinishLoading(customProtocolID), 0); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h >new file mode 100644 >index 0000000..068523a >--- /dev/null >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h >@@ -0,0 +1,88 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef WebSoupCustomProtocolRequestManager_h >+#define WebSoupCustomProtocolRequestManager_h >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+#include "APIObject.h" >+#include "WebContextSupplement.h" >+#include "WebSoupCustomProtocolRequestManagerClient.h" >+#include <wtf/PassRefPtr.h> >+#include <wtf/RefPtr.h> >+#include <wtf/text/WTFString.h> >+ >+namespace API { >+class Data; >+} >+ >+namespace WebCore { >+class ResourceError; >+class ResourceRequest; >+class ResourceResponse; >+} >+ >+namespace WebKit { >+ >+class WebContext; >+ >+class WebSoupCustomProtocolRequestManager : public API::ObjectImpl<API::Object::Type::SoupCustomProtocolRequestManager>, public WebContextSupplement { >+public: >+ static const char* supplementName(); >+ >+ static PassRefPtr<WebSoupCustomProtocolRequestManager> create(WebContext*); >+ virtual ~WebSoupCustomProtocolRequestManager(); >+ >+ void initializeClient(const WKSoupCustomProtocolRequestManagerClientBase*); >+ >+ void registerSchemeForCustomProtocol(const String& scheme); >+ void unregisterSchemeForCustomProtocol(const String& scheme); >+ >+ void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&); >+ void stopLoading(uint64_t customProtocolID); >+ >+ void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&); >+ void didLoadData(uint64_t customProtocolID, const API::Data*); >+ void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&); >+ void didFinishLoading(uint64_t customProtocolID); >+ >+ const Vector<String>& registeredSchemesForCustomProtocols() const { return m_registeredSchemes; } >+ >+ using API::Object::ref; >+ using API::Object::deref; >+ >+private: >+ WebSoupCustomProtocolRequestManager(WebContext*); >+ >+ // WebContextSupplement >+ virtual void contextDestroyed() OVERRIDE; >+ virtual void processDidClose(WebProcessProxy*) OVERRIDE; >+ virtual void refWebContextSupplement() OVERRIDE; >+ virtual void derefWebContextSupplement() OVERRIDE; >+ >+ WebSoupCustomProtocolRequestManagerClient m_client; >+ Vector<String> m_registeredSchemes; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >+ >+#endif // WebSoupCustomProtocolRequestManager_h >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp >new file mode 100644 >index 0000000..80d43c5 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "WebSoupCustomProtocolRequestManagerClient.h" >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+namespace WebKit { >+ >+bool WebSoupCustomProtocolRequestManagerClient::startLoading(WebSoupCustomProtocolRequestManager* soupRequestManager, uint64_t customProtocolID, const WebCore::ResourceRequest& request) >+{ >+ if (!m_client.startLoading) >+ return false; >+ >+ RefPtr<API::URLRequest> urlRequest = API::URLRequest::create(request); >+ m_client.startLoading(toAPI(soupRequestManager), customProtocolID, toAPI(urlRequest.get()), m_client.base.clientInfo); >+ return true; >+} >+ >+void WebSoupCustomProtocolRequestManagerClient::stopLoading(WebSoupCustomProtocolRequestManager* soupRequestManager, uint64_t customProtocolID) >+{ >+ if (m_client.stopLoading) >+ m_client.stopLoading(toAPI(soupRequestManager), customProtocolID, m_client.base.clientInfo); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h >new file mode 100644 >index 0000000..e143321 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h >@@ -0,0 +1,54 @@ >+/* >+ * Copyright (C) 2013 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef WebSoupCustomProtocolRequestManagerClient_h >+#define WebSoupCustomProtocolRequestManagerClient_h >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ >+#include "APIClient.h" >+#include "WKAPICast.h" >+#include "WKSoupCustomProtocolRequestManager.h" >+ >+namespace API { >+ >+template<> struct ClientTraits<WKSoupCustomProtocolRequestManagerClientBase> { >+ typedef std::tuple<WKSoupCustomProtocolRequestManagerClientV0> Versions; >+}; >+} >+ >+namespace WebCore { >+class ResourceRequest; >+} >+ >+namespace WebKit { >+ >+class WebSoupCustomProtocolRequestManager; >+ >+class WebSoupCustomProtocolRequestManagerClient : public API::Client<WKSoupCustomProtocolRequestManagerClientBase> { >+public: >+ bool startLoading(WebSoupCustomProtocolRequestManager*, uint64_t customProtocolID, const WebCore::ResourceRequest&); >+ void stopLoading(WebSoupCustomProtocolRequestManager*, uint64_t customProtocolID); >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(CUSTOM_PROTOCOLS) >+ >+#endif // WebSoupCustomProtocolRequestManagerClient_h >diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >index 7f29ff2..e9b4e79 100644 >--- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp >@@ -56,7 +56,7 @@ NetworkProcessProxy::NetworkProcessProxy(WebContext& webContext) > : m_webContext(webContext) > , m_numPendingConnectionRequests(0) > #if ENABLE(CUSTOM_PROTOCOLS) >- , m_customProtocolManagerProxy(this) >+ , m_customProtocolManagerProxy(this, webContext) > #endif > { > connect(); >diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp >index e10515b..c3cdbd3 100644 >--- a/Source/WebKit2/UIProcess/WebContext.cpp >+++ b/Source/WebKit2/UIProcess/WebContext.cpp >@@ -91,8 +91,12 @@ > #endif > > #if USE(SOUP) >+#if ENABLE(CUSTOM_PROTOCOLS) >+#include "WebSoupCustomProtocolRequestManager.h" >+#else > #include "WebSoupRequestManagerProxy.h" > #endif >+#endif > > #ifndef NDEBUG > #include <wtf/RefCountedLeakCounter.h> >@@ -172,8 +176,12 @@ WebContext::WebContext(const String& injectedBundlePath) > addSupplement<WebDatabaseManagerProxy>(); > #endif > #if USE(SOUP) >+#if ENABLE(CUSTOM_PROTOCOLS) >+ addSupplement<WebSoupCustomProtocolRequestManager>(); >+#else > addSupplement<WebSoupRequestManagerProxy>(); > #endif >+#endif > #if ENABLE(BATTERY_STATUS) > addSupplement<WebBatteryManagerProxy>(); > #endif >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp >index 744c1c5..34a7635 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp >@@ -106,7 +106,7 @@ > #include "ArgumentCodersGtk.h" > #endif > >-#if USE(SOUP) >+#if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS) > #include "WebSoupRequestManagerProxy.h" > #endif > >@@ -4355,7 +4355,7 @@ void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<Strin > > #endif // PLATFORM(MAC) > >-#if USE(SOUP) >+#if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS) > void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID) > { > m_process->context().supplement<WebSoupRequestManagerProxy>()->didReceiveURIRequest(uriString, this, requestID); >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h >index db00ae4..f80375c 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.h >+++ b/Source/WebKit2/UIProcess/WebPageProxy.h >@@ -1133,7 +1133,7 @@ private: > void notifyRevealedSelection(); > #endif // PLATFORM(IOS) > >-#if USE(SOUP) >+#if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS) > void didReceiveURIRequest(String uriString, uint64_t requestID); > #endif > >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in >index 2b31ac5..9725513 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in >@@ -321,9 +321,11 @@ messages -> WebPageProxy { > LoadRecentSearches(String name) -> (Vector<String> result) > > #if USE(SOUP) >+#if !ENABLE(CUSTOM_PROTOCOLS) > # Soup custom URI request messages > DidReceiveURIRequest(String uriString, uint64_t requestID); > #endif >+#endif > > SavePDFToFileInDownloadsFolder(String suggestedFilename, String originatingURLString, IPC::DataReference data) > >diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp >index 10f1ab0..d246af2 100644 >--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp >+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp >@@ -89,7 +89,7 @@ WebProcessProxy::WebProcessProxy(WebContext& context) > , m_context(context) > , m_mayHaveUniversalFileReadSandboxExtension(false) > #if ENABLE(CUSTOM_PROTOCOLS) >- , m_customProtocolManagerProxy(this) >+ , m_customProtocolManagerProxy(this, context) > #endif > #if PLATFORM(MAC) > , m_processSuppressionEnabled(false) >diff --git a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp >index f812670..8acef3c 100644 >--- a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp >+++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp >@@ -33,7 +33,6 @@ > #include "WebInspectorServer.h" > #include "WebProcessCreationParameters.h" > #include "WebProcessMessages.h" >-#include "WebSoupRequestManagerProxy.h" > #include <WebCore/FileSystem.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/SchemeRegistry.h> >@@ -44,6 +43,12 @@ > #include "NetworkProcessMessages.h" > #endif > >+#if ENABLE(CUSTOM_PROTOCOLS) >+#include "WebSoupCustomProtocolRequestManager.h" >+#else >+#include "WebSoupRequestManagerProxy.h" >+#endif >+ > namespace WebKit { > > static void initInspectorServer() >@@ -99,7 +104,11 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para > } > > if (!usesNetworkProcess()) { >+#if ENABLE(CUSTOM_PROTOCOLS) >+ parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); >+#else > parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes(); >+#endif > > supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType); > parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy; >diff --git a/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp b/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >index 2c4855b..43ee671 100644 >--- a/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >+++ b/Source/WebKit2/UIProcess/soup/WebContextSoup.cpp >@@ -29,6 +29,7 @@ > > #include "NetworkProcessCreationParameters.h" > #include "WebCookieManagerProxy.h" >+#include "WebSoupCustomProtocolRequestManager.h" > #include <WebCore/Language.h> > > namespace WebKit { >@@ -39,6 +40,9 @@ void WebContext::platformInitializeNetworkProcess(NetworkProcessCreationParamete > parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy; > parameters.ignoreTLSErrors = m_ignoreTLSErrors; > parameters.languages = WebCore::userPreferredLanguages(); >+#if ENABLE(CUSTOM_PROTOCOLS) >+ parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols(); >+#endif > } > > } >diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp >index 291ab4a..472e968 100644 >--- a/Source/WebKit2/WebProcess/WebProcess.cpp >+++ b/Source/WebKit2/WebProcess/WebProcess.cpp >@@ -127,7 +127,7 @@ > #include "WebResourceLoadScheduler.h" > #endif > >-#if USE(SOUP) >+#if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS) > #include "WebSoupRequestManager.h" > #endif > >@@ -200,7 +200,7 @@ WebProcess::WebProcess() > #if ENABLE(NETWORK_INFO) > addSupplement<WebNetworkInfoManager>(); > #endif >-#if USE(SOUP) >+#if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS) > addSupplement<WebSoupRequestManager>(); > #endif > } >diff --git a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp >index 4161bf5..55c5037 100644 >--- a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp >+++ b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.cpp >@@ -20,9 +20,12 @@ > #include "config.h" > #include "WebKitSoupRequestGeneric.h" > >+#include <wtf/text/CString.h> >+ >+#if !ENABLE(CUSTOM_PROTOCOLS) > #include "WebProcess.h" > #include "WebSoupRequestManager.h" >-#include <wtf/text/CString.h> >+#endif > > using namespace WebKit; > >@@ -48,13 +51,25 @@ static void webkit_soup_request_generic_init(WebKitSoupRequestGeneric* request) > > static void webkitSoupRequestGenericSendAsync(SoupRequest* request, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData) > { >+#if ENABLE(CUSTOM_PROTOCOLS) >+ CustomProtocolManagerImpl* customProtocolManager = WEBKIT_SOUP_REQUEST_GENERIC_GET_CLASS(request)->customProtocolManager; >+ ASSERT(customProtocolManager); >+ customProtocolManager->send(g_task_new(request, cancellable, callback, userData)); >+#else > WebProcess::shared().supplement<WebSoupRequestManager>()->send(g_task_new(request, cancellable, callback, userData)); >+#endif > } > > static GInputStream* webkitSoupRequestGenericSendFinish(SoupRequest* request, GAsyncResult* result, GError** error) > { > g_return_val_if_fail(g_task_is_valid(result, request), 0); >+#if ENABLE(CUSTOM_PROTOCOLS) >+ CustomProtocolManagerImpl* customProtocolManager = WEBKIT_SOUP_REQUEST_GENERIC_GET_CLASS(request)->customProtocolManager; >+ ASSERT(customProtocolManager); >+ return customProtocolManager->finish(G_TASK(result), error); >+#else > return WebProcess::shared().supplement<WebSoupRequestManager>()->finish(G_TASK(result), error); >+#endif > } > > static goffset webkitSoupRequestGenericGetContentLength(SoupRequest* request) >diff --git a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h >index 6212ce6..5c5d3ad 100644 >--- a/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h >+++ b/Source/WebKit2/WebProcess/soup/WebKitSoupRequestGeneric.h >@@ -23,6 +23,10 @@ > #include <glib-object.h> > #include <libsoup/soup.h> > >+#if ENABLE(CUSTOM_PROTOCOLS) >+#include "CustomProtocolManagerImpl.h" >+#endif >+ > G_BEGIN_DECLS > > #define WEBKIT_TYPE_SOUP_REQUEST_GENERIC (webkit_soup_request_generic_get_type()) >@@ -44,6 +48,10 @@ struct _WebKitSoupRequestGeneric { > > struct _WebKitSoupRequestGenericClass { > SoupRequestClass parent; >+ >+#if ENABLE(CUSTOM_PROTOCOLS) >+ WebKit::CustomProtocolManagerImpl* customProtocolManager; >+#endif > }; > > GType webkit_soup_request_generic_get_type(); >diff --git a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >index 028b05d..32b2171 100644 >--- a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >+++ b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >@@ -34,7 +34,6 @@ > #include "CertificateInfo.h" > #include "WebCookieManager.h" > #include "WebProcessCreationParameters.h" >-#include "WebSoupRequestManager.h" > #include <WebCore/FileSystem.h> > #include <WebCore/Language.h> > #include <WebCore/MemoryCache.h> >@@ -45,6 +44,10 @@ > #include <wtf/gobject/GOwnPtr.h> > #include <wtf/gobject/GRefPtr.h> > >+#if !ENABLE(CUSTOM_PROTOCOLS) >+#include "WebSoupRequestManager.h" >+#endif >+ > namespace WebKit { > > static uint64_t getCacheDiskFreeSize(SoupCache* cache) >@@ -163,8 +166,10 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters > if (!parameters.languages.isEmpty()) > setSoupSessionAcceptLanguage(parameters.languages); > >+#if !ENABLE(CUSTOM_PROTOCOLS) > for (size_t i = 0; i < parameters.urlSchemesRegistered.size(); i++) > supplement<WebSoupRequestManager>()->registerURIScheme(parameters.urlSchemesRegistered[i]); >+#endif > > setIgnoreTLSErrors(parameters.ignoreTLSErrors); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
andersca
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 125583
:
220164
|
220296
|
221351
|
221449
| 221459