Title: [186781] branches/safari-600.1.4.17-branch/Source

Diff

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog	2015-07-13 21:48:49 UTC (rev 186781)
@@ -1,5 +1,49 @@
 2015-07-13  David Kilzer  <ddkil...@apple.com>
 
+        Merge r186530. rdar://problem/21708151
+
+        * WebCore.exp.in: Export methods.
+
+    2015-07-08  Brady Eidson  <beid...@apple.com>
+
+        Move PingLoaders to the NetworkingProcess.
+        <rdar://problem/18860263> and https://bugs.webkit.org/show_bug.cgi?id=146710
+
+        Reviewed by Tim Horton.
+
+        No new tests.
+        There's no current solution for communicating back to a page that a ping load has reached its target.
+        Until we have such a solution, any attempt at a layout test will be fragile at best.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        
+        * loader/LoaderStrategy.cpp:
+        (WebCore::LoaderStrategy::createPingHandle): Default implementation is create the PingHandle directly.
+        * loader/LoaderStrategy.h:
+
+        PingLoader becomes a static class for now that crafts the ResourceRequest then passes it off
+        to the LoaderStrategy:        
+        * loader/PingLoader.cpp:
+        (WebCore::PingLoader::loadImage):
+        (WebCore::PingLoader::sendPing):
+        (WebCore::PingLoader::sendViolationReport):
+        (WebCore::PingLoader::startPingLoad):
+        (WebCore::PingLoader::createPingLoader): Deleted.
+        (WebCore::PingLoader::PingLoader): Deleted.
+        (WebCore::PingLoader::~PingLoader): Deleted.
+        * loader/PingLoader.h:
+        (WebCore::PingLoader::timeoutTimerFired): Deleted.
+
+        PingHandle does what PingLoader used to - It's a basic ResourceHandleClient that simply waits
+        for any response/completion/failure and then deletes itself.
+        * platform/network/PingHandle.h: Added.
+        (WebCore::PingHandle::PingHandle):
+        (WebCore::PingHandle::usesAsyncCallbacks):
+        (WebCore::PingHandle::timeoutTimerFired):
+        (WebCore::PingHandle::~PingHandle):
+
+2015-07-13  David Kilzer  <ddkil...@apple.com>
+
         Merge r186476. rdar://problem/21708269
 
         * WebCore.exp.in: Add symbol to export list since WEBCORE_EXPORT

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.exp.in (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.exp.in	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.exp.in	2015-07-13 21:48:49 UTC (rev 186781)
@@ -371,6 +371,7 @@
 __ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityENS_14EUserTriggeredE
 __ZN7WebCore14FrameSelection9selectAllEv
 __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
+__ZN7WebCore14LoaderStrategy16createPingHandleEPNS_17NetworkingContextERNS_15ResourceRequestEb
 __ZN7WebCore14LoaderStrategy18createBlobRegistryEv
 __ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
 __ZN7WebCore14LoaderStrategy25loadResourceSynchronouslyEPNS_17NetworkingContextEmRKNS_15ResourceRequestENS_17StoredCredentialsENS_22ClientCredentialPolicyERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0ENSC_15CrashOnOverflowEEE
@@ -868,6 +869,7 @@
 __ZN7WebCore20RenderEmbeddedObject44setPluginUnavailabilityReasonWithDescriptionENS0_26PluginUnavailabilityReasonERKN3WTF6StringE
 __ZN7WebCore20ResourceHandleClient16didReceiveBufferEPNS_14ResourceHandleEN3WTF10PassRefPtrINS_12SharedBufferEEEi
 __ZN7WebCore20ResourceHandleClient20willSendRequestAsyncEPNS_14ResourceHandleERKNS_15ResourceRequestERKNS_16ResourceResponseE
+__ZN7WebCore20ResourceHandleClient23didReceiveResponseAsyncEPNS_14ResourceHandleERKNS_16ResourceResponseE
 __ZN7WebCore20ResourceHandleClient42canAuthenticateAgainstProtectionSpaceAsyncEPNS_14ResourceHandleERKNS_15ProtectionSpaceE
 __ZN7WebCore20ResourceHandleClientC2Ev
 __ZN7WebCore20ResourceHandleClientD2Ev

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-07-13 21:48:49 UTC (rev 186781)
@@ -1946,6 +1946,7 @@
 		51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51B07A441823248B00AA8D1A /* IDBPendingDeleteCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B07A431823248B00AA8D1A /* IDBPendingDeleteCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; };
+		51B454EA1B4DAE7D0085EAA6 /* PingHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B454E91B4DAE7D0085EAA6 /* PingHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51B58FD4195A964D002990B0 /* PlatformGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E5FEF195101470086CA5E /* PlatformGamepad.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51C0AA390F2AA10A001648C2 /* CachedFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0AA380F2AA10A001648C2 /* CachedFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9053,6 +9054,7 @@
 		51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderTypes.h; sourceTree = "<group>"; };
 		51B07A431823248B00AA8D1A /* IDBPendingDeleteCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBPendingDeleteCall.h; sourceTree = "<group>"; };
 		51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyWebArchiveMac.mm; sourceTree = "<group>"; };
+		51B454E91B4DAE7D0085EAA6 /* PingHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PingHandle.h; sourceTree = "<group>"; };
 		51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; };
 		51C0AA380F2AA10A001648C2 /* CachedFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFrame.h; sourceTree = "<group>"; };
 		51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CachedFrame.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
@@ -16384,6 +16386,7 @@
 				E13EF3421684ECF40034C83F /* NetworkStorageSession.h */,
 				447958021643B47B001E0A7F /* ParsedContentType.cpp */,
 				447958031643B47B001E0A7F /* ParsedContentType.h */,
+				51B454E91B4DAE7D0085EAA6 /* PingHandle.h */,
 				37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */,
 				514C765F0CE923A1007EF3CD /* ProtectionSpaceBase.cpp */,
 				514C76600CE923A1007EF3CD /* ProtectionSpaceBase.h */,
@@ -24716,6 +24719,7 @@
 				FDF7E9C413AC21DB00A51EAC /* JSAudioBufferCallback.h in Headers */,
 				FDA15EA012B03EE1003A583A /* JSAudioBufferSourceNode.h in Headers */,
 				FDA15EA612B03EE1003A583A /* JSAudioContext.h in Headers */,
+				51B454EA1B4DAE7D0085EAA6 /* PingHandle.h in Headers */,
 				FDA15EA812B03EE1003A583A /* JSAudioDestinationNode.h in Headers */,
 				FDA15EAE12B03EE1003A583A /* JSAudioListener.h in Headers */,
 				FDA15EB012B03EE1003A583A /* JSAudioNode.h in Headers */,

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.cpp (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.cpp	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.cpp	2015-07-13 21:48:49 UTC (rev 186781)
@@ -27,6 +27,7 @@
 #include "LoaderStrategy.h"
 
 #include "BlobRegistryImpl.h"
+#include "PingHandle.h"
 #include "ResourceHandle.h"
 #include "ResourceLoadScheduler.h"
 
@@ -47,4 +48,10 @@
     return new BlobRegistryImpl;
 }
 
+void LoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage)
+{
+    // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled.
+    new PingHandle(networkingContext, request, shouldUseCredentialStorage, PingHandle::UsesAsyncCallbacks::No);
+}
+
 } // namespace WebCore

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.h (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.h	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/LoaderStrategy.h	2015-07-13 21:48:49 UTC (rev 186781)
@@ -32,6 +32,7 @@
 namespace WebCore {
 
 class BlobRegistry;
+class Frame;
 class NetworkingContext;
 class ResourceError;
 class ResourceLoadScheduler;
@@ -46,6 +47,8 @@
 
     virtual BlobRegistry* createBlobRegistry();
 
+    virtual void createPingHandle(NetworkingContext*, ResourceRequest&, bool shouldUseCredentialStorage);
+
 protected:
     virtual ~LoaderStrategy()
     {

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.cpp (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.cpp	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.cpp	2015-07-13 21:48:49 UTC (rev 186781)
@@ -39,7 +39,9 @@
 #include "FrameLoaderClient.h"
 #include "HTTPHeaderNames.h"
 #include "InspectorInstrumentation.h"
+#include "LoaderStrategy.h"
 #include "Page.h"
+#include "PlatformStrategies.h"
 #include "ProgressTracker.h"
 #include "ResourceHandle.h"
 #include "ResourceRequest.h"
@@ -64,7 +66,7 @@
         request.setHTTPReferrer(referrer);
     frame.loader().addExtraFieldsToSubresourceRequest(request);
 
-    createPingLoader(frame, request);
+    startPingLoad(frame, request);
 }
 
 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing
@@ -90,7 +92,7 @@
         }
     }
 
-    createPingLoader(frame, request);
+    startPingLoad(frame, request);
 }
 
 void PingLoader::sendViolationReport(Frame& frame, const URL& reportURL, PassRefPtr<FormData> report)
@@ -105,38 +107,22 @@
     if (!referrer.isEmpty())
         request.setHTTPReferrer(referrer);
 
-    createPingLoader(frame, request);
+    startPingLoad(frame, request);
 }
 
-void PingLoader::createPingLoader(Frame& frame, ResourceRequest& request)
+void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request)
 {
-    // No need to free the PingLoader object or manage it via a smart pointer - it will kill itself as soon as it receives a response.
-    new PingLoader(frame, request);
-}
-
-PingLoader::PingLoader(Frame& frame, ResourceRequest& request)
-    : m_timeout(this, &PingLoader::timeoutTimerFired)
-{
     unsigned long identifier = frame.page()->progress().createUniqueIdentifier();
     // FIXME: Why activeDocumentLoader? I would have expected documentLoader().
     // Itseems like the PingLoader should be associated with the current
     // Document in the Frame, but the activeDocumentLoader will be associated
     // with the provisional DocumentLoader if there is a provisional
     // DocumentLoader.
-    m_shouldUseCredentialStorage = frame.loader().client().shouldUseCredentialStorage(frame.loader().activeDocumentLoader(), identifier);
-    m_handle = ResourceHandle::create(frame.loader().networkingContext(), request, this, false, false);
+    bool shouldUseCredentialStorage = frame.loader().client().shouldUseCredentialStorage(frame.loader().activeDocumentLoader(), identifier);
 
     InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame.loader().activeDocumentLoader(), request, ResourceResponse());
 
-    // If the server never responds, FrameLoader won't be able to cancel this load and
-    // we'll sit here waiting forever. Set a very generous timeout, just in case.
-    m_timeout.startOneShot(60000);
+    platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, shouldUseCredentialStorage);
 }
 
-PingLoader::~PingLoader()
-{
-    if (m_handle)
-        m_handle->cancel();
 }
-
-}

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.h (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.h	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/PingLoader.h	2015-07-13 21:48:49 UTC (rev 186781)
@@ -32,48 +32,23 @@
 #ifndef PingLoader_h
 #define PingLoader_h
 
-#include "ResourceHandleClient.h"
-#include "Timer.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
+#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
 class FormData;
 class Frame;
 class URL;
-class ResourceError;
-class ResourceHandle;
-class ResourceResponse;
+class ResourceRequest;
 
-// This class triggers asynchronous loads independent of Frame staying alive (i.e., auditing pingbacks).
-// Since nothing depends on resources loaded through this class, we just want
-// to allow the load to live long enough to ensure the message was actually sent.
-// Therefore, as soon as a callback is received from the ResourceHandle, this class 
-// will cancel the load and delete itself.
-class PingLoader : private ResourceHandleClient {
-    WTF_MAKE_NONCOPYABLE(PingLoader); WTF_MAKE_FAST_ALLOCATED;
+class PingLoader {
 public:
     static void loadImage(Frame&, const URL&);
     static void sendPing(Frame&, const URL& pingURL, const URL& destinationURL);
     static void sendViolationReport(Frame&, const URL& reportURL, PassRefPtr<FormData> report);
 
-    virtual ~PingLoader();
-
 private:
-    static void createPingLoader(Frame&, ResourceRequest&);
-    PingLoader(Frame&, ResourceRequest&);
-
-    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override { delete this; }
-    virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int) override { delete this; }
-    virtual void didFinishLoading(ResourceHandle*, double) override { delete this; }
-    virtual void didFail(ResourceHandle*, const ResourceError&) override { delete this; }
-    virtual bool shouldUseCredentialStorage(ResourceHandle*)  override { return m_shouldUseCredentialStorage; }
-    void timeoutTimerFired(Timer<PingLoader>&) { delete this; }
-
-    RefPtr<ResourceHandle> m_handle;
-    Timer<PingLoader> m_timeout;
-    bool m_shouldUseCredentialStorage;
+    static void startPingLoad(Frame&, ResourceRequest&);
 };
 
 }

Added: branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/PingHandle.h (0 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/PingHandle.h	                        (rev 0)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/PingHandle.h	2015-07-13 21:48:49 UTC (rev 186781)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * 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. ``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
+ * 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 PingHandle_h
+#define PingHandle_h
+
+#include "ResourceHandle.h"
+#include "ResourceHandleClient.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+// This class triggers asynchronous loads independent of the networking context staying alive (i.e., auditing pingbacks).
+// The object just needs to live long enough to ensure the message was actually sent.
+// As soon as any callback is received from the ResourceHandle, this class will cancel the load and delete itself.
+
+class PingHandle : private ResourceHandleClient {
+    WTF_MAKE_NONCOPYABLE(PingHandle); WTF_MAKE_FAST_ALLOCATED;
+public:
+    enum class UsesAsyncCallbacks {
+        Yes,
+        No,
+    };
+    
+    PingHandle(NetworkingContext*, const ResourceRequest&, bool shouldUseCredentialStorage, UsesAsyncCallbacks);
+
+private:
+    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override { delete this; }
+    virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int) override { delete this; }
+    virtual void didFinishLoading(ResourceHandle*, double) override { delete this; }
+    virtual void didFail(ResourceHandle*, const ResourceError&) override { delete this; }
+    virtual bool shouldUseCredentialStorage(ResourceHandle*)  override { return m_shouldUseCredentialStorage; }
+    virtual bool usesAsyncCallbacks() override { return m_usesAsyncCallbacks == UsesAsyncCallbacks::Yes; }
+    void timeoutTimerFired(Timer<PingHandle>&) { delete this; }
+
+    virtual ~PingHandle()
+    {
+        if (m_handle)
+            m_handle->cancel();
+    }
+
+    RefPtr<ResourceHandle> m_handle;
+    Timer<PingHandle> m_timeoutTimer;
+    bool m_shouldUseCredentialStorage;
+    UsesAsyncCallbacks m_usesAsyncCallbacks;
+};
+
+PingHandle::PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks)
+    : m_timeoutTimer(this, &PingHandle::timeoutTimerFired)
+    , m_shouldUseCredentialStorage(shouldUseCredentialStorage)
+    , m_usesAsyncCallbacks(useAsyncCallbacks)
+{
+    m_handle = ResourceHandle::create(networkingContext, request, this, false, false);
+
+    // If the server never responds, this object will hang around forever.
+    // Set a very generous timeout, just in case.
+    m_timeoutTimer.startOneShot(60000);
+}
+
+} // namespace WebCore
+
+#endif // PingHandle_h

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-13 21:48:49 UTC (rev 186781)
@@ -1,5 +1,27 @@
 2015-07-13  David Kilzer  <ddkil...@apple.com>
 
+        Merge r186530. rdar://problem/21708151
+
+    2015-07-08  Brady Eidson  <beid...@apple.com>
+
+        Move PingLoaders to the NetworkingProcess.
+        <rdar://problem/18860263> and https://bugs.webkit.org/show_bug.cgi?id=146710
+
+        Reviewed by Tim Horton.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::loadPing): Create a PingHandle and then return.
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::createPingHandle): If the Network process is enabled,
+          compile the appropriate load parameters and then message to it.
+          Otherwise, use the default in-process PingHandle.
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
+2015-07-13  David Kilzer  <ddkil...@apple.com>
+
         Merge r186476. rdar://problem/21708269
 
     2015-07-07  Brady Eidson  <beid...@apple.com>

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2015-07-13 21:48:49 UTC (rev 186781)
@@ -37,6 +37,7 @@
 #include "NetworkResourceLoaderMessages.h"
 #include "RemoteNetworkingContext.h"
 #include "SessionTracker.h"
+#include <WebCore/PingHandle.h>
 #include <WebCore/PlatformCookieJar.h>
 #include <WebCore/ResourceLoaderOptions.h>
 #include <WebCore/ResourceRequest.h>
@@ -123,6 +124,14 @@
     NetworkProcess::shared().networkResourceLoadScheduler().scheduleLoader(loader.get());
 }
 
+void NetworkConnectionToWebProcess::loadPing(const NetworkResourceLoadParameters& loadParameters)
+{
+    RefPtr<NetworkingContext> context = RemoteNetworkingContext::create(loadParameters.sessionID, loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect);
+
+    // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled.
+    new PingHandle(context.get(), loadParameters.request, loadParameters.allowStoredCredentials == AllowStoredCredentials, PingHandle::UsesAsyncCallbacks::Yes);
+}
+
 void NetworkConnectionToWebProcess::removeLoadIdentifier(ResourceLoadIdentifier identifier)
 {
     RefPtr<NetworkResourceLoader> loader = m_networkResourceLoaders.take(identifier);

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h	2015-07-13 21:48:49 UTC (rev 186781)
@@ -70,6 +70,7 @@
     
     void scheduleResourceLoad(const NetworkResourceLoadParameters&);
     void performSynchronousLoad(const NetworkResourceLoadParameters&, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
+    void loadPing(const NetworkResourceLoadParameters&);
 
     void removeLoadIdentifier(ResourceLoadIdentifier);
     void setDefersLoading(ResourceLoadIdentifier, bool);

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2015-07-13 21:48:49 UTC (rev 186781)
@@ -26,6 +26,7 @@
 
     ScheduleResourceLoad(WebKit::NetworkResourceLoadParameters resourceLoadParameters)
     PerformSynchronousLoad(WebKit::NetworkResourceLoadParameters resourceLoadParameters) -> (WebCore::ResourceError error, WebCore::ResourceResponse response, Vector<char> data) Delayed
+    LoadPing(WebKit::NetworkResourceLoadParameters resourceLoadParameters)
     RemoveLoadIdentifier(uint64_t resourceLoadIdentifier)
     SetDefersLoading(uint64_t resourceLoadIdentifier, bool defers)
     

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2015-07-13 21:48:49 UTC (rev 186781)
@@ -54,6 +54,7 @@
 #include <WebCore/PageGroup.h>
 #include <WebCore/PlatformCookieJar.h>
 #include <WebCore/PlatformPasteboard.h>
+#include <WebCore/ProgressTracker.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/SessionID.h>
 #include <WebCore/StorageNamespace.h>
@@ -276,6 +277,28 @@
     }
 }
 
+void WebPlatformStrategies::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage)
+{
+    auto& webProcess = WebProcess::shared();
+    if (!webProcess.usesNetworkProcess()) {
+        LoaderStrategy::createPingHandle(networkingContext, request, shouldUseCredentialStorage);
+        return;
+    }
+
+    WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(networkingContext);
+    WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
+    WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
+    WebPage* webPage = webFrame ? webFrame->page() : nullptr;
+    
+    NetworkResourceLoadParameters loadParameters;
+    loadParameters.request = request;
+    loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID();
+    loadParameters.allowStoredCredentials = shouldUseCredentialStorage ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+    loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = networkingContext->shouldClearReferrerOnHTTPSToHTTPRedirect();
+
+    webProcess.networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters), 0);
+}
+
 BlobRegistry* WebPlatformStrategies::createBlobRegistry()
 {
     if (!WebProcess::shared().usesNetworkProcess())

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (186780 => 186781)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2015-07-13 21:40:47 UTC (rev 186780)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2015-07-13 21:48:49 UTC (rev 186781)
@@ -76,6 +76,7 @@
     virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() override;
     virtual void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) override;
     virtual WebCore::BlobRegistry* createBlobRegistry() override;
+    virtual void createPingHandle(WebCore::NetworkingContext*, WebCore::ResourceRequest&, bool shouldUseCredentialStorage) override;
 #endif
 
     // WebCore::PluginStrategy
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to