Title: [240089] trunk/Source/WebKit
Revision
240089
Author
[email protected]
Date
2019-01-16 15:50:26 -0800 (Wed, 16 Jan 2019)

Log Message

ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
https://bugs.webkit.org/show_bug.cgi?id=189097
<rdar://problem/43856423>

Reviewed by Alex Christensen.

In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
To fix this issue, store whether to capture metrics at NetworkResourceLoader level.

To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
* NetworkProcess/NetworkConnectionToWebProcess.h:
(WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
(WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
* NetworkProcess/NetworkResourceLoader.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (240088 => 240089)


--- trunk/Source/WebKit/ChangeLog	2019-01-16 23:50:17 UTC (rev 240088)
+++ trunk/Source/WebKit/ChangeLog	2019-01-16 23:50:26 UTC (rev 240089)
@@ -1,3 +1,26 @@
+2019-01-16  Youenn Fablet  <[email protected]>
+
+        ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
+        https://bugs.webkit.org/show_bug.cgi?id=189097
+        <rdar://problem/43856423>
+
+        Reviewed by Alex Christensen.
+
+        In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
+        If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
+        To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
+
+        To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
+        (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
+        * NetworkProcess/NetworkResourceLoader.h:
+
 2019-01-16  Alex Christensen  <[email protected]>
 
         Revert r239938

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (240088 => 240089)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-01-16 23:50:17 UTC (rev 240088)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-01-16 23:50:26 UTC (rev 240089)
@@ -545,8 +545,12 @@
 void NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled(bool enabled)
 {
     m_captureExtraNetworkLoadMetricsEnabled = enabled;
-    if (!m_captureExtraNetworkLoadMetricsEnabled)
-        m_networkLoadInformationByID.clear();
+    if (m_captureExtraNetworkLoadMetricsEnabled)
+        return;
+
+    m_networkLoadInformationByID.clear();
+    for (auto& loader : m_networkResourceLoaders.values())
+        loader->disableExtraNetworkLoadMetricsCapture();
 }
 
 void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession()

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (240088 => 240089)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2019-01-16 23:50:17 UTC (rev 240088)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2019-01-16 23:50:26 UTC (rev 240089)
@@ -96,6 +96,7 @@
     , m_isAllowedToAskUserForCredentials { m_parameters.clientCredentialPolicy == ClientCredentialPolicy::MayAskClientForCredentials }
     , m_bufferingTimer { *this, &NetworkResourceLoader::bufferingTimerFired }
     , m_cache { sessionID().isEphemeral() ? nullptr : connection.networkProcess().cache() }
+    , m_shouldCaptureExtraNetworkLoadMetrics(m_connection->captureExtraNetworkLoadMetricsEnabled())
 {
     ASSERT(RunLoop::isMain());
     // FIXME: This is necessary because of the existence of EmptyFrameLoaderClient in WebCore.
@@ -944,7 +945,7 @@
 
 bool NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics() const
 {
-    return m_connection->captureExtraNetworkLoadMetricsEnabled();
+    return m_shouldCaptureExtraNetworkLoadMetrics;
 }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h (240088 => 240089)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h	2019-01-16 23:50:17 UTC (rev 240088)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h	2019-01-16 23:50:26 UTC (rev 240089)
@@ -113,6 +113,8 @@
     static void logCookieInformation(NetworkConnectionToWebProcess&, const String& label, const void* loggedObject, const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier);
 #endif
 
+    void disableExtraNetworkLoadMetricsCapture() { m_shouldCaptureExtraNetworkLoadMetrics = false; }
+
 private:
     NetworkResourceLoader(NetworkResourceLoadParameters&&, NetworkConnectionToWebProcess&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply&&);
 
@@ -205,6 +207,7 @@
     std::unique_ptr<NetworkLoadChecker> m_networkLoadChecker;
     bool m_shouldRestartLoad { false };
     ResponseCompletionHandler m_responseCompletionHandler;
+    bool m_shouldCaptureExtraNetworkLoadMetrics { false };
 
     Optional<NetworkActivityTracker> m_networkActivityTracker;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to