Title: [230636] trunk/Source/WebKit
Revision
230636
Author
dba...@webkit.org
Date
2018-04-13 09:54:12 -0700 (Fri, 13 Apr 2018)

Log Message

Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
https://bugs.webkit.org/show_bug.cgi?id=184593

Reviewed by Alex Christensen.

Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
and the cognitive load to follow such a function call when reading the code.

No functionality changed. So, no new tests.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
into this function.
(WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
into NetworkLoad::willPerformHTTPRedirection().
* NetworkProcess/NetworkLoad.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (230635 => 230636)


--- trunk/Source/WebKit/ChangeLog	2018-04-13 16:48:56 UTC (rev 230635)
+++ trunk/Source/WebKit/ChangeLog	2018-04-13 16:54:12 UTC (rev 230636)
@@ -1,5 +1,26 @@
 2018-04-13  Daniel Bates  <daba...@apple.com>
 
+        Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
+        https://bugs.webkit.org/show_bug.cgi?id=184593
+
+        Reviewed by Alex Christensen.
+
+        Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
+        is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
+        implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
+        and the cognitive load to follow such a function call when reading the code.
+
+        No functionality changed. So, no new tests.
+
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
+        into this function.
+        (WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
+        into NetworkLoad::willPerformHTTPRedirection().
+        * NetworkProcess/NetworkLoad.h:
+
+2018-04-13  Daniel Bates  <daba...@apple.com>
+
         Inline NetworkLoad::sharedDidReceiveResponse() into NetworkLoad::notifyDidReceiveResponse()
         https://bugs.webkit.org/show_bug.cgi?id=184592
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp (230635 => 230636)


--- trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp	2018-04-13 16:48:56 UTC (rev 230635)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp	2018-04-13 16:54:12 UTC (rev 230636)
@@ -191,22 +191,6 @@
     return m_client.get().shouldCaptureExtraNetworkLoadMetrics();
 }
 
-void NetworkLoad::sharedWillSendRedirectedRequest(ResourceRequest&& request, ResourceResponse&& redirectResponse)
-{
-    // We only expect to get the willSendRequest callback from ResourceHandle as the result of a redirect.
-    ASSERT(!redirectResponse.isNull());
-    ASSERT(RunLoop::isMain());
-
-#if ENABLE(NETWORK_CAPTURE)
-    if (m_recorder)
-        m_recorder->recordRedirectReceived(request, redirectResponse);
-#endif
-
-    auto oldRequest = WTFMove(m_currentRequest);
-    m_currentRequest = request;
-    m_client.get().willSendRedirectedRequest(WTFMove(oldRequest), WTFMove(request), WTFMove(redirectResponse));
-}
-
 bool NetworkLoad::isAllowedToAskUserForCredentials() const
 {
     return m_client.get().isAllowedToAskUserForCredentials();
@@ -249,11 +233,22 @@
     m_task->setPendingDownload(pendingDownload);
 }
 
-void NetworkLoad::willPerformHTTPRedirection(ResourceResponse&& response, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler)
+void NetworkLoad::willPerformHTTPRedirection(ResourceResponse&& redirectResponse, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler)
 {
+    ASSERT(!redirectResponse.isNull());
+    ASSERT(RunLoop::isMain());
     ASSERT(!m_redirectCompletionHandler);
+
     m_redirectCompletionHandler = WTFMove(completionHandler);
-    sharedWillSendRedirectedRequest(WTFMove(request), WTFMove(response));
+
+#if ENABLE(NETWORK_CAPTURE)
+    if (m_recorder)
+        m_recorder->recordRedirectReceived(request, redirectResponse);
+#endif
+
+    auto oldRequest = WTFMove(m_currentRequest);
+    m_currentRequest = request;
+    m_client.get().willSendRedirectedRequest(WTFMove(oldRequest), WTFMove(request), WTFMove(redirectResponse));
 }
 
 void NetworkLoad::didReceiveChallenge(const AuthenticationChallenge& challenge, ChallengeCompletionHandler&& completionHandler)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkLoad.h (230635 => 230636)


--- trunk/Source/WebKit/NetworkProcess/NetworkLoad.h	2018-04-13 16:48:56 UTC (rev 230635)
+++ trunk/Source/WebKit/NetworkProcess/NetworkLoad.h	2018-04-13 16:54:12 UTC (rev 230636)
@@ -79,8 +79,6 @@
 #endif
     void initialize(NetworkSession&);
 
-    void sharedWillSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&);
-
     // NetworkDataTaskClient
     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final;
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to