Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc

Issue 2776933004: Revert "Track input latency while starting a ServiceWorker for a navigation hint." (Closed)
Patch Set: rebase and fix indent Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h" 5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_functions.h" 10 #include "base/metrics/histogram_functions.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } else if (WebInputEvent::isTouchEventType(type)) { 149 } else if (WebInputEvent::isTouchEventType(type)) {
150 return "Touch"; 150 return "Touch";
151 } 151 }
152 return ""; 152 return "";
153 } 153 }
154 154
155 void ComputeScrollLatencyHistograms( 155 void ComputeScrollLatencyHistograms(
156 const LatencyInfo::LatencyComponent& gpu_swap_begin_component, 156 const LatencyInfo::LatencyComponent& gpu_swap_begin_component,
157 const LatencyInfo::LatencyComponent& gpu_swap_end_component, 157 const LatencyInfo::LatencyComponent& gpu_swap_end_component,
158 int64_t latency_component_id, 158 int64_t latency_component_id,
159 const LatencyInfo& latency, 159 const LatencyInfo& latency) {
160 bool is_running_navigation_hint_task) {
161 DCHECK(!latency.coalesced()); 160 DCHECK(!latency.coalesced());
162 if (latency.coalesced()) 161 if (latency.coalesced())
163 return; 162 return;
164 163
165 DCHECK(!gpu_swap_begin_component.event_time.is_null()); 164 DCHECK(!gpu_swap_begin_component.event_time.is_null());
166 DCHECK(!gpu_swap_end_component.event_time.is_null()); 165 DCHECK(!gpu_swap_end_component.event_time.is_null());
167 LatencyInfo::LatencyComponent original_component; 166 LatencyInfo::LatencyComponent original_component;
168 if (latency.FindLatency( 167 if (latency.FindLatency(
169 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 168 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
170 latency_component_id, &original_component)) { 169 latency_component_id, &original_component)) {
171 // This UMA metric tracks the time between the final frame swap for the 170 // This UMA metric tracks the time between the final frame swap for the
172 // first scroll event in a sequence and the original timestamp of that 171 // first scroll event in a sequence and the original timestamp of that
173 // scroll event's underlying touch event. 172 // scroll event's underlying touch event.
174 for (size_t i = 0; i < original_component.event_count; i++) { 173 for (size_t i = 0; i < original_component.event_count; i++) {
175 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( 174 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
176 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", 175 "Event.Latency.TouchToFirstScrollUpdateSwapBegin",
177 original_component, gpu_swap_begin_component); 176 original_component, gpu_swap_begin_component);
178 } 177 }
179 // TODO(horo): IsRunningNavigationHintTask UMAs are only for
180 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when
181 // the experimentation finished (crbug.com/638827).
182 if (is_running_navigation_hint_task) {
183 for (size_t i = 0; i < original_component.event_count; i++) {
184 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
185 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_"
186 "IsRunningNavigationHintTask",
187 original_component, gpu_swap_begin_component);
188 }
189 }
190 } else if (!latency.FindLatency( 178 } else if (!latency.FindLatency(
191 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 179 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
192 latency_component_id, &original_component)) { 180 latency_component_id, &original_component)) {
193 return; 181 return;
194 } 182 }
195 183
196 // This UMA metric tracks the time from when the original touch event is 184 // This UMA metric tracks the time from when the original touch event is
197 // created to when the scroll gesture results in final frame swap. 185 // created to when the scroll gesture results in final frame swap.
198 for (size_t i = 0; i < original_component.event_count; i++) { 186 for (size_t i = 0; i < original_component.event_count; i++) {
199 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( 187 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
200 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, 188 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component,
201 gpu_swap_begin_component); 189 gpu_swap_begin_component);
202 } 190 }
203 // TODO(horo): IsRunningNavigationHintTask UMAs are only for
204 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when
205 // the experimentation finished (crbug.com/638827).
206 if (is_running_navigation_hint_task) {
207 for (size_t i = 0; i < original_component.event_count; i++) {
208 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
209 "Event.Latency.TouchToScrollUpdateSwapBegin_"
210 "IsRunningNavigationHintTask",
211 original_component, gpu_swap_begin_component);
212 }
213 }
214 } 191 }
215 192
216 void ComputeTouchAndWheelScrollLatencyHistograms( 193 void ComputeTouchAndWheelScrollLatencyHistograms(
217 RenderWidgetHostDelegate* render_widget_host_delegate, 194 RenderWidgetHostDelegate* render_widget_host_delegate,
218 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, 195 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component,
219 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, 196 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component,
220 int64_t latency_component_id, 197 int64_t latency_component_id,
221 const ui::LatencyInfo& latency) { 198 const ui::LatencyInfo& latency) {
222 DCHECK(!latency.coalesced()); 199 DCHECK(!latency.coalesced());
223 if (latency.coalesced()) 200 if (latency.coalesced())
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 std::vector<LatencyInfo>* latencies) { 529 std::vector<LatencyInfo>* latencies) {
553 DCHECK(latencies); 530 DCHECK(latencies);
554 for (LatencyInfo& latency : *latencies) { 531 for (LatencyInfo& latency : *latencies) {
555 AddLatencyInfoComponentIds(&latency, latency_component_id_); 532 AddLatencyInfoComponentIds(&latency, latency_component_id_);
556 latency.AddLatencyNumber( 533 latency.AddLatencyNumber(
557 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); 534 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0);
558 } 535 }
559 } 536 }
560 537
561 void RenderWidgetHostLatencyTracker::OnFrameSwapped( 538 void RenderWidgetHostLatencyTracker::OnFrameSwapped(
562 const LatencyInfo& latency, 539 const LatencyInfo& latency) {
563 bool is_running_navigation_hint_task) {
564 LatencyInfo::LatencyComponent gpu_swap_end_component; 540 LatencyInfo::LatencyComponent gpu_swap_end_component;
565 if (!latency.FindLatency( 541 if (!latency.FindLatency(
566 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 542 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0,
567 &gpu_swap_end_component)) { 543 &gpu_swap_end_component)) {
568 return; 544 return;
569 } 545 }
570 546
571 LatencyInfo::LatencyComponent gpu_swap_begin_component; 547 LatencyInfo::LatencyComponent gpu_swap_begin_component;
572 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 548 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0,
573 &gpu_swap_begin_component)) { 549 &gpu_swap_begin_component)) {
(...skipping 23 matching lines...) Expand all
597 gpu_swap_end_component, latency_component_id_, latency); 573 gpu_swap_end_component, latency_component_id_, latency);
598 } 574 }
599 575
600 // Compute the old scroll update latency metrics. They are exclusively 576 // Compute the old scroll update latency metrics. They are exclusively
601 // calculated for touch scrolls, and will be deprecated on M56. 577 // calculated for touch scrolls, and will be deprecated on M56.
602 // (https://crbug.com/649754) 578 // (https://crbug.com/649754)
603 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component; 579 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component;
604 if (!latency.FindLatency( 580 if (!latency.FindLatency(
605 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, 581 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0,
606 &mouse_wheel_scroll_update_component)) { 582 &mouse_wheel_scroll_update_component)) {
607 ComputeScrollLatencyHistograms( 583 ComputeScrollLatencyHistograms(gpu_swap_begin_component,
608 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, 584 gpu_swap_end_component,
609 latency, is_running_navigation_hint_task); 585 latency_component_id_, latency);
610 } 586 }
611 } 587 }
612 588
613 void RenderWidgetHostLatencyTracker::SetDelegate( 589 void RenderWidgetHostLatencyTracker::SetDelegate(
614 RenderWidgetHostDelegate* delegate) { 590 RenderWidgetHostDelegate* delegate) {
615 render_widget_host_delegate_ = delegate; 591 render_widget_host_delegate_ = delegate;
616 } 592 }
617 593
618 } // namespace content 594 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698