Title: [233787] trunk/Source/WebKit
Revision
233787
Author
[email protected]
Date
2018-07-12 16:46:17 -0700 (Thu, 12 Jul 2018)

Log Message

PingLoad does not need to ref the NetworkConnectionToWebProcess
https://bugs.webkit.org/show_bug.cgi?id=187624

Reviewed by Youenn Fablet.

PingLoad does not need to ref the NetworkConnectionToWebProcess and keep it alive longer than it needs to be.
Instead, ref the IPC::Connection which is lighter weight and gets invalidated when the NetworkConnectionToWebProcess
is destroyed.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::loadPing):
(WebKit::NetworkConnectionToWebProcess::didFinishPingLoad): Deleted.
* NetworkProcess/NetworkConnectionToWebProcess.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (233786 => 233787)


--- trunk/Source/WebKit/ChangeLog	2018-07-12 23:37:10 UTC (rev 233786)
+++ trunk/Source/WebKit/ChangeLog	2018-07-12 23:46:17 UTC (rev 233787)
@@ -1,3 +1,19 @@
+2018-07-12  Chris Dumez  <[email protected]>
+
+        PingLoad does not need to ref the NetworkConnectionToWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=187624
+
+        Reviewed by Youenn Fablet.
+
+        PingLoad does not need to ref the NetworkConnectionToWebProcess and keep it alive longer than it needs to be.
+        Instead, ref the IPC::Connection which is lighter weight and gets invalidated when the NetworkConnectionToWebProcess
+        is destroyed.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::loadPing):
+        (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad): Deleted.
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+
 2018-07-12  Brady Eidson  <[email protected]>
 
         Make process-swap-on-navigation an experimental feature.

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (233786 => 233787)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2018-07-12 23:37:10 UTC (rev 233786)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2018-07-12 23:46:17 UTC (rev 233787)
@@ -263,8 +263,8 @@
 
 void NetworkConnectionToWebProcess::loadPing(NetworkResourceLoadParameters&& loadParameters)
 {
-    auto completionHandler = [this, protectedThis = makeRef(*this), identifier = loadParameters.identifier] (const ResourceError& error, const ResourceResponse& response) {
-        didFinishPingLoad(identifier, error, response);
+    auto completionHandler = [connection = m_connection.copyRef(), identifier = loadParameters.identifier] (const ResourceError& error, const ResourceResponse& response) {
+        connection->send(Messages::NetworkProcessConnection::DidFinishPingLoad(identifier, error, response), 0);
     };
 
     // PingLoad manages its own lifetime, deleting itself when its purpose has been fulfilled.
@@ -271,14 +271,6 @@
     new PingLoad(WTFMove(loadParameters), WTFMove(completionHandler));
 }
 
-void NetworkConnectionToWebProcess::didFinishPingLoad(uint64_t pingLoadIdentifier, const ResourceError& error, const ResourceResponse& response)
-{
-    if (!m_connection->isValid())
-        return;
-
-    m_connection->send(Messages::NetworkProcessConnection::DidFinishPingLoad(pingLoadIdentifier, error, response), 0);
-}
-
 void NetworkConnectionToWebProcess::setOnLineState(bool isOnLine)
 {
     m_connection->send(Messages::NetworkProcessConnection::SetOnLineState(isOnLine), 0);

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (233786 => 233787)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2018-07-12 23:37:10 UTC (rev 233786)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2018-07-12 23:46:17 UTC (rev 233787)
@@ -68,7 +68,6 @@
     IPC::Connection& connection() { return m_connection.get(); }
 
     void didCleanupResourceLoader(NetworkResourceLoader&);
-    void didFinishPingLoad(uint64_t pingLoadIdentifier, const WebCore::ResourceError&, const WebCore::ResourceResponse&);
     void setOnLineState(bool);
 
     bool captureExtraNetworkLoadMetricsEnabled() const { return m_captureExtraNetworkLoadMetricsEnabled; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to