Changeset 225818 in webkit
- Timestamp:
- Dec 12, 2017 3:54:34 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r225811 r225818 1 2017-12-12 John Wilander <wilander@apple.com> 2 3 Dispatch resource load statistics telemetry on the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=180602 5 <rdar://problem/35942205> 6 7 Reviewed by Brent Fulgham. 8 9 * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: 10 (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): 11 Now switches to the main thread for the telemetry submission 12 through a webpage proxy. The reason is that the webpage we 13 use may go away while we're still using it. This kind of 14 telemetry isn't associated with a specific webpage but the 15 infrastructure requires a webpage proxy. 16 1 17 2017-12-12 Myles C. Maxfield <mmaxfield@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsTelemetry.cpp
r223616 r225818 247 247 } 248 248 249 auto webPageProxy = nonEphemeralWebPageProxy(); 250 if (!webPageProxy) { 251 if (notifyPagesWhenTelemetryWasCaptured) 252 notifyPages(0, 0, 0); 253 return; 254 } 255 256 if (notifyPagesWhenTelemetryWasCaptured) { 257 notifyPages(sortedPrevalentResources, sortedPrevalentResourcesWithoutUserInteraction, prevalentResourcesDaysSinceUserInteraction.size()); 258 // The notify pages function is for testing so we don't need to do an actual submission. 259 return; 260 } 261 262 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("totalNumberOfPrevalentResources"), sortedPrevalentResources.size(), significantFiguresForLoggedValues, ShouldSample::No); 263 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("totalNumberOfPrevalentResourcesWithUserInteraction"), prevalentResourcesDaysSinceUserInteraction.size(), significantFiguresForLoggedValues, ShouldSample::No); 264 265 if (prevalentResourcesDaysSinceUserInteraction.size() > 0) 266 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("topPrevalentResourceWithUserInteractionDaysSinceUserInteraction"), prevalentResourcesDaysSinceUserInteraction[0], significantFiguresForLoggedValues, ShouldSample::No); 267 if (prevalentResourcesDaysSinceUserInteraction.size() > 1) 268 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("medianPrevalentResourcesWithUserInteractionDaysSinceUserInteraction"), median(prevalentResourcesDaysSinceUserInteraction), significantFiguresForLoggedValues, ShouldSample::No); 269 270 submitTopLists(sortedPrevalentResources, sortedPrevalentResourcesWithoutUserInteraction, *webPageProxy); 249 // Dispatch on the main thread to make sure the WebPageProxy we're using doesn't go away. 250 RunLoop::main().dispatch([sortedPrevalentResources = WTFMove(sortedPrevalentResources), sortedPrevalentResourcesWithoutUserInteraction = WTFMove(sortedPrevalentResourcesWithoutUserInteraction), prevalentResourcesDaysSinceUserInteraction = WTFMove(prevalentResourcesDaysSinceUserInteraction)] () { 251 auto webPageProxy = nonEphemeralWebPageProxy(); 252 if (!webPageProxy) { 253 if (notifyPagesWhenTelemetryWasCaptured) 254 notifyPages(0, 0, 0); 255 return; 256 } 257 258 if (notifyPagesWhenTelemetryWasCaptured) { 259 notifyPages(sortedPrevalentResources, sortedPrevalentResourcesWithoutUserInteraction, prevalentResourcesDaysSinceUserInteraction.size()); 260 // The notify pages function is for testing so we don't need to do an actual submission. 261 return; 262 } 263 264 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("totalNumberOfPrevalentResources"), sortedPrevalentResources.size(), significantFiguresForLoggedValues, ShouldSample::No); 265 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("totalNumberOfPrevalentResourcesWithUserInteraction"), prevalentResourcesDaysSinceUserInteraction.size(), significantFiguresForLoggedValues, ShouldSample::No); 266 267 if (prevalentResourcesDaysSinceUserInteraction.size() > 0) 268 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("topPrevalentResourceWithUserInteractionDaysSinceUserInteraction"), prevalentResourcesDaysSinceUserInteraction[0], significantFiguresForLoggedValues, ShouldSample::No); 269 if (prevalentResourcesDaysSinceUserInteraction.size() > 1) 270 webPageProxy->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey(), ASCIILiteral("medianPrevalentResourcesWithUserInteractionDaysSinceUserInteraction"), median(prevalentResourcesDaysSinceUserInteraction), significantFiguresForLoggedValues, ShouldSample::No); 271 272 submitTopLists(sortedPrevalentResources, sortedPrevalentResourcesWithoutUserInteraction, *webPageProxy); 273 }); 271 274 } 272 275
Note: See TracChangeset
for help on using the changeset viewer.