Fix NumInputEvents, TotalInputDelay and TotalAdjustedInputDelay UKM.
The current values of NumInputEvents are too high. The reason is sending the actual value of num_input_events from render to browser will cause recounting input events. Instead, we need to send the delta of the values.
The function DidChangePerformanceTiming() on line 277 will call functions that send page load timing metrics from render side to browser.
When the browser receives the updated page load timing metrics, it will merge timing values received from different frames together. For NumInputEvents, TotalInputDelay and TotalAdjustedInputDelay, we sum up all values(PageLoadTimingMerger::MergeInteractiveTiming()), which means we should send the deltas of them. So we need to reset the values after sending them to the browser.
Basically, this CL is for two things.
1) Resetting the values when interactive_detector sends metrics to metrics_render_frame_observe.
2) Resetting the values when page_timing_metrics_sender sends the metrics to browser side.
Code flow
Sending metrics from render side:
DocumentLoader::DidChangePerformanceTiming() => ... => PageTimingMetricsSender::SendNow() => MojoPageTimingSender::SendTiming() => PageLoadMetrics::UpdateTiming()
Receiving metrics on browser side:
PageLoadMetrics::UpdateTiming() => ... => PageLoadMetricsUpdateDispatcher::UpdateMetrics() => PageLoadMetricsUpdateDispatcher::UpdateMainFrameTiming()/UpdateSubFrameTiming() =>PageLoadTimingMerger::Merge() => PageLoadTimingMerger::MergeInteractiveTiming()
This CL is just a temporary fix. There will be another CL for plumbing all input delays to browser and doing calculation on browser side.
Bug: 1051042
Change-Id: Ia58243295cdc90974ce1cb3bf53e3b6bee3c482e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084100
Commit-Queue: Hongbo Song <[email protected]>
Reviewed-by: Bryan McQuade <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Reviewed-by: Alex Gough <[email protected]>
Reviewed-by: Nate Chapin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#753782}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index ac3e90f..3b58f29d 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -735,6 +735,7 @@
void DidDisplayContentWithCertificateErrors() override;
void DidRunContentWithCertificateErrors() override;
void DidChangePerformanceTiming() override;
+ void DidObserveInputDelay(base::TimeDelta input_delay) override;
void DidChangeCpuTiming(base::TimeDelta time) override;
void DidObserveLoadingBehavior(blink::LoadingBehaviorFlag behavior) override;
void DidObserveNewFeatureUsage(blink::mojom::WebFeature feature) override;