Title: [208959] trunk/Source/WebKit2
Revision
208959
Author
[email protected]
Date
2016-11-21 23:49:55 -0800 (Mon, 21 Nov 2016)

Log Message

[SOUP] Simplify custom protocols handler implementation
https://bugs.webkit.org/show_bug.cgi?id=164922

Reviewed by Michael Catanzaro.

We are using too many classes for this and also the C API that is not needed, because both GTK+ and EFL have
their own APIs and this is not used by WTR at all.

* PlatformEfl.cmake: Remove files from compilation.
* PlatformGTK.cmake: Ditto.
* Shared/API/c/WKBase.h:
* Shared/API/c/soup/WKBaseSoup.h: Removed.
* UIProcess/API/APICustomProtocolManagerClient.h: Added.
(API::CustomProtocolManagerClient::~CustomProtocolManagerClient):
(API::CustomProtocolManagerClient::startLoading):
(API::CustomProtocolManagerClient::stopLoading):
(API::CustomProtocolManagerClient::invalidate):
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/soup/WKAPICastSoup.h: Removed.
* UIProcess/API/C/soup/WKContextSoup.h: Removed.
* UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Removed.
* UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Removed.
* UIProcess/API/C/soup/WKSoupRequestManager.h: Removed.
* UIProcess/API/efl/ewk_context.cpp: Remove unneeded include.
* UIProcess/API/efl/ewk_url_scheme_request.cpp: Use CustomProtocolManagerProxy instead of WKSoupCustomProtocolRequestManagerRef.
(EwkUrlSchemeRequest::EwkUrlSchemeRequest):
(EwkUrlSchemeRequest::finish):
(EwkUrlSchemeRequest::invalidate):
* UIProcess/API/efl/ewk_url_scheme_request_private.h:
(EwkUrlSchemeRequest::create):
(EwkUrlSchemeRequest::manager):
* UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp: Added.
(attachCustomProtocolManagerClientToContext):
* UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h.
* UIProcess/API/gtk/WebKitPrivate.h:
* UIProcess/API/gtk/WebKitRequestManagerClient.cpp: Removed.
* UIProcess/API/gtk/WebKitRequestManagerClient.h: Removed.
* UIProcess/API/gtk/WebKitURISchemeRequest.cpp: Use CustomProtocolManagerProxy instead of WebSoupCustomProtocolRequestManager.
(webkitURISchemeRequestCreate):
(webkitURISchemeRequestCancel):
(webkitURISchemeRequestGetManager):
(webkitURISchemeRequestInvalidate):
(webkitURISchemeRequestReadCallback):
(webkit_uri_scheme_request_finish_error):
* UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkitWebContextDispose):
(webkit_web_context_register_uri_scheme):
(webkitWebContextStartLoadingCustomProtocol):
(webkitWebContextInvalidateCustomProtocolRequests):
* UIProcess/API/gtk/WebKitWebContextPrivate.h:
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
* UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
(WebKit::CustomProtocolManagerProxy::processDidClose):
* UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
(WebKit::CustomProtocolManagerProxy::processDidClose): Invalidate the client.
(WebKit::CustomProtocolManagerProxy::startLoading): Notify the client.
(WebKit::CustomProtocolManagerProxy::stopLoading): Ditto.
(WebKit::CustomProtocolManagerProxy::didReceiveResponse): Notify the network process.
(WebKit::CustomProtocolManagerProxy::didLoadData): Ditto.
(WebKit::CustomProtocolManagerProxy::didFailWithError): Ditto.
(WebKit::CustomProtocolManagerProxy::didFinishLoading): Ditto.
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Removed.
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Removed.
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Removed.
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Removed.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didClose): Notify the CustomProtocolManagerProxy.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::WebProcessPool): Initialize the CustomProtocolManagerClient and remove the all supplement.
(WebKit::WebProcessPool::setCustomProtocolManagerClient):
(WebKit::WebProcessPool::registerSchemeForCustomProtocol): In case of soup cache the given protocol.
(WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): In case of soup delete the given protocol from the cache.
* UIProcess/WebProcessPool.h:
* UIProcess/efl/RequestManagerClientEfl.cpp: Do not use the C API, but API::CustomProtocolManagerClient.
(WebKit::RequestManagerClientEfl::RequestManagerClientEfl):
(WebKit::RequestManagerClientEfl::registerURLSchemeHandler):
* UIProcess/efl/RequestManagerClientEfl.h:
* UIProcess/efl/WebProcessPoolEfl.cpp:
* UIProcess/gtk/WebProcessPoolGtk.cpp:
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::WebProcessPool::platformInitializeNetworkProcess): Use m_urlSchemesRegisteredForCustomProtocols to
build the list of custom protocols to send to the network process.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (208958 => 208959)


--- trunk/Source/WebKit2/ChangeLog	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,3 +1,90 @@
+2016-11-21  Carlos Garcia Campos  <[email protected]>
+
+        [SOUP] Simplify custom protocols handler implementation
+        https://bugs.webkit.org/show_bug.cgi?id=164922
+
+        Reviewed by Michael Catanzaro.
+
+        We are using too many classes for this and also the C API that is not needed, because both GTK+ and EFL have
+        their own APIs and this is not used by WTR at all.
+
+        * PlatformEfl.cmake: Remove files from compilation.
+        * PlatformGTK.cmake: Ditto.
+        * Shared/API/c/WKBase.h:
+        * Shared/API/c/soup/WKBaseSoup.h: Removed.
+        * UIProcess/API/APICustomProtocolManagerClient.h: Added.
+        (API::CustomProtocolManagerClient::~CustomProtocolManagerClient):
+        (API::CustomProtocolManagerClient::startLoading):
+        (API::CustomProtocolManagerClient::stopLoading):
+        (API::CustomProtocolManagerClient::invalidate):
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/soup/WKAPICastSoup.h: Removed.
+        * UIProcess/API/C/soup/WKContextSoup.h: Removed.
+        * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Removed.
+        * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Removed.
+        * UIProcess/API/C/soup/WKSoupRequestManager.h: Removed.
+        * UIProcess/API/efl/ewk_context.cpp: Remove unneeded include.
+        * UIProcess/API/efl/ewk_url_scheme_request.cpp: Use CustomProtocolManagerProxy instead of WKSoupCustomProtocolRequestManagerRef.
+        (EwkUrlSchemeRequest::EwkUrlSchemeRequest):
+        (EwkUrlSchemeRequest::finish):
+        (EwkUrlSchemeRequest::invalidate):
+        * UIProcess/API/efl/ewk_url_scheme_request_private.h:
+        (EwkUrlSchemeRequest::create):
+        (EwkUrlSchemeRequest::manager):
+        * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp: Added.
+        (attachCustomProtocolManagerClientToContext):
+        * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h.
+        * UIProcess/API/gtk/WebKitPrivate.h:
+        * UIProcess/API/gtk/WebKitRequestManagerClient.cpp: Removed.
+        * UIProcess/API/gtk/WebKitRequestManagerClient.h: Removed.
+        * UIProcess/API/gtk/WebKitURISchemeRequest.cpp: Use CustomProtocolManagerProxy instead of WebSoupCustomProtocolRequestManager.
+        (webkitURISchemeRequestCreate):
+        (webkitURISchemeRequestCancel):
+        (webkitURISchemeRequestGetManager):
+        (webkitURISchemeRequestInvalidate):
+        (webkitURISchemeRequestReadCallback):
+        (webkit_uri_scheme_request_finish_error):
+        * UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
+        * UIProcess/API/gtk/WebKitWebContext.cpp:
+        (webkitWebContextConstructed):
+        (webkitWebContextDispose):
+        (webkit_web_context_register_uri_scheme):
+        (webkitWebContextStartLoadingCustomProtocol):
+        (webkitWebContextInvalidateCustomProtocolRequests):
+        * UIProcess/API/gtk/WebKitWebContextPrivate.h:
+        * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
+        * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
+        (WebKit::CustomProtocolManagerProxy::processDidClose):
+        * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
+        (WebKit::CustomProtocolManagerProxy::processDidClose): Invalidate the client.
+        (WebKit::CustomProtocolManagerProxy::startLoading): Notify the client.
+        (WebKit::CustomProtocolManagerProxy::stopLoading): Ditto.
+        (WebKit::CustomProtocolManagerProxy::didReceiveResponse): Notify the network process.
+        (WebKit::CustomProtocolManagerProxy::didLoadData): Ditto.
+        (WebKit::CustomProtocolManagerProxy::didFailWithError): Ditto.
+        (WebKit::CustomProtocolManagerProxy::didFinishLoading): Ditto.
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Removed.
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Removed.
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Removed.
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Removed.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didClose): Notify the CustomProtocolManagerProxy.
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::WebProcessPool): Initialize the CustomProtocolManagerClient and remove the all supplement.
+        (WebKit::WebProcessPool::setCustomProtocolManagerClient):
+        (WebKit::WebProcessPool::registerSchemeForCustomProtocol): In case of soup cache the given protocol.
+        (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): In case of soup delete the given protocol from the cache.
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/efl/RequestManagerClientEfl.cpp: Do not use the C API, but API::CustomProtocolManagerClient.
+        (WebKit::RequestManagerClientEfl::RequestManagerClientEfl):
+        (WebKit::RequestManagerClientEfl::registerURLSchemeHandler):
+        * UIProcess/efl/RequestManagerClientEfl.h:
+        * UIProcess/efl/WebProcessPoolEfl.cpp:
+        * UIProcess/gtk/WebProcessPoolGtk.cpp:
+        * UIProcess/soup/WebProcessPoolSoup.cpp:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess): Use m_urlSchemesRegisteredForCustomProtocols to
+        build the list of custom protocols to send to the network process.
+
 2016-11-21  Alex Christensen  <[email protected]>
 
         Fix Sierra CMake build after r208452

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (208958 => 208959)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2016-11-22 07:49:55 UTC (rev 208959)
@@ -76,7 +76,6 @@
     UIProcess/API/C/efl/WKViewEfl.cpp
 
     UIProcess/API/C/soup/WKCookieManagerSoup.cpp
-    UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp
 
     UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp
 
@@ -131,8 +130,6 @@
     UIProcess/Launcher/efl/ProcessLauncherEfl.cpp
 
     UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp
-    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp
-    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp
 
     UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
     UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
@@ -256,6 +253,7 @@
     "${WEBKIT2_DIR}/Shared/efl"
     "${WEBKIT2_DIR}/Shared/soup"
     "${WEBKIT2_DIR}/Shared/unix"
+    "${WEBKIT2_DIR}/UIProcess/API"
     "${WEBKIT2_DIR}/UIProcess/API/C/cairo"
     "${WEBKIT2_DIR}/UIProcess/API/C/CoordinatedGraphics"
     "${WEBKIT2_DIR}/UIProcess/API/C/efl"

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (208958 => 208959)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2016-11-22 07:49:55 UTC (rev 208959)
@@ -101,7 +101,6 @@
     UIProcess/API/C/gtk/WKView.cpp
 
     UIProcess/API/C/soup/WKCookieManagerSoup.cpp
-    UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp
 
     UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp
     UIProcess/API/gtk/PageClientImpl.cpp
@@ -134,6 +133,8 @@
     UIProcess/API/gtk/WebKitCookieManagerPrivate.h
     UIProcess/API/gtk/WebKitCredential.cpp
     UIProcess/API/gtk/WebKitCredential.h
+    UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp
+    UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h
     UIProcess/API/gtk/WebKitDefines.h
     UIProcess/API/gtk/WebKitDownload.cpp
     UIProcess/API/gtk/WebKitDownload.h
@@ -210,8 +211,6 @@
     UIProcess/API/gtk/WebKitPrintOperationPrivate.h
     UIProcess/API/gtk/WebKitPrivate.cpp
     UIProcess/API/gtk/WebKitPrivate.h
-    UIProcess/API/gtk/WebKitRequestManagerClient.cpp
-    UIProcess/API/gtk/WebKitRequestManagerClient.h
     UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp
     UIProcess/API/gtk/WebKitResponsePolicyDecision.h
     UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h
@@ -283,8 +282,6 @@
     UIProcess/linux/MemoryPressureMonitor.cpp
 
     UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp
-    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp
-    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp
 
     UIProcess/Plugins/gtk/PluginInfoCache.cpp
 

Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (208958 => 208959)


--- trunk/Source/WebKit2/Shared/API/c/WKBase.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -34,10 +34,6 @@
 #include <WebKit/WKBaseGtk.h>
 #endif
 
-#if defined(USE_SOUP)
-#include <WebKit/WKBaseSoup.h>
-#endif
-
 #if defined(BUILDING_EFL__)
 #include <WebKit/WKBaseEfl.h>
 #endif

Copied: trunk/Source/WebKit2/UIProcess/API/APICustomProtocolManagerClient.h (from rev 208958, trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h) (0 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/APICustomProtocolManagerClient.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APICustomProtocolManagerClient.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#include <wtf/Forward.h>
+
+namespace WebKit {
+class CustomProtocolManagerProxy;
+}
+
+namespace WebCore {
+class ResourceRequest;
+}
+
+namespace API {
+
+class CustomProtocolManagerClient {
+public:
+    virtual ~CustomProtocolManagerClient() { }
+
+    virtual bool startLoading(WebKit::CustomProtocolManagerProxy&, uint64_t /* customProtocolID */, const WebCore::ResourceRequest&) { return false; }
+    virtual void stopLoading(WebKit::CustomProtocolManagerProxy&, uint64_t /* customProtocolID */) { }
+
+    virtual void invalidate(WebKit::CustomProtocolManagerProxy&) { }
+};
+
+} // namespace API

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -552,10 +552,6 @@
 #include "WKAPICastGtk.h"
 #endif
 
-#if USE(SOUP)
-#include "WKAPICastSoup.h"
-#endif
-
 #if defined(BUILDING_EFL__)
 #include "WKAPICastEfl.h"
 #endif

Deleted: trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,41 +0,0 @@
-/*
- * Portions Copyright (c) 2012 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 WKAPICastSoup_h
-#define WKAPICastSoup_h
-
-#ifndef WKAPICast_h
-#error "Please #include \"WKAPICast.h\" instead of this file directly."
-#endif
-
-namespace WebKit {
-
-class WebSoupCustomProtocolRequestManager;
-
-WK_ADD_API_MAPPING(WKSoupCustomProtocolRequestManagerRef, WebSoupCustomProtocolRequestManager)
-
-}
-
-#endif // WKAPICastSoup_h

Deleted: trunk/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2012 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 WKContextSoup_h
-#define WKContextSoup_h
-
-#include <WebKit/WKBase.h>
-#include <WebKit/WKSoupRequestManager.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-WK_EXPORT WKSoupRequestManagerRef WKContextGetSoupRequestManager(WKContextRef context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WKContextSoup_h */

Deleted: trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,42 +0,0 @@
-/*
- * 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()
-{
-    return toAPI(WebSoupCustomProtocolRequestManager::APIType);
-}
-
-void WKSoupCustomProtocolRequestManagerSetClient(WKSoupCustomProtocolRequestManagerRef soupRequestManagerRef, const WKSoupCustomProtocolRequestManagerClientBase* wkClient)
-{
-    toImpl(soupRequestManagerRef)->initializeClient(wkClient);
-}

Deleted: trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,58 +0,0 @@
-/*
- * 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 <WebKit/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 */

Deleted: trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2012 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 WKSoupRequestManager_h
-#define WKSoupRequestManager_h
-
-#include <WebKit/WKBase.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*WKSoupRequestManagerDidReceiveURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef pageRef, uint64_t requestID, const void* clientInfo);
-typedef void (*WKSoupRequestManagerDidFailToLoadURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, uint64_t requestID, const void* clientInfo);
-
-typedef struct WKSoupRequestManagerClientBase {
-    int                                                 version;
-    const void*                                         clientInfo;
-} WKSoupRequestManagerClientBase;
-
-typedef struct WKSoupRequestManagerClientV0 {
-    WKSoupRequestManagerClientBase                      base;
-
-    WKSoupRequestManagerDidReceiveURIRequestCallback    didReceiveURIRequest;
-    WKSoupRequestManagerDidFailToLoadURIRequestCallback didFailToLoadURIRequest;
-} WKSoupRequestManagerClientV0;
-
-WK_EXPORT WKTypeID WKSoupRequestManagerGetTypeID();
-
-WK_EXPORT void WKSoupRequestManagerSetClient(WKSoupRequestManagerRef, const WKSoupRequestManagerClientBase* client);
-WK_EXPORT void WKSoupRequestManagerRegisterURIScheme(WKSoupRequestManagerRef, WKStringRef schemeRef);
-WK_EXPORT void WKSoupRequestManagerDidHandleURIRequest(WKSoupRequestManagerRef, WKDataRef, uint64_t contentLength, WKStringRef mimeTypeRef, uint64_t requestID);
-WK_EXPORT void WKSoupRequestManagerDidReceiveURIRequestData(WKSoupRequestManagerRef, WKDataRef, uint64_t requestID);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WKSoupRequestManager_h */

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -26,7 +26,6 @@
 #include "RequestManagerClientEfl.h"
 #include "WKAPICast.h"
 #include "WKContextPrivate.h"
-#include "WKContextSoup.h"
 #include "WKNumber.h"
 #include "WKString.h"
 #include "WebIconDatabase.h"

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -31,14 +31,13 @@
 #include "WKString.h"
 #include "WKURL.h"
 #include "WebPageProxy.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 
 #include "ewk_url_scheme_request_private.h"
 
 using namespace WebKit;
 
-EwkUrlSchemeRequest::EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID)
-    : m_wkRequestManager(manager)
+EwkUrlSchemeRequest::EwkUrlSchemeRequest(CustomProtocolManagerProxy& manager, API::URLRequest* urlRequest, uint64_t requestID)
+    : m_wkRequestManager(&manager)
     , m_requestID(requestID)
 {
     WKURLRef url = ""
@@ -69,6 +68,9 @@
 
 void EwkUrlSchemeRequest::finish(const void* contentData, uint64_t contentLength, const char* mimeType)
 {
+    if (!m_wkRequestManager)
+        return;
+
     WKRetainPtr<WKDataRef> wkData(AdoptWK, WKDataCreate(contentLength ? reinterpret_cast<const unsigned char*>(contentData) : 0, contentLength));
     WKRetainPtr<WKStringRef> wkMimeType = mimeType ? adoptWK(WKStringCreateWithUTF8CString(mimeType)) : 0;
 
@@ -76,12 +78,17 @@
     WebCore::ResourceResponse response(WebCore::URL(WebCore::URL(), String::fromUTF8(m_url)),
         String::fromUTF8(mimeType), contentLength, emptyString());
 
-    toImpl(m_wkRequestManager.get())->didReceiveResponse(m_requestID, response);
-    toImpl(m_wkRequestManager.get())->didLoadData(m_requestID, toImpl(wkData.get()));
-    toImpl(m_wkRequestManager.get())->didFinishLoading(m_requestID);
-    toImpl(m_wkRequestManager.get())->stopLoading(m_requestID);
+    m_wkRequestManager->didReceiveResponse(m_requestID, response);
+    m_wkRequestManager->didLoadData(m_requestID, toImpl(wkData.get())->dataReference());
+    m_wkRequestManager->didFinishLoading(m_requestID);
+    m_wkRequestManager->stopLoading(m_requestID);
 }
 
+void EwkUrlSchemeRequest::invalidate()
+{
+    m_wkRequestManager = nullptr;
+}
+
 const char* ewk_url_scheme_request_scheme_get(const Ewk_Url_Scheme_Request* request)
 {
     EWK_OBJ_GET_IMPL_OR_RETURN(const EwkUrlSchemeRequest, request, impl, nullptr);

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -26,11 +26,11 @@
 #ifndef ewk_url_scheme_request_private_h
 #define ewk_url_scheme_request_private_h
 
+#include "CustomProtocolManagerProxy.h"
 #include "WKAPICast.h"
 #include "WKBase.h"
 #include "WKEinaSharedString.h"
 #include "WKRetainPtr.h"
-#include "WKSoupCustomProtocolRequestManager.h"
 #include "ewk_object_private.h"
 
 /**
@@ -41,9 +41,9 @@
 public:
     EWK_OBJECT_DECLARE(EwkUrlSchemeRequest)
 
-    static RefPtr<EwkUrlSchemeRequest> create(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID)
+    static RefPtr<EwkUrlSchemeRequest> create(WebKit::CustomProtocolManagerProxy& manager, API::URLRequest* urlRequest, uint64_t requestID)
     {
-        if (!manager || !urlRequest)
+        if (!urlRequest)
             return nullptr;
 
         return adoptRef(new EwkUrlSchemeRequest(manager, urlRequest, requestID));
@@ -56,10 +56,13 @@
 
     void finish(const void* contentData, uint64_t contentLength, const char* mimeType);
 
+    WebKit::CustomProtocolManagerProxy* manager() const { return m_wkRequestManager; }
+    void invalidate();
+
 private:
-    EwkUrlSchemeRequest(WKSoupCustomProtocolRequestManagerRef manager, API::URLRequest* urlRequest, uint64_t requestID);
+    EwkUrlSchemeRequest(WebKit::CustomProtocolManagerProxy& manager, API::URLRequest* urlRequest, uint64_t requestID);
 
-    WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_wkRequestManager;
+    WebKit::CustomProtocolManagerProxy* m_wkRequestManager;
     WKEinaSharedString m_url;
     uint64_t m_requestID;
     WKEinaSharedString m_scheme;

Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp (0 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 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 "WebKitCustomProtocolManagerClient.h"
+
+#include "APICustomProtocolManagerClient.h"
+#include "CustomProtocolManagerProxy.h"
+#include "WebKitWebContextPrivate.h"
+#include "WebProcessPool.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+class CustomProtocolManagerClient final : public API::CustomProtocolManagerClient {
+public:
+    explicit CustomProtocolManagerClient(WebKitWebContext* webContext)
+        : m_webContext(webContext)
+    {
+    }
+
+private:
+    bool startLoading(CustomProtocolManagerProxy& manager, uint64_t customProtocolID, const ResourceRequest& request) override
+    {
+        webkitWebContextStartLoadingCustomProtocol(m_webContext, customProtocolID, request, manager);
+        return true;
+    }
+
+    void stopLoading(CustomProtocolManagerProxy&, uint64_t customProtocolID) override
+    {
+        webkitWebContextStopLoadingCustomProtocol(m_webContext, customProtocolID);
+    }
+
+    void invalidate(CustomProtocolManagerProxy& manager) override
+    {
+        webkitWebContextInvalidateCustomProtocolRequests(m_webContext, manager);
+    }
+
+    WebKitWebContext* m_webContext;
+};
+
+void attachCustomProtocolManagerClientToContext(WebKitWebContext* webContext)
+{
+    auto* processPool = webkitWebContextGetProcessPool(webContext);
+    processPool->setCustomProtocolManagerClient(std::make_unique<CustomProtocolManagerClient>(webContext));
+}

Copied: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h (from rev 208958, trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h) (0 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#include "WebKitWebContext.h"
+
+void attachCustomProtocolManagerClientToContext(WebKitWebContext*);
+

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -39,7 +39,6 @@
 #include <WebKit/WKInspectorClientGtk.h>
 #include <WebKit/WKRetainPtr.h>
 #include <WebKit/WKSerializedScriptValue.h>
-#include <WebKit/WKSoupCustomProtocolRequestManager.h>
 #include <WebKit/WKString.h>
 #include <WebKit/WKUserMediaPermissionRequest.h>
 #include <WebKit/WebKit2_C.h>

Deleted: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2012 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 "WebKitRequestManagerClient.h"
-
-#include "WebKitWebContextPrivate.h"
-
-using namespace WebKit;
-
-static void startLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo)
-{
-    webkitWebContextStartLoadingCustomProtocol(WEBKIT_WEB_CONTEXT(clientInfo), customProtocolID, toImpl(requestRef));
-}
-
-static void stopLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, const void* clientInfo)
-{
-    webkitWebContextStopLoadingCustomProtocol(WEBKIT_WEB_CONTEXT(clientInfo), customProtocolID);
-}
-
-void attachRequestManagerClientToContext(WebKitWebContext* webContext)
-{
-    WKSoupCustomProtocolRequestManagerClientV0 wkRequestManagerClient = {
-        {
-            0, // version
-            webContext // clientInfo
-        },
-        startLoading,
-        stopLoading
-    };
-    WKSoupCustomProtocolRequestManagerSetClient(toAPI(webkitWebContextGetRequestManager(webContext)), &wkRequestManagerClient.base);
-}
-

Deleted: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2012 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 WebKitRequestManagerClient_h
-#define WebKitRequestManagerClient_h
-
-#include "WebKitWebContext.h"
-
-void attachRequestManagerClientToContext(WebKitWebContext*);
-
-#endif

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequest.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -33,6 +33,7 @@
 #include <wtf/text/CString.h>
 
 using namespace WebKit;
+using namespace WebCore;
 
 /**
  * SECTION: WebKitURISchemeRequest
@@ -54,7 +55,7 @@
 
 struct _WebKitURISchemeRequestPrivate {
     WebKitWebContext* webContext;
-    RefPtr<WebSoupCustomProtocolRequestManager> webRequestManager;
+    CustomProtocolManagerProxy* manager;
     RefPtr<WebPageProxy> initiatingPage;
     uint64_t requestID;
     CString uri;
@@ -74,13 +75,13 @@
 {
 }
 
-WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext* webContext, API::URLRequest* urlRequest)
+WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext* webContext, const ResourceRequest& resourceRequest, CustomProtocolManagerProxy& manager)
 {
-    WebKitURISchemeRequest* request = WEBKIT_URI_SCHEME_REQUEST(g_object_new(WEBKIT_TYPE_URI_SCHEME_REQUEST, NULL));
+    WebKitURISchemeRequest* request = WEBKIT_URI_SCHEME_REQUEST(g_object_new(WEBKIT_TYPE_URI_SCHEME_REQUEST, nullptr));
     request->priv->webContext = webContext;
-    request->priv->webRequestManager = webkitWebContextGetRequestManager(webContext);
-    request->priv->uri = urlRequest->resourceRequest().url().string().utf8();
-    request->priv->initiatingPage = WebProcessProxy::webPage(urlRequest->resourceRequest().initiatingPageID());
+    request->priv->manager = &manager;
+    request->priv->uri = resourceRequest.url().string().utf8();
+    request->priv->initiatingPage = WebProcessProxy::webPage(resourceRequest.initiatingPageID());
     request->priv->requestID = requestID;
     return request;
 }
@@ -87,10 +88,20 @@
 
 void webkitURISchemeRequestCancel(WebKitURISchemeRequest* request)
 {
-    if (request->priv->cancellable.get())
-        g_cancellable_cancel(request->priv->cancellable.get());
+    g_cancellable_cancel(request->priv->cancellable.get());
 }
 
+CustomProtocolManagerProxy* webkitURISchemeRequestGetManager(WebKitURISchemeRequest* request)
+{
+    return request->priv->manager;
+}
+
+void webkitURISchemeRequestInvalidate(WebKitURISchemeRequest* request)
+{
+    request->priv->manager = nullptr;
+    webkitURISchemeRequestCancel(request);
+}
+
 /**
  * webkit_uri_scheme_request_get_scheme:
  * @request: a #WebKitURISchemeRequest
@@ -159,8 +170,14 @@
 static void webkitURISchemeRequestReadCallback(GInputStream* inputStream, GAsyncResult* result, WebKitURISchemeRequest* schemeRequest)
 {
     GRefPtr<WebKitURISchemeRequest> request = adoptGRef(schemeRequest);
+    WebKitURISchemeRequestPrivate* priv = request->priv;
     GUniqueOutPtr<GError> error;
     gssize bytesRead = g_input_stream_read_finish(inputStream, result, &error.outPtr());
+    if (!priv->manager) {
+        webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
+        return;
+    }
+
     if (bytesRead == -1) {
         webkit_uri_scheme_request_finish_error(request.get(), error.get());
         return;
@@ -171,22 +188,21 @@
     if (!request->priv->stream)
         return;
 
-    WebKitURISchemeRequestPrivate* priv = request->priv;
-    Ref<API::Data> webData = API::Data::create(reinterpret_cast<const unsigned char*>(priv->readBuffer), bytesRead);
+    auto webData = IPC::DataReference(reinterpret_cast<const uint8_t*>(priv->readBuffer), bytesRead);
     if (!priv->bytesRead) {
         // First chunk read. In case of empty reply an empty API::Data is sent to the networking process.
-        WebCore::ResourceResponse response(WebCore::URL(WebCore::URL(), String::fromUTF8(priv->uri)), String::fromUTF8(priv->mimeType.data()),
+        ResourceResponse response(URL(URL(), String::fromUTF8(priv->uri)), String::fromUTF8(priv->mimeType.data()),
             priv->streamLength, emptyString());
-        priv->webRequestManager->didReceiveResponse(priv->requestID, response);
-        priv->webRequestManager->didLoadData(priv->requestID, webData.ptr());
+        priv->manager->didReceiveResponse(priv->requestID, response);
+        priv->manager->didLoadData(priv->requestID, webData);
     } else if (bytesRead || (!bytesRead && !priv->streamLength)) {
         // Subsequent chunk read. We only send an empty API::Data to the networking process when stream length is unknown.
-        priv->webRequestManager->didLoadData(priv->requestID, webData.ptr());
+        priv->manager->didLoadData(priv->requestID, webData);
     }
 
     if (!bytesRead) {
-        priv->webRequestManager->didFinishLoading(request->priv->requestID);
-        webkitWebContextDidFinishLoadingCustomProtocol(request->priv->webContext, request->priv->requestID);
+        priv->manager->didFinishLoading(priv->requestID);
+        webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
         return;
     }
 
@@ -239,7 +255,7 @@
         return;
 
     priv->stream = nullptr;
-    WebCore::ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), WebCore::URL(priv->soupURI.get()), String::fromUTF8(error->message));
-    priv->webRequestManager->didFailWithError(priv->requestID, resourceError);
+    ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), URL(priv->soupURI.get()), String::fromUTF8(error->message));
+    priv->manager->didFailWithError(priv->requestID, resourceError);
     webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
 }

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -20,11 +20,15 @@
 #ifndef WebKitURISchemeRequestPrivate_h
 #define WebKitURISchemeRequestPrivate_h
 
+#include "CustomProtocolManagerProxy.h"
 #include "WebKitPrivate.h"
 #include "WebKitURISchemeRequest.h"
 #include "WebKitWebContext.h"
+#include <WebCore/ResourceRequest.h>
 
-WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext*, API::URLRequest*);
+WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext*, const WebCore::ResourceRequest&, WebKit::CustomProtocolManagerProxy&);
 void webkitURISchemeRequestCancel(WebKitURISchemeRequest*);
+WebKit::CustomProtocolManagerProxy* webkitURISchemeRequestGetManager(WebKitURISchemeRequest*);
+void webkitURISchemeRequestInvalidate(WebKitURISchemeRequest*);
 
 #endif // WebKitURISchemeRequestPrivate_h

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "WebKitWebContext.h"
 
+#include "APICustomProtocolManagerClient.h"
 #include "APIDownloadClient.h"
 #include "APIPageConfiguration.h"
 #include "APIProcessPoolConfiguration.h"
@@ -30,6 +31,7 @@
 #include "WebCookieManagerProxy.h"
 #include "WebGeolocationManagerProxy.h"
 #include "WebKitCookieManagerPrivate.h"
+#include "WebKitCustomProtocolManagerClient.h"
 #include "WebKitDownloadClient.h"
 #include "WebKitDownloadPrivate.h"
 #include "WebKitFaviconDatabasePrivate.h"
@@ -38,7 +40,6 @@
 #include "WebKitNotificationProvider.h"
 #include "WebKitPluginPrivate.h"
 #include "WebKitPrivate.h"
-#include "WebKitRequestManagerClient.h"
 #include "WebKitSecurityManagerPrivate.h"
 #include "WebKitSettingsPrivate.h"
 #include "WebKitURISchemeRequestPrivate.h"
@@ -115,12 +116,6 @@
 
 class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> {
 public:
-    WebKitURISchemeHandler()
-        : m_callback(0)
-        , m_userData(0)
-        , m_destroyNotify(0)
-    {
-    }
     WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify)
         : m_callback(callback)
         , m_userData(userData)
@@ -147,9 +142,9 @@
     }
 
 private:
-    WebKitURISchemeRequestCallback m_callback;
-    void* m_userData;
-    GDestroyNotify m_destroyNotify;
+    WebKitURISchemeRequestCallback m_callback { nullptr };
+    void* m_userData { nullptr };
+    GDestroyNotify m_destroyNotify { nullptr };
 };
 
 typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap;
@@ -162,7 +157,6 @@
     GRefPtr<WebKitCookieManager> cookieManager;
     GRefPtr<WebKitFaviconDatabase> faviconDatabase;
     GRefPtr<WebKitSecurityManager> securityManager;
-    RefPtr<WebSoupCustomProtocolRequestManager> requestManager;
     URISchemeHandlerMap uriSchemeHandlers;
     URISchemeRequestMap uriSchemeRequests;
 #if ENABLE(GEOLOCATION)
@@ -275,8 +269,6 @@
     if (!priv->websiteDataManager)
         priv->websiteDataManager = adoptGRef(webkitWebsiteDataManagerCreate(websiteDataStoreConfigurationForWebProcessPoolConfiguration(configuration)));
 
-    priv->requestManager = priv->processPool->supplement<WebSoupCustomProtocolRequestManager>();
-
     priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_FAIL;
     priv->processPool->setIgnoreTLSErrors(false);
 
@@ -287,7 +279,7 @@
 
     attachInjectedBundleClientToContext(webContext);
     attachDownloadClientToContext(webContext);
-    attachRequestManagerClientToContext(webContext);
+    attachCustomProtocolManagerClientToContext(webContext);
 
 #if ENABLE(GEOLOCATION)
     priv->geolocationProvider = WebKitGeolocationProvider::create(priv->processPool->supplement<WebGeolocationManagerProxy>());
@@ -304,6 +296,7 @@
         priv->clientsDetached = true;
         priv->processPool->initializeInjectedBundleClient(nullptr);
         priv->processPool->setDownloadClient(nullptr);
+        priv->processPool->setCustomProtocolManagerClient(nullptr);
     }
 
     G_OBJECT_CLASS(webkit_web_context_parent_class)->dispose(object);
@@ -849,8 +842,9 @@
     g_return_if_fail(callback);
 
     RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData, destroyNotify));
-    context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get());
-    context->priv->requestManager->registerSchemeForCustomProtocol(String::fromUTF8(scheme));
+    auto addResult = context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get());
+    if (addResult.isNewEntry)
+        context->priv->processPool->registerSchemeForCustomProtocol(String::fromUTF8(scheme));
 }
 
 /**
@@ -1266,14 +1260,9 @@
     return context->priv->processPool.get();
 }
 
-WebSoupCustomProtocolRequestManager* webkitWebContextGetRequestManager(WebKitWebContext* context)
+void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID, const WebCore::ResourceRequest& resourceRequest, CustomProtocolManagerProxy& manager)
 {
-    return context->priv->requestManager.get();
-}
-
-void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID, API::URLRequest* urlRequest)
-{
-    GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(customProtocolID, context, urlRequest));
+    GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(customProtocolID, context, resourceRequest, manager));
     String scheme(String::fromUTF8(webkit_uri_scheme_request_get_scheme(request.get())));
     RefPtr<WebKitURISchemeHandler> handler = context->priv->uriSchemeHandlers.get(scheme);
     ASSERT(handler.get());
@@ -1292,6 +1281,16 @@
     webkitURISchemeRequestCancel(request.get());
 }
 
+void webkitWebContextInvalidateCustomProtocolRequests(WebKitWebContext* context, CustomProtocolManagerProxy& manager)
+{
+    Vector<GRefPtr<WebKitURISchemeRequest>> requests;
+    copyValuesToVector(context->priv->uriSchemeRequests, requests);
+    for (auto& request : requests) {
+        if (webkitURISchemeRequestGetManager(request.get()) == &manager)
+            webkitURISchemeRequestInvalidate(request.get());
+    }
+}
+
 void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID)
 {
     context->priv->uriSchemeRequests.remove(customProtocolID);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -26,12 +26,13 @@
 #ifndef WebKitWebContextPrivate_h
 #define WebKitWebContextPrivate_h
 
+#include "CustomProtocolManagerProxy.h"
 #include "DownloadProxy.h"
 #include "WebKitPrivate.h"
 #include "WebKitUserContentManager.h"
 #include "WebKitWebContext.h"
 #include "WebProcessPool.h"
-#include "WebSoupCustomProtocolRequestManager.h"
+#include <WebCore/ResourceRequest.h>
 
 WebKit::WebProcessPool* webkitWebContextGetProcessPool(WebKitWebContext*);
 WebKitDownload* webkitWebContextGetOrCreateDownload(WebKit::DownloadProxy*);
@@ -38,9 +39,9 @@
 WebKitDownload* webkitWebContextStartDownload(WebKitWebContext*, const char* uri, WebKit::WebPageProxy*);
 void webkitWebContextRemoveDownload(WebKit::DownloadProxy*);
 void webkitWebContextDownloadStarted(WebKitWebContext*, WebKitDownload*);
-WebKit::WebSoupCustomProtocolRequestManager* webkitWebContextGetRequestManager(WebKitWebContext*);
-void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, API::URLRequest*);
+void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, const WebCore::ResourceRequest&, WebKit::CustomProtocolManagerProxy&);
 void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
+void webkitWebContextInvalidateCustomProtocolRequests(WebKitWebContext*, WebKit::CustomProtocolManagerProxy&);
 void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
 bool webkitWebContextIsLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
 void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitUserContentManager*, WebKitWebView*);

Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -34,8 +34,14 @@
 OBJC_CLASS WKCustomProtocolLoader;
 #endif
 
+namespace IPC {
+class DataReference;
+}
+
 namespace WebCore {
+class ResourceError;
 class ResourceRequest;
+class ResourceResponse;
 } // namespace WebCore
 
 namespace WebKit {
@@ -51,6 +57,15 @@
     void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&);
     void stopLoading(uint64_t customProtocolID);
 
+    void processDidClose();
+
+#if USE(SOUP)
+    void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&);
+    void didLoadData(uint64_t customProtocolID, const IPC::DataReference&);
+    void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&);
+    void didFinishLoading(uint64_t customProtocolID);
+#endif
+
 private:
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;

Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm	2016-11-22 07:49:55 UTC (rev 208959)
@@ -160,4 +160,8 @@
     m_loaderMap.remove(customProtocolID);
 }
 
+void CustomProtocolManagerProxy::processDidClose()
+{
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -20,13 +20,19 @@
 #include "config.h"
 #include "CustomProtocolManagerProxy.h"
 
+#include "APICustomProtocolManagerClient.h"
 #include "ChildProcessProxy.h"
 #include "CustomProtocolManagerMessages.h"
 #include "CustomProtocolManagerProxyMessages.h"
 #include "WebProcessPool.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 #include <WebCore/ResourceRequest.h>
 
+#if PLATFORM(GTK)
+#include <WebCore/ErrorsGtk.h>
+#elif PLATFORM(EFL)
+#include <WebCore/ErrorsEfl.h>
+#endif
+
 namespace WebKit {
 
 CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy, WebProcessPool& processPool)
@@ -42,14 +48,40 @@
     m_childProcessProxy->removeMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName());
 }
 
+void CustomProtocolManagerProxy::processDidClose()
+{
+    m_processPool.customProtocolManagerClient().invalidate(*this);
+}
+
 void CustomProtocolManagerProxy::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request)
 {
-    m_processPool.supplement<WebSoupCustomProtocolRequestManager>()->startLoading(customProtocolID, request);
+    if (!m_processPool.customProtocolManagerClient().startLoading(*this, customProtocolID, request))
+        didFailWithError(customProtocolID, WebCore::cannotShowURLError(request));
 }
 
 void CustomProtocolManagerProxy::stopLoading(uint64_t customProtocolID)
 {
-    m_processPool.supplement<WebSoupCustomProtocolRequestManager>()->stopLoading(customProtocolID);
+    m_processPool.customProtocolManagerClient().stopLoading(*this, customProtocolID);
 }
 
+void CustomProtocolManagerProxy::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response)
+{
+    m_childProcessProxy->send(Messages::CustomProtocolManager::DidReceiveResponse(customProtocolID, response, 0), 0);
+}
+
+void CustomProtocolManagerProxy::didLoadData(uint64_t customProtocolID, const IPC::DataReference& data)
+{
+    m_childProcessProxy->send(Messages::CustomProtocolManager::DidLoadData(customProtocolID, data), 0);
+}
+
+void CustomProtocolManagerProxy::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
+{
+    m_childProcessProxy->send(Messages::CustomProtocolManager::DidFailWithError(customProtocolID, error), 0);
+}
+
+void CustomProtocolManagerProxy::didFinishLoading(uint64_t customProtocolID)
+{
+    m_childProcessProxy->send(Messages::CustomProtocolManager::DidFinishLoading(customProtocolID), 0);
+}
+
 } // namespace WebKit

Deleted: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,149 +0,0 @@
-/*
- * 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"
-
-#include "APIData.h"
-#include "CustomProtocolManagerMessages.h"
-#include "WebProcessPool.h"
-#include <WebCore/ResourceError.h>
-#include <WebCore/ResourceRequest.h>
-#include <WebCore/ResourceResponse.h>
-
-#if PLATFORM(GTK)
-#include <WebCore/ErrorsGtk.h>
-#elif PLATFORM(EFL)
-#include <WebCore/ErrorsEfl.h>
-#endif
-
-namespace WebKit {
-
-const char* WebSoupCustomProtocolRequestManager::supplementName()
-{
-    return "WebSoupCustomProtocolRequestManager";
-}
-
-Ref<WebSoupCustomProtocolRequestManager> WebSoupCustomProtocolRequestManager::create(WebProcessPool* processPool)
-{
-    return adoptRef(*new WebSoupCustomProtocolRequestManager(processPool));
-}
-
-WebSoupCustomProtocolRequestManager::WebSoupCustomProtocolRequestManager(WebProcessPool* processPool)
-    : WebContextSupplement(processPool)
-{
-}
-
-WebSoupCustomProtocolRequestManager::~WebSoupCustomProtocolRequestManager()
-{
-}
-
-void WebSoupCustomProtocolRequestManager::initializeClient(const WKSoupCustomProtocolRequestManagerClientBase* client)
-{
-    m_client.initialize(client);
-}
-
-// WebContextSupplement
-void WebSoupCustomProtocolRequestManager::processPoolDestroyed()
-{
-}
-
-void WebSoupCustomProtocolRequestManager::processDidClose(WebProcessProxy*)
-{
-}
-
-void WebSoupCustomProtocolRequestManager::refWebContextSupplement()
-{
-    API::Object::ref();
-}
-
-void WebSoupCustomProtocolRequestManager::derefWebContextSupplement()
-{
-    API::Object::deref();
-}
-
-void WebSoupCustomProtocolRequestManager::registerSchemeForCustomProtocol(const String& scheme)
-{
-    ASSERT(!scheme.isNull());
-    if (m_registeredSchemes.contains(scheme))
-        return;
-
-    if (!processPool())
-        return;
-
-    processPool()->registerSchemeForCustomProtocol(scheme);
-
-    m_registeredSchemes.append(scheme);
-}
-
-void WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol(const String& scheme)
-{
-    if (!processPool())
-        return;
-
-    processPool()->unregisterSchemeForCustomProtocol(scheme);
-
-    bool removed = m_registeredSchemes.removeFirst(scheme);
-    ASSERT_UNUSED(removed, removed);
-}
-
-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 (!processPool())
-        return;
-
-    processPool()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidReceiveResponse(customProtocolID, response, 0), 0);
-}
-
-void WebSoupCustomProtocolRequestManager::didLoadData(uint64_t customProtocolID, const API::Data* data)
-{
-    if (!processPool())
-        return;
-
-    processPool()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidLoadData(customProtocolID, data->dataReference()), 0);
-}
-
-void WebSoupCustomProtocolRequestManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
-{
-    if (!processPool())
-        return;
-
-    processPool()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidFailWithError(customProtocolID, error), 0);
-}
-
-void WebSoupCustomProtocolRequestManager::didFinishLoading(uint64_t customProtocolID)
-{
-    if (!processPool())
-        return;
-
-    processPool()->networkingProcessConnection()->send(Messages::CustomProtocolManager::DidFinishLoading(customProtocolID), 0);
-}
-
-} // namespace WebKit

Deleted: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,83 +0,0 @@
-/*
- * 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
-
-#include "APIObject.h"
-#include "WebContextSupplement.h"
-#include "WebSoupCustomProtocolRequestManagerClient.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 WebProcessPool;
-
-class WebSoupCustomProtocolRequestManager : public API::ObjectImpl<API::Object::Type::SoupCustomProtocolRequestManager>, public WebContextSupplement {
-public:
-    static const char* supplementName();
-
-    static Ref<WebSoupCustomProtocolRequestManager> create(WebProcessPool*);
-    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(WebProcessPool*);
-
-    // WebContextSupplement
-    void processPoolDestroyed() override;
-    void processDidClose(WebProcessProxy*) override;
-    void refWebContextSupplement() override;
-    void derefWebContextSupplement() override;
-
-    WebSoupCustomProtocolRequestManagerClient m_client;
-    Vector<String> m_registeredSchemes;
-};
-
-} // namespace WebKit
-
-#endif // WebSoupCustomProtocolRequestManager_h

Deleted: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,43 +0,0 @@
-/*
- * 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"
-
-#include "WebSoupCustomProtocolRequestManager.h"
-
-namespace WebKit {
-
-bool WebSoupCustomProtocolRequestManagerClient::startLoading(WebSoupCustomProtocolRequestManager* soupRequestManager, uint64_t customProtocolID, const WebCore::ResourceRequest& request)
-{
-    if (!m_client.startLoading)
-        return false;
-
-    Ref<API::URLRequest> urlRequest = API::URLRequest::create(request);
-    m_client.startLoading(toAPI(soupRequestManager), customProtocolID, toAPI(urlRequest.ptr()), 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

Deleted: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -1,50 +0,0 @@
-/*
- * 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
-
-#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 // WebSoupCustomProtocolRequestManagerClient_h

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -219,6 +219,7 @@
 {
     if (m_downloadProxyMap)
         m_downloadProxyMap->processDidClose();
+    m_customProtocolManagerProxy.processDidClose();
 
     m_tokenForHoldingLockedFiles = nullptr;
 

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -28,6 +28,7 @@
 
 #include "APIArray.h"
 #include "APIAutomationClient.h"
+#include "APICustomProtocolManagerClient.h"
 #include "APIDownloadClient.h"
 #include "APILegacyContextHistoryClient.h"
 #include "APIPageConfiguration.h"
@@ -90,10 +91,6 @@
 #include <_javascript_Core/RemoteInspector.h>
 #endif
 
-#if USE(SOUP)
-#include "WebSoupCustomProtocolRequestManager.h"
-#endif
-
 #if OS(LINUX)
 #include "MemoryPressureMonitor.h"
 #endif
@@ -157,6 +154,9 @@
     , m_automationClient(std::make_unique<API::AutomationClient>())
     , m_downloadClient(std::make_unique<API::DownloadClient>())
     , m_historyClient(std::make_unique<API::LegacyContextHistoryClient>())
+#if USE(SOUP)
+    , m_customProtocolManagerClient(std::make_unique<API::CustomProtocolManagerClient>())
+#endif
     , m_visitedLinkStore(VisitedLinkStore::create())
     , m_visitedLinksPopulated(false)
     , m_plugInAutoStartProvider(this)
@@ -165,9 +165,6 @@
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
     , m_websiteDataStore(m_configuration->shouldHaveLegacyDataStore() ? API::WebsiteDataStore::create(legacyWebsiteDataStoreConfiguration(m_configuration)).ptr() : nullptr)
-#if USE(SOUP)
-    , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain)
-#endif
     , m_shouldUseTestingNetworkSession(false)
     , m_processTerminationEnabled(true)
     , m_canHandleHTTPSServerTrustEvaluation(true)
@@ -197,9 +194,6 @@
     addSupplement<WebCookieManagerProxy>();
     addSupplement<WebGeolocationManagerProxy>();
     addSupplement<WebNotificationManagerProxy>();
-#if USE(SOUP)
-    addSupplement<WebSoupCustomProtocolRequestManager>();
-#endif
 #if ENABLE(MEDIA_SESSION)
     addSupplement<WebMediaSessionFocusManager>();
 #endif
@@ -1364,11 +1358,17 @@
 
 void WebProcessPool::registerSchemeForCustomProtocol(const String& scheme)
 {
+#if USE(SOUP)
+    m_urlSchemesRegisteredForCustomProtocols.add(scheme);
+#endif
     sendToNetworkingProcess(Messages::CustomProtocolManager::RegisterScheme(scheme));
 }
 
 void WebProcessPool::unregisterSchemeForCustomProtocol(const String& scheme)
 {
+#if USE(SOUP)
+    m_urlSchemesRegisteredForCustomProtocols.remove(scheme);
+#endif
     sendToNetworkingProcess(Messages::CustomProtocolManager::UnregisterScheme(scheme));
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -70,6 +70,7 @@
 
 namespace API {
 class AutomationClient;
+class CustomProtocolManagerClient;
 class DownloadClient;
 class LegacyContextHistoryClient;
 class PageConfiguration;
@@ -135,6 +136,9 @@
     void setHistoryClient(std::unique_ptr<API::LegacyContextHistoryClient>);
     void setDownloadClient(std::unique_ptr<API::DownloadClient>);
     void setAutomationClient(std::unique_ptr<API::AutomationClient>);
+#if USE(SOUP)
+    void setCustomProtocolManagerClient(std::unique_ptr<API::CustomProtocolManagerClient>&&);
+#endif
 
     void setMaximumNumberOfProcesses(unsigned); // Can only be called when there are no processes running.
     unsigned maximumNumberOfProcesses() const { return !m_configuration->maximumProcessCount() ? UINT_MAX : m_configuration->maximumProcessCount(); }
@@ -225,6 +229,10 @@
     API::LegacyContextHistoryClient& historyClient() { return *m_historyClient; }
     WebContextClient& client() { return m_client; }
 
+#if USE(SOUP)
+    API::CustomProtocolManagerClient& customProtocolManagerClient() const { return *m_customProtocolManagerClient; }
+#endif
+
     WebIconDatabase* iconDatabase() const { return m_iconDatabase.get(); }
 
     struct Statistics {
@@ -455,6 +463,9 @@
     std::unique_ptr<API::AutomationClient> m_automationClient;
     std::unique_ptr<API::DownloadClient> m_downloadClient;
     std::unique_ptr<API::LegacyContextHistoryClient> m_historyClient;
+#if USE(SOUP)
+    std::unique_ptr<API::CustomProtocolManagerClient> m_customProtocolManagerClient;
+#endif
 
     RefPtr<WebAutomationSession> m_automationSession;
 
@@ -499,7 +510,7 @@
     WebContextSupplementMap m_supplements;
 
 #if USE(SOUP)
-    HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy;
+    HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy { HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain };
 #endif
 
 #if PLATFORM(MAC)
@@ -530,6 +541,7 @@
 
 #if USE(SOUP)
     bool m_ignoreTLSErrors { true };
+    HashSet<String, ASCIICaseInsensitiveHash> m_urlSchemesRegisteredForCustomProtocols;
 #endif
 
     bool m_memoryCacheDisabled;

Modified: trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -26,52 +26,60 @@
 #include "config.h"
 #include "RequestManagerClientEfl.h"
 
+#include "APICustomProtocolManagerClient.h"
+#include "CustomProtocolManagerProxy.h"
 #include "ewk_context_private.h"
 #include "ewk_url_scheme_request_private.h"
 
 namespace WebKit {
 
-static inline RequestManagerClientEfl* toRequestManagerClientEfl(const void* clientInfo)
-{
-    return static_cast<RequestManagerClientEfl*>(const_cast<void*>(clientInfo));
-}
+class CustomProtocolManagerClient final : public API::CustomProtocolManagerClient {
+public:
+    explicit CustomProtocolManagerClient(RequestManagerClientEfl* client)
+        : m_client(client)
+    {
+    }
 
-RequestManagerClientEfl::RequestManagerClientEfl(WKContextRef context)
-{
-    m_requestManager = toAPI(toImpl(context)->supplement<WebSoupCustomProtocolRequestManager>());
-    ASSERT(m_requestManager);
+private:
+    bool startLoading(CustomProtocolManagerProxy& manager, uint64_t customProtocolID, const WebCore::ResourceRequest& resourceRequest) override
+    {
+        auto urlRequest = API::URLRequest::create(resourceRequest);
+        RefPtr<EwkUrlSchemeRequest> request = EwkUrlSchemeRequest::create(manager, urlRequest.ptr(), customProtocolID);
+        String scheme(String::fromUTF8(request.get()->scheme()));
+        RefPtr<WebKitURISchemeHandler> handler = (m_client->m_uriSchemeHandlers).get(scheme);
+        ASSERT(handler.get());
+        if (!handler->hasCallback())
+            return true;
 
-    WKSoupCustomProtocolRequestManagerClientV0 wkRequestManagerClient;
-    memset(&wkRequestManagerClient, 0, sizeof(WKSoupCustomProtocolRequestManagerClientV0));
+        (m_client->m_uriSchemeRequests).set(customProtocolID, request);
+        handler->performCallback(request.get());
+        return true;
+    }
 
-    wkRequestManagerClient.base.version = 0;
-    wkRequestManagerClient.base.clientInfo = this;
-    wkRequestManagerClient.startLoading = startLoading;
-    wkRequestManagerClient.stopLoading = stopLoading;
+    void stopLoading(CustomProtocolManagerProxy&, uint64_t customProtocolID) override
+    {
+        (m_client->m_uriSchemeRequests).remove(customProtocolID);
+    }
 
-    WKSoupCustomProtocolRequestManagerSetClient(m_requestManager.get(), &wkRequestManagerClient.base);
-}
+    void invalidate(CustomProtocolManagerProxy& manager) override
+    {
+        Vector<RefPtr<EwkUrlSchemeRequest>> requests;
+        copyValuesToVector(m_client->m_uriSchemeRequests, requests);
+        for (auto& request : requests) {
+            if (request->manager() == &manager) {
+                request->invalidate();
+                stopLoading(manager, request->id());
+            }
+        }
+    }
 
-void RequestManagerClientEfl::startLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, WKURLRequestRef requestRef, const void* clientInfo)
-{
-    RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo);
-    RefPtr<EwkUrlSchemeRequest> request = EwkUrlSchemeRequest::create(manager, toImpl(requestRef), customProtocolID);
-    String scheme(String::fromUTF8(request.get()->scheme()));
-    RefPtr<WebKitURISchemeHandler> handler = (client->m_uriSchemeHandlers).get(scheme);
-    ASSERT(handler.get());
-    if (!handler->hasCallback())
-        return;
+    RequestManagerClientEfl* m_client;
+};
 
-    (client->m_uriSchemeRequests).set(customProtocolID, request);
-    handler->performCallback(request.get());
-}
-
-void RequestManagerClientEfl::stopLoading(WKSoupCustomProtocolRequestManagerRef manager, uint64_t customProtocolID, const void* clientInfo)
+RequestManagerClientEfl::RequestManagerClientEfl(WKContextRef context)
 {
-    UNUSED_PARAM(manager);
-
-    RequestManagerClientEfl* client = toRequestManagerClientEfl(clientInfo);
-    (client->m_uriSchemeRequests).remove(customProtocolID);
+    m_processPool = toImpl(context);
+    m_processPool->setCustomProtocolManagerClient(std::make_unique<CustomProtocolManagerClient>(this));
 }
 
 void RequestManagerClientEfl::registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
@@ -79,8 +87,9 @@
     ASSERT(callback);
 
     RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData));
-    m_uriSchemeHandlers.set(scheme, handler);
-    toImpl(m_requestManager.get())->registerSchemeForCustomProtocol(scheme);
+    auto addResult = m_uriSchemeHandlers.set(scheme, handler);
+    if (addResult.isNewEntry)
+        m_processPool->registerSchemeForCustomProtocol(scheme);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/efl/RequestManagerClientEfl.h	2016-11-22 07:49:55 UTC (rev 208959)
@@ -27,7 +27,6 @@
 #define RequestManagerClientEfl_h
 
 #include "WebProcessPool.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 #include "ewk_context_private.h"
 #include "ewk_url_scheme_request_private.h"
 
@@ -38,6 +37,8 @@
 
 namespace WebKit {
 
+class CustomProtocolManagerClient;
+
 class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> {
 public:
     WebKitURISchemeHandler()
@@ -79,10 +80,9 @@
     void registerURLSchemeHandler(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData);
 
 private:
-    static void startLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, WKURLRequestRef, const void* clientInfo);
-    static void stopLoading(WKSoupCustomProtocolRequestManagerRef, uint64_t customProtocolID, const void* clientInfo);
+    friend class CustomProtocolManagerClient;
 
-    WKRetainPtr<WKSoupCustomProtocolRequestManagerRef> m_requestManager;
+    WebProcessPool* m_processPool;
     URISchemeHandlerMap m_uriSchemeHandlers;
     URISchemeRequestMap m_uriSchemeRequests;
 };

Modified: trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -32,7 +32,6 @@
 #include "WebInspectorServer.h"
 #include "WebProcessCreationParameters.h"
 #include "WebProcessMessages.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 #include <Efreet.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/IconDatabase.h>

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -34,7 +34,6 @@
 #include "WebInspectorServer.h"
 #include "WebProcessCreationParameters.h"
 #include "WebProcessMessages.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 #include <WebCore/FileSystem.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/SchemeRegistry.h>

Modified: trunk/Source/WebKit2/UIProcess/soup/WebProcessPoolSoup.cpp (208958 => 208959)


--- trunk/Source/WebKit2/UIProcess/soup/WebProcessPoolSoup.cpp	2016-11-22 06:30:33 UTC (rev 208958)
+++ trunk/Source/WebKit2/UIProcess/soup/WebProcessPoolSoup.cpp	2016-11-22 07:49:55 UTC (rev 208959)
@@ -26,10 +26,10 @@
 #include "config.h"
 #include "WebProcessPool.h"
 
+#include "APICustomProtocolManagerClient.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
 #include "WebCookieManagerProxy.h"
-#include "WebSoupCustomProtocolRequestManager.h"
 #include <WebCore/Language.h>
 
 namespace WebKit {
@@ -40,7 +40,8 @@
     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
     parameters.ignoreTLSErrors = m_ignoreTLSErrors;
     parameters.languages = WebCore::userPreferredLanguages();
-    parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols();
+    for (const auto& scheme : m_urlSchemesRegisteredForCustomProtocols)
+        parameters.urlSchemesRegisteredForCustomProtocols.append(scheme);
     parameters.shouldEnableNetworkCacheEfficacyLogging = false;
 }
 
@@ -51,4 +52,12 @@
         networkProcess()->send(Messages::NetworkProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors), 0);
 }
 
+void WebProcessPool::setCustomProtocolManagerClient(std::unique_ptr<API::CustomProtocolManagerClient>&& customProtocolManagerClient)
+{
+    if (!customProtocolManagerClient)
+        m_customProtocolManagerClient = std::make_unique<API::CustomProtocolManagerClient>();
+    else
+        m_customProtocolManagerClient = WTFMove(customProtocolManagerClient);
 }
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to