Move all calls to ResourceLoader::start to WebKitLegacy
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 22:08:51 +0000 (22:08 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 22:08:51 +0000 (22:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184946

Reviewed by Andy Estes.

Source/WebCore:

This is in preparation for moving ResourceLoader::start to WebKitLegacy along with all ResourceHandle code.
I move the code that moves m_deferredRequest into m_request into WebKitLegacy, which won't change behavior for
modern WebKit because modern WebKit never calls ResourceLoader::start, the only place where m_deferredRequest
is ever set.  This won't change behavior for WebKitLegacy because the same operations happen in the same order.

* loader/LoaderStrategy.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::setDefersLoading):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::setRequest):
(WebCore::ResourceLoader::deferredRequest const):
(WebCore::ResourceLoader::takeDeferredRequest):

Source/WebKit:

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::setDefersLoading):
* WebProcess/Network/WebLoaderStrategy.h:

Source/WebKitLegacy:

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::setDefersLoading):
* WebCoreSupport/WebResourceLoadScheduler.h:

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

Source/WebCore/ChangeLog
Source/WebCore/loader/LoaderStrategy.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h

index 2a83663..c396503 100644 (file)
@@ -1,3 +1,23 @@
+2018-08-01  Alex Christensen  <achristensen@webkit.org>
+
+        Move all calls to ResourceLoader::start to WebKitLegacy
+        https://bugs.webkit.org/show_bug.cgi?id=184946
+
+        Reviewed by Andy Estes.
+
+        This is in preparation for moving ResourceLoader::start to WebKitLegacy along with all ResourceHandle code.
+        I move the code that moves m_deferredRequest into m_request into WebKitLegacy, which won't change behavior for
+        modern WebKit because modern WebKit never calls ResourceLoader::start, the only place where m_deferredRequest
+        is ever set.  This won't change behavior for WebKitLegacy because the same operations happen in the same order.
+
+        * loader/LoaderStrategy.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::setDefersLoading):
+        * loader/ResourceLoader.h:
+        (WebCore::ResourceLoader::setRequest):
+        (WebCore::ResourceLoader::deferredRequest const):
+        (WebCore::ResourceLoader::takeDeferredRequest):
+
 2018-08-01  Nan Wang  <n_wang@apple.com>
 
         AX: AOM: Add ARIA IDL Attribute Reflection
index d4357a0..596782c 100644 (file)
@@ -62,7 +62,7 @@ public:
     virtual void pageLoadCompleted(uint64_t webPageID) = 0;
 
     virtual void remove(ResourceLoader*) = 0;
-    virtual void setDefersLoading(ResourceLoader*, bool) = 0;
+    virtual void setDefersLoading(ResourceLoader&, bool) = 0;
     virtual void crossOriginRedirectReceived(ResourceLoader*, const URL& redirectURL) = 0;
 
     virtual void servePendingRequests(ResourceLoadPriority minimumPriority = ResourceLoadPriority::VeryLow) = 0;
index b0e7ecb..cf288e2 100644 (file)
@@ -231,13 +231,8 @@ void ResourceLoader::setDefersLoading(bool defers)
     m_defersLoading = defers;
     if (m_handle)
         m_handle->setDefersLoading(defers);
-    if (!defers && !m_deferredRequest.isNull()) {
-        m_request = m_deferredRequest;
-        m_deferredRequest = ResourceRequest();
-        start();
-    }
 
-    platformStrategies()->loaderStrategy()->setDefersLoading(this, defers);
+    platformStrategies()->loaderStrategy()->setDefersLoading(*this, defers);
 }
 
 FrameLoader* ResourceLoader::frameLoader() const
index f0d280f..6ba5526 100644 (file)
@@ -133,6 +133,7 @@ public:
 
 
     const ResourceRequest& request() const { return m_request; }
+    void setRequest(ResourceRequest&& request) { m_request = WTFMove(request); }
 
     void setDataBufferingPolicy(DataBufferingPolicy);
 
@@ -150,6 +151,9 @@ public:
 
     const ResourceLoaderOptions& options() const { return m_options; }
 
+    const ResourceRequest& deferredRequest() const { return m_deferredRequest; }
+    ResourceRequest takeDeferredRequest() { return std::exchange(m_deferredRequest, { }); }
+
 protected:
     ResourceLoader(Frame&, ResourceLoaderOptions);
 
index 9a50af3..2507ace 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-01  Alex Christensen  <achristensen@webkit.org>
+
+        Move all calls to ResourceLoader::start to WebKitLegacy
+        https://bugs.webkit.org/show_bug.cgi?id=184946
+
+        Reviewed by Andy Estes.
+
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::setDefersLoading):
+        * WebProcess/Network/WebLoaderStrategy.h:
+
 2018-08-01  Nan Wang  <n_wang@apple.com>
 
         AX: AOM: Add ARIA IDL Attribute Reflection
index 1ffcc52..3e90f54 100644 (file)
@@ -418,9 +418,9 @@ void WebLoaderStrategy::remove(ResourceLoader* resourceLoader)
     loader->detachFromCoreLoader();
 }
 
-void WebLoaderStrategy::setDefersLoading(ResourceLoader* resourceLoader, bool defers)
+void WebLoaderStrategy::setDefersLoading(ResourceLoader& resourceLoader, bool defers)
 {
-    ResourceLoadIdentifier identifier = resourceLoader->identifier();
+    ResourceLoadIdentifier identifier = resourceLoader.identifier();
     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetDefersLoading(identifier, defers), 0);
 }
 
index 5b7e97f..e040d07 100644 (file)
@@ -54,7 +54,7 @@ public:
     void pageLoadCompleted(uint64_t webPageID) final;
 
     void remove(WebCore::ResourceLoader*) final;
-    void setDefersLoading(WebCore::ResourceLoader*, bool) final;
+    void setDefersLoading(WebCore::ResourceLoader&, bool) final;
     void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL& redirectURL) final;
     
     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority) final;
index 412e401..e7720a6 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-01  Alex Christensen  <achristensen@webkit.org>
+
+        Move all calls to ResourceLoader::start to WebKitLegacy
+        https://bugs.webkit.org/show_bug.cgi?id=184946
+
+        Reviewed by Andy Estes.
+
+        * WebCoreSupport/WebResourceLoadScheduler.cpp:
+        (WebResourceLoadScheduler::setDefersLoading):
+        * WebCoreSupport/WebResourceLoadScheduler.h:
+
 2018-06-25  Keith Rollin  <krollin@apple.com>
         Unreviewed, rolling out r233087.
 
index 34542df..6b4a66b 100644 (file)
@@ -199,8 +199,12 @@ void WebResourceLoadScheduler::remove(ResourceLoader* resourceLoader)
     scheduleServePendingRequests();
 }
 
-void WebResourceLoadScheduler::setDefersLoading(ResourceLoader*, bool)
+void WebResourceLoadScheduler::setDefersLoading(ResourceLoader& loader, bool defers)
 {
+    if (!defers && !loader.deferredRequest().isNull()) {
+        loader.setRequest(loader.takeDeferredRequest());
+        loader.start();
+    }
 }
 
 void WebResourceLoadScheduler::crossOriginRedirectReceived(ResourceLoader* resourceLoader, const URL& redirectURL)
index 770d63e..8a56a9e 100644 (file)
@@ -54,7 +54,7 @@ public:
     void pageLoadCompleted(uint64_t webPageID) final;
 
     void remove(WebCore::ResourceLoader*) final;
-    void setDefersLoading(WebCore::ResourceLoader*, bool) final;
+    void setDefersLoading(WebCore::ResourceLoader&, bool) final;
     void crossOriginRedirectReceived(WebCore::ResourceLoader*, const WebCore::URL& redirectURL) final;
     
     void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority = WebCore::ResourceLoadPriority::VeryLow) final;