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

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

Issue 2570893003: Clean up LatencyInfo and RWHLatencyTracker. (Closed)
Patch Set: Splitting up patch - not changing histogram API. Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 latency, device_scale_factor); 68 latency, device_scale_factor);
69 } else if (WebInputEvent::isTouchEventType(event.type())) { 69 } else if (WebInputEvent::isTouchEventType(event.type())) {
70 UpdateLatencyCoordinatesImpl(static_cast<const WebTouchEvent&>(event), 70 UpdateLatencyCoordinatesImpl(static_cast<const WebTouchEvent&>(event),
71 latency, device_scale_factor); 71 latency, device_scale_factor);
72 } else if (event.type() == WebInputEvent::MouseWheel) { 72 } else if (event.type() == WebInputEvent::MouseWheel) {
73 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseWheelEvent&>(event), 73 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseWheelEvent&>(event),
74 latency, device_scale_factor); 74 latency, device_scale_factor);
75 } 75 }
76 } 76 }
77 77
78 // Touch to scroll latency that is mostly under 1 second.
79 #define UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(name, start, end) \
80 UMA_HISTOGRAM_CUSTOM_COUNTS( \
81 name, (end.event_time - start.event_time).InMicroseconds(), 1, 1000000, \
82 100)
83
84 // Long scroll latency component that is mostly under 200ms.
85 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \
86 UMA_HISTOGRAM_CUSTOM_COUNTS( \
87 name, \
88 (end.event_time - start.event_time).InMicroseconds(), \
89 1000, 200000, 50)
90
91 // Short scroll latency component that is mostly under 50ms.
92 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \
93 UMA_HISTOGRAM_CUSTOM_COUNTS( \
94 name, \
95 (end.event_time - start.event_time).InMicroseconds(), \
96 1, 50000, 50)
97
98 // Check valid timing for start and end latency components. 78 // Check valid timing for start and end latency components.
99 #define CONFIRM_VALID_TIMING(start, end) \ 79 #define CONFIRM_VALID_TIMING(start, end) \
100 DCHECK(!start.first_event_time.is_null()); \ 80 DCHECK(!start.first_event_time.is_null()); \
101 DCHECK(!end.last_event_time.is_null()); \ 81 DCHECK(!end.last_event_time.is_null()); \
102 DCHECK_GE(end.last_event_time, start.first_event_time); 82 DCHECK_GE(end.last_event_time, start.first_event_time);
103 83
84 // Long scroll latency component that is mostly under 200ms.
85 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \
86 CONFIRM_VALID_TIMING(start, end); \
87 UMA_HISTOGRAM_CUSTOM_COUNTS( \
88 name, (end.event_time - start.event_time).InMicroseconds(), 1000, \
89 200000, 50)
90
91 // Short scroll latency component that is mostly under 50ms.
92 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \
93 CONFIRM_VALID_TIMING(start, end); \
94 UMA_HISTOGRAM_CUSTOM_COUNTS( \
95 name, (end.event_time - start.event_time).InMicroseconds(), 1, 50000, \
96 50)
97
98 // Event latency that is mostly under 1 second. We should only use 100 buckets
99 // when needed.
100 #define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \
101 end) \
102 CONFIRM_VALID_TIMING(start, end) \
103 base::Histogram::FactoryGet(name, 1, 1000000, 100, \
104 base::HistogramBase::kUmaTargetedHistogramFlag) \
105 ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
106
107 #define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \
108 CONFIRM_VALID_TIMING(start, end) \
109 base::Histogram::FactoryGet(name, 1, 1000, 50, \
110 base::HistogramBase::kUmaTargetedHistogramFlag) \
111 ->Add((end.last_event_time - start.first_event_time).InMilliseconds());
Ilya Sherman 2017/01/23 20:02:33 As I mentioned before, it's preferable to use func
tdresser 2017/01/23 20:34:02 Oops, done. I'll be migrating everything away from
112
104 // Touch/wheel to scroll latency using Rappor. 113 // Touch/wheel to scroll latency using Rappor.
105 #define RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(delegate, name, start, end) \ 114 #define RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(delegate, name, start, end) \
106 CONFIRM_VALID_TIMING(start, end) \ 115 CONFIRM_VALID_TIMING(start, end) \
107 rappor::RapporService* rappor_service = \ 116 rappor::RapporService* rappor_service = \
108 GetContentClient()->browser()->GetRapporService(); \ 117 GetContentClient()->browser()->GetRapporService(); \
109 if (rappor_service && delegate) { \ 118 if (rappor_service && delegate) { \
110 std::unique_ptr<rappor::Sample> sample = \ 119 std::unique_ptr<rappor::Sample> sample = \
111 rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); \ 120 rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); \
112 delegate->AddDomainInfoToRapporSample(sample.get()); \ 121 delegate->AddDomainInfoToRapporSample(sample.get()); \
113 sample->SetUInt64Field( \ 122 sample->SetUInt64Field( \
114 "Latency", \ 123 "Latency", \
115 (end.last_event_time - start.first_event_time).InMicroseconds(), \ 124 (end.last_event_time - start.first_event_time).InMicroseconds(), \
116 rappor::NO_NOISE); \ 125 rappor::NO_NOISE); \
117 rappor_service->RecordSample(name, std::move(sample)); \ 126 rappor_service->RecordSample(name, std::move(sample)); \
118 } 127 }
119 128
120 // Touch/wheel to scroll latency that is mostly under 1 second.
121 #define UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(name, start, end) \
122 CONFIRM_VALID_TIMING(start, end) \
123 base::Histogram::FactoryGet(name, 1, 1000000, 100, \
124 base::HistogramBase::kUmaTargetedHistogramFlag) \
125 ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
126
127 // Long touch/wheel scroll latency component that is mostly under 200ms. 129 // Long touch/wheel scroll latency component that is mostly under 200ms.
128 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \ 130 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \
129 CONFIRM_VALID_TIMING(start, end) \ 131 CONFIRM_VALID_TIMING(start, end) \
130 base::Histogram::FactoryGet(name, 1000, 200000, 50, \ 132 base::Histogram::FactoryGet(name, 1000, 200000, 50, \
131 base::HistogramBase::kUmaTargetedHistogramFlag) \ 133 base::HistogramBase::kUmaTargetedHistogramFlag) \
132 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); 134 ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
133 135
134 // Short touch/wheel scroll latency component that is mostly under 50ms. 136 // Short touch/wheel scroll latency component that is mostly under 50ms.
135 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \ 137 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \
136 CONFIRM_VALID_TIMING(start, end) \ 138 CONFIRM_VALID_TIMING(start, end) \
137 base::Histogram::FactoryGet(name, 1, 50000, 50, \ 139 base::Histogram::FactoryGet(name, 1, 50000, 50, \
138 base::HistogramBase::kUmaTargetedHistogramFlag) \ 140 base::HistogramBase::kUmaTargetedHistogramFlag) \
139 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); 141 ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
140 142
143 std::string LatencySourceEventTypeToInputModalityString(
144 ui::SourceEventType type) {
145 switch (type) {
146 case ui::SourceEventType::WHEEL:
147 return "Wheel";
148 case ui::SourceEventType::TOUCH:
149 return "Touch";
150 default:
151 return "";
152 }
153 }
154
155 std::string WebInputEventTypeToInputModalityString(WebInputEvent::Type type) {
156 if (type == blink::WebInputEvent::MouseWheel) {
157 return "Wheel";
158 } else if (WebInputEvent::isKeyboardEventType(type)) {
159 return "Key";
160 } else if (WebInputEvent::isMouseEventType(type)) {
161 return "Mouse";
162 } else if (WebInputEvent::isTouchEventType(type)) {
163 return "Touch";
164 }
165 return "";
166 }
167
141 void ComputeScrollLatencyHistograms( 168 void ComputeScrollLatencyHistograms(
142 const LatencyInfo::LatencyComponent& gpu_swap_begin_component, 169 const LatencyInfo::LatencyComponent& gpu_swap_begin_component,
143 const LatencyInfo::LatencyComponent& gpu_swap_end_component, 170 const LatencyInfo::LatencyComponent& gpu_swap_end_component,
144 int64_t latency_component_id, 171 int64_t latency_component_id,
145 const LatencyInfo& latency, 172 const LatencyInfo& latency,
146 bool is_running_navigation_hint_task) { 173 bool is_running_navigation_hint_task) {
147 DCHECK(!latency.coalesced()); 174 DCHECK(!latency.coalesced());
148 if (latency.coalesced()) 175 if (latency.coalesced())
149 return; 176 return;
150 177
151 DCHECK(!gpu_swap_begin_component.event_time.is_null()); 178 DCHECK(!gpu_swap_begin_component.event_time.is_null());
152 DCHECK(!gpu_swap_end_component.event_time.is_null()); 179 DCHECK(!gpu_swap_end_component.event_time.is_null());
153 LatencyInfo::LatencyComponent original_component; 180 LatencyInfo::LatencyComponent original_component;
154 if (latency.FindLatency( 181 if (latency.FindLatency(
155 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 182 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
156 latency_component_id, &original_component)) { 183 latency_component_id, &original_component)) {
157 // This UMA metric tracks the time between the final frame swap for the 184 // This UMA metric tracks the time between the final frame swap for the
158 // first scroll event in a sequence and the original timestamp of that 185 // first scroll event in a sequence and the original timestamp of that
159 // scroll event's underlying touch event. 186 // scroll event's underlying touch event.
160 for (size_t i = 0; i < original_component.event_count; i++) { 187 for (size_t i = 0; i < original_component.event_count; i++) {
161 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 188 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
162 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", 189 "Event.Latency.TouchToFirstScrollUpdateSwapBegin",
163 original_component, gpu_swap_begin_component); 190 original_component, gpu_swap_begin_component);
164 } 191 }
165 // TODO(horo): IsRunningNavigationHintTask UMAs are only for 192 // TODO(horo): IsRunningNavigationHintTask UMAs are only for
166 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when 193 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when
167 // the experimentation finished (crbug.com/638827). 194 // the experimentation finished (crbug.com/638827).
168 if (is_running_navigation_hint_task) { 195 if (is_running_navigation_hint_task) {
169 for (size_t i = 0; i < original_component.event_count; i++) { 196 for (size_t i = 0; i < original_component.event_count; i++) {
170 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 197 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
171 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_" 198 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_"
172 "IsRunningNavigationHintTask", 199 "IsRunningNavigationHintTask",
173 original_component, gpu_swap_begin_component); 200 original_component, gpu_swap_begin_component);
174 } 201 }
175 } 202 }
176 } else if (!latency.FindLatency( 203 } else if (!latency.FindLatency(
177 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 204 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
178 latency_component_id, &original_component)) { 205 latency_component_id, &original_component)) {
179 return; 206 return;
180 } 207 }
181 208
182 // This UMA metric tracks the time from when the original touch event is 209 // This UMA metric tracks the time from when the original touch event is
183 // created to when the scroll gesture results in final frame swap. 210 // created to when the scroll gesture results in final frame swap.
184 for (size_t i = 0; i < original_component.event_count; i++) { 211 for (size_t i = 0; i < original_component.event_count; i++) {
185 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 212 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
186 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, 213 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component,
187 gpu_swap_begin_component); 214 gpu_swap_begin_component);
188 } 215 }
189 // TODO(horo): IsRunningNavigationHintTask UMAs are only for 216 // TODO(horo): IsRunningNavigationHintTask UMAs are only for
190 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when 217 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when
191 // the experimentation finished (crbug.com/638827). 218 // the experimentation finished (crbug.com/638827).
192 if (is_running_navigation_hint_task) { 219 if (is_running_navigation_hint_task) {
193 for (size_t i = 0; i < original_component.event_count; i++) { 220 for (size_t i = 0; i < original_component.event_count; i++) {
194 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 221 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
195 "Event.Latency.TouchToScrollUpdateSwapBegin_" 222 "Event.Latency.TouchToScrollUpdateSwapBegin_"
196 "IsRunningNavigationHintTask", 223 "IsRunningNavigationHintTask",
197 original_component, gpu_swap_begin_component); 224 original_component, gpu_swap_begin_component);
198 } 225 }
199 } 226 }
200 227
201 // TODO(miletus): Add validation for making sure the following components 228 // TODO(miletus): Add validation for making sure the following components
202 // are present and their event times are legit. 229 // are present and their event times are legit.
203 LatencyInfo::LatencyComponent rendering_scheduled_component; 230 LatencyInfo::LatencyComponent rendering_scheduled_component;
204 bool rendering_scheduled_on_main = latency.FindLatency( 231 bool rendering_scheduled_on_main = latency.FindLatency(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT("Event.Latency.ScrollUpdate.GpuSwap", 281 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT("Event.Latency.ScrollUpdate.GpuSwap",
255 gpu_swap_begin_component, 282 gpu_swap_begin_component,
256 gpu_swap_end_component); 283 gpu_swap_end_component);
257 } 284 }
258 285
259 void ComputeTouchAndWheelScrollLatencyHistograms( 286 void ComputeTouchAndWheelScrollLatencyHistograms(
260 RenderWidgetHostDelegate* render_widget_host_delegate, 287 RenderWidgetHostDelegate* render_widget_host_delegate,
261 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, 288 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component,
262 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, 289 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component,
263 int64_t latency_component_id, 290 int64_t latency_component_id,
264 const ui::LatencyInfo& latency, 291 const ui::LatencyInfo& latency) {
265 const std::string event_type_name) {
266 DCHECK(!latency.coalesced()); 292 DCHECK(!latency.coalesced());
267 DCHECK(event_type_name == "Touch" || event_type_name == "Wheel");
268 if (latency.coalesced()) 293 if (latency.coalesced())
269 return; 294 return;
270 295
271 LatencyInfo::LatencyComponent original_component; 296 LatencyInfo::LatencyComponent original_component;
272 std::string scroll_name = "ScrollUpdate"; 297 std::string scroll_name = "ScrollUpdate";
298
299 const std::string input_modality =
300 LatencySourceEventTypeToInputModalityString(latency.source_event_type());
301
273 if (latency.FindLatency( 302 if (latency.FindLatency(
274 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 303 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
275 latency_component_id, &original_component)) { 304 latency_component_id, &original_component)) {
276 scroll_name = "ScrollBegin"; 305 scroll_name = "ScrollBegin";
277 // This UMA metric tracks the time between the final frame swap for the 306 // This UMA metric tracks the time between the final frame swap for the
278 // first scroll event in a sequence and the original timestamp of that 307 // first scroll event in a sequence and the original timestamp of that
279 // scroll event's underlying touch/wheel event. 308 // scroll event's underlying touch/wheel event.
280 309 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
281 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( 310 "Event.Latency.ScrollBegin." + input_modality +
282 "Event.Latency.ScrollBegin." + event_type_name +
283 ".TimeToScrollUpdateSwapBegin2", 311 ".TimeToScrollUpdateSwapBegin2",
284 original_component, gpu_swap_begin_component); 312 original_component, gpu_swap_begin_component);
285 313
286 RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY( 314 RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(
287 render_widget_host_delegate, 315 render_widget_host_delegate,
288 "Event.Latency.ScrollBegin." + event_type_name + 316 "Event.Latency.ScrollBegin." + input_modality +
289 ".TimeToScrollUpdateSwapBegin2", 317 ".TimeToScrollUpdateSwapBegin2",
290 original_component, gpu_swap_begin_component); 318 original_component, gpu_swap_begin_component);
291 319
292 // TODO(lanwei): Will remove them when M56 is stable, see 320 // TODO(lanwei): Will remove them when M56 is stable, see
293 // https://crbug.com/669618. 321 // https://crbug.com/669618.
294 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( 322 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
295 "Event.Latency.ScrollUpdate." + event_type_name + 323 "Event.Latency.ScrollUpdate." + input_modality +
296 ".TimeToFirstScrollUpdateSwapBegin2", 324 ".TimeToFirstScrollUpdateSwapBegin2",
297 original_component, gpu_swap_begin_component); 325 original_component, gpu_swap_begin_component);
298 } else if (latency.FindLatency( 326 } else if (latency.FindLatency(
299 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 327 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
300 latency_component_id, &original_component)) { 328 latency_component_id, &original_component)) {
301 // This UMA metric tracks the time from when the original touch event is 329 // This UMA metric tracks the time from when the original touch event is
302 // created to when the scroll gesture results in final frame swap. 330 // created to when the scroll gesture results in final frame swap.
303 // First scroll events are excluded from this metric. 331 // First scroll events are excluded from this metric.
304 if (event_type_name == "Touch") { 332 if (input_modality == "Touch") {
305 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( 333 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
306 "Event.Latency.ScrollUpdate." + event_type_name + 334 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2",
307 ".TimeToScrollUpdateSwapBegin2",
308 original_component, gpu_swap_begin_component); 335 original_component, gpu_swap_begin_component);
309 336
310 RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY( 337 RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(
311 render_widget_host_delegate, 338 render_widget_host_delegate,
312 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", 339 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2",
313 original_component, gpu_swap_begin_component); 340 original_component, gpu_swap_begin_component);
314 } 341 }
315 } else { 342 } else {
316 // No original component found. 343 // No original component found.
317 return; 344 return;
318 } 345 }
319 346
320 LatencyInfo::LatencyComponent rendering_scheduled_component; 347 LatencyInfo::LatencyComponent rendering_scheduled_component;
321 bool rendering_scheduled_on_main = latency.FindLatency( 348 bool rendering_scheduled_on_main = latency.FindLatency(
322 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, 349 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0,
323 &rendering_scheduled_component); 350 &rendering_scheduled_component);
324 if (!rendering_scheduled_on_main) { 351 if (!rendering_scheduled_on_main) {
325 if (!latency.FindLatency( 352 if (!latency.FindLatency(
326 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, 353 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0,
327 &rendering_scheduled_component)) 354 &rendering_scheduled_component))
328 return; 355 return;
329 } 356 }
330 357
331 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl"; 358 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl";
332 359
333 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( 360 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
334 "Event.Latency." + scroll_name + "." + event_type_name + 361 "Event.Latency." + scroll_name + "." + input_modality +
335 ".TimeToHandled2_" + thread_name, 362 ".TimeToHandled2_" + thread_name,
336 original_component, rendering_scheduled_component); 363 original_component, rendering_scheduled_component);
337 364
338 LatencyInfo::LatencyComponent renderer_swap_component; 365 LatencyInfo::LatencyComponent renderer_swap_component;
339 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 366 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0,
340 &renderer_swap_component)) 367 &renderer_swap_component))
341 return; 368 return;
342 369
343 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( 370 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
344 "Event.Latency." + scroll_name + "." + event_type_name + 371 "Event.Latency." + scroll_name + "." + input_modality +
345 ".HandledToRendererSwap2_" + thread_name, 372 ".HandledToRendererSwap2_" + thread_name,
346 rendering_scheduled_component, renderer_swap_component); 373 rendering_scheduled_component, renderer_swap_component);
347 374
348 LatencyInfo::LatencyComponent browser_received_swap_component; 375 LatencyInfo::LatencyComponent browser_received_swap_component;
349 if (!latency.FindLatency( 376 if (!latency.FindLatency(
350 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 377 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0,
351 &browser_received_swap_component)) 378 &browser_received_swap_component))
352 return; 379 return;
353 380
354 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( 381 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(
355 "Event.Latency." + scroll_name + "." + event_type_name + 382 "Event.Latency." + scroll_name + "." + input_modality +
356 ".RendererSwapToBrowserNotified2", 383 ".RendererSwapToBrowserNotified2",
357 renderer_swap_component, browser_received_swap_component); 384 renderer_swap_component, browser_received_swap_component);
358 385
359 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( 386 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
360 "Event.Latency." + scroll_name + "." + event_type_name + 387 "Event.Latency." + scroll_name + "." + input_modality +
361 ".BrowserNotifiedToBeforeGpuSwap2", 388 ".BrowserNotifiedToBeforeGpuSwap2",
362 browser_received_swap_component, gpu_swap_begin_component); 389 browser_received_swap_component, gpu_swap_begin_component);
363 390
364 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( 391 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(
365 "Event.Latency." + scroll_name + "." + event_type_name + ".GpuSwap2", 392 "Event.Latency." + scroll_name + "." + input_modality + ".GpuSwap2",
366 gpu_swap_begin_component, gpu_swap_end_component); 393 gpu_swap_begin_component, gpu_swap_end_component);
367 } 394 }
368 // LatencyComponents generated in the renderer must have component IDs 395 // LatencyComponents generated in the renderer must have component IDs
369 // provided to them by the browser process. This function adds the correct 396 // provided to them by the browser process. This function adds the correct
370 // component ID where necessary. 397 // component ID where necessary.
371 void AddLatencyInfoComponentIds(LatencyInfo* latency, 398 void AddLatencyInfoComponentIds(LatencyInfo* latency,
372 int64_t latency_component_id) { 399 int64_t latency_component_id) {
373 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key; 400 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key;
374 std::vector<LatencyInfo::LatencyComponent> new_components_value; 401 std::vector<LatencyInfo::LatencyComponent> new_components_value;
375 for (const auto& lc : latency->latency_components()) { 402 for (const auto& lc : latency->latency_components()) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 DCHECK_EQ(0, latency_component_id_); 442 DCHECK_EQ(0, latency_component_id_);
416 last_event_id_ = static_cast<int64_t>(process_id) << 32; 443 last_event_id_ = static_cast<int64_t>(process_id) << 32;
417 latency_component_id_ = routing_id | last_event_id_; 444 latency_component_id_ = routing_id | last_event_id_;
418 } 445 }
419 446
420 void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( 447 void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms(
421 WebInputEvent::Type type, 448 WebInputEvent::Type type,
422 int64_t latency_component_id, 449 int64_t latency_component_id,
423 const LatencyInfo& latency, 450 const LatencyInfo& latency,
424 InputEventAckState ack_result) { 451 InputEventAckState ack_result) {
452 // If this event was coalesced into another event, ignore it, as the event it
453 // was coalesced into will reflect the full latency.
425 if (latency.coalesced()) 454 if (latency.coalesced())
426 return; 455 return;
427 456
457 if (type != blink::WebInputEvent::MouseWheel &&
458 !WebInputEvent::isTouchEventType(type)) {
459 return;
460 }
461
428 LatencyInfo::LatencyComponent rwh_component; 462 LatencyInfo::LatencyComponent rwh_component;
429 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 463 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
430 latency_component_id, &rwh_component)) { 464 latency_component_id, &rwh_component)) {
431 return; 465 return;
432 } 466 }
433 DCHECK_EQ(rwh_component.event_count, 1u); 467 DCHECK_EQ(rwh_component.event_count, 1u);
434 468
435 LatencyInfo::LatencyComponent ui_component; 469 LatencyInfo::LatencyComponent ui_component;
436 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 470 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0,
437 &ui_component)) { 471 &ui_component)) {
438 DCHECK_EQ(ui_component.event_count, 1u); 472 DCHECK_EQ(ui_component.event_count, 1u);
439 base::TimeDelta ui_delta = 473 base::TimeDelta ui_delta =
440 rwh_component.event_time - ui_component.event_time; 474 rwh_component.last_event_time - ui_component.first_event_time;
441 475
442 if (type == blink::WebInputEvent::MouseWheel) { 476 if (type == blink::WebInputEvent::MouseWheel) {
443 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", 477 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI",
444 ui_delta.InMicroseconds(), 1, 20000, 100); 478 ui_delta.InMicroseconds(), 1, 20000, 100);
445
446 } else { 479 } else {
447 DCHECK(WebInputEvent::isTouchEventType(type)); 480 DCHECK(WebInputEvent::isTouchEventType(type));
448 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", 481 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI",
449 ui_delta.InMicroseconds(), 1, 20000, 100); 482 ui_delta.InMicroseconds(), 1, 20000, 100);
450 } 483 }
451 } 484 }
452 485
453 // Both tap and scroll gestures depend on the disposition of the touch start 486 // Both tap and scroll gestures depend on the disposition of the touch start
454 // and the current touch. For touch start, touch_start_default_prevented_ == 487 // and the current touch. For touch start, touch_start_default_prevented_ ==
455 // (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED). 488 // (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED).
456 bool action_prevented = touch_start_default_prevented_ || 489 bool action_prevented = touch_start_default_prevented_ ||
457 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; 490 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED;
458 491
492 std::string event_name = WebInputEvent::GetName(type);
493
494 std::string default_action_status =
495 action_prevented ? "DefaultPrevented" : "DefaultAllowed";
496
459 LatencyInfo::LatencyComponent main_component; 497 LatencyInfo::LatencyComponent main_component;
460 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, 498 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0,
461 &main_component)) { 499 &main_component)) {
462 DCHECK_EQ(main_component.event_count, 1u); 500 DCHECK_EQ(main_component.event_count, 1u);
463 base::TimeDelta queueing_delta =
464 main_component.event_time - rwh_component.event_time;
465
466 if (!multi_finger_gesture_) { 501 if (!multi_finger_gesture_) {
467 if (action_prevented) { 502 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
468 switch (type) { 503 "Event.Latency.QueueingTime." + event_name + default_action_status,
469 case WebInputEvent::TouchStart: 504 rwh_component, main_component);
470 UMA_HISTOGRAM_TIMES(
471 "Event.Latency.QueueingTime.TouchStartDefaultPrevented",
472 queueing_delta);
473 break;
474 case WebInputEvent::TouchMove:
475 UMA_HISTOGRAM_TIMES(
476 "Event.Latency.QueueingTime.TouchMoveDefaultPrevented",
477 queueing_delta);
478 break;
479 case WebInputEvent::TouchEnd:
480 UMA_HISTOGRAM_TIMES(
481 "Event.Latency.QueueingTime.TouchEndDefaultPrevented",
482 queueing_delta);
483 break;
484 default:
485 break;
486 }
487 } else {
488 switch (type) {
489 case WebInputEvent::TouchStart:
490 UMA_HISTOGRAM_TIMES(
491 "Event.Latency.QueueingTime.TouchStartDefaultAllowed",
492 queueing_delta);
493 break;
494 case WebInputEvent::TouchMove:
495 UMA_HISTOGRAM_TIMES(
496 "Event.Latency.QueueingTime.TouchMoveDefaultAllowed",
497 queueing_delta);
498 break;
499 case WebInputEvent::TouchEnd:
500 UMA_HISTOGRAM_TIMES(
501 "Event.Latency.QueueingTime.TouchEndDefaultAllowed",
502 queueing_delta);
503 break;
504 default:
505 break;
506 }
507 }
508 } 505 }
509 } 506 }
510 507
511 LatencyInfo::LatencyComponent acked_component; 508 LatencyInfo::LatencyComponent acked_component;
512 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 509 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0,
513 &acked_component)) { 510 &acked_component)) {
514 DCHECK_EQ(acked_component.event_count, 1u); 511 DCHECK_EQ(acked_component.event_count, 1u);
515 base::TimeDelta acked_delta = 512 if (!multi_finger_gesture_ &&
516 acked_component.event_time - rwh_component.event_time; 513 main_component.event_time != base::TimeTicks()) {
517 if (type == blink::WebInputEvent::MouseWheel) { 514 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
518 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelAcked", 515 "Event.Latency.BlockingTime." + event_name + default_action_status,
519 acked_delta.InMicroseconds(), 1, 1000000, 516 main_component, acked_component);
520 100);
521 } else {
522 DCHECK(WebInputEvent::isTouchEventType(type));
523 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchAcked",
524 acked_delta.InMicroseconds(), 1, 1000000,
525 100);
526 } 517 }
527 518
528 if (!multi_finger_gesture_ && 519 std::string input_modality = WebInputEventTypeToInputModalityString(type);
529 main_component.event_time != base::TimeTicks()) { 520 if (input_modality != "") {
530 base::TimeDelta blocking_delta; 521 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(
531 blocking_delta = acked_component.event_time - main_component.event_time; 522 "Event.Latency.Browser." + input_modality + "Acked", rwh_component,
532 523 acked_component);
533 if (action_prevented) {
534 switch (type) {
535 case WebInputEvent::TouchStart:
536 UMA_HISTOGRAM_TIMES(
537 "Event.Latency.BlockingTime.TouchStartDefaultPrevented",
538 blocking_delta);
539 break;
540 case WebInputEvent::TouchMove:
541 UMA_HISTOGRAM_TIMES(
542 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented",
543 blocking_delta);
544 break;
545 case WebInputEvent::TouchEnd:
546 UMA_HISTOGRAM_TIMES(
547 "Event.Latency.BlockingTime.TouchEndDefaultPrevented",
548 blocking_delta);
549 break;
550 default:
551 break;
552 }
553 } else {
554 switch (type) {
555 case WebInputEvent::TouchStart:
556 UMA_HISTOGRAM_TIMES(
557 "Event.Latency.BlockingTime.TouchStartDefaultAllowed",
558 blocking_delta);
559 break;
560 case WebInputEvent::TouchMove:
561 UMA_HISTOGRAM_TIMES(
562 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed",
563 blocking_delta);
564 break;
565 case WebInputEvent::TouchEnd:
566 UMA_HISTOGRAM_TIMES(
567 "Event.Latency.BlockingTime.TouchEndDefaultAllowed",
568 blocking_delta);
569 break;
570 default:
571 break;
572 }
573 }
574 } 524 }
575 } 525 }
576 } 526 }
577 527
578 void RenderWidgetHostLatencyTracker::OnInputEvent( 528 void RenderWidgetHostLatencyTracker::OnInputEvent(
579 const blink::WebInputEvent& event, 529 const blink::WebInputEvent& event,
580 LatencyInfo* latency) { 530 LatencyInfo* latency) {
581 DCHECK(latency); 531 DCHECK(latency);
582 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 532 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
583 latency_component_id_, NULL)) { 533 latency_component_id_, NULL)) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 582
633 has_seen_first_gesture_scroll_update_ = true; 583 has_seen_first_gesture_scroll_update_ = true;
634 } 584 }
635 } 585 }
636 586
637 void RenderWidgetHostLatencyTracker::OnInputEventAck( 587 void RenderWidgetHostLatencyTracker::OnInputEventAck(
638 const blink::WebInputEvent& event, 588 const blink::WebInputEvent& event,
639 LatencyInfo* latency, InputEventAckState ack_result) { 589 LatencyInfo* latency, InputEventAckState ack_result) {
640 DCHECK(latency); 590 DCHECK(latency);
641 591
642 // Latency ends when it is acked but does not cause render scheduling. 592 // Latency ends if an event is acked but does not cause render scheduling.
643 bool rendering_scheduled = latency->FindLatency( 593 bool rendering_scheduled = latency->FindLatency(
644 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr); 594 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr);
645 rendering_scheduled |= latency->FindLatency( 595 rendering_scheduled |= latency->FindLatency(
646 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr); 596 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr);
647 597
648 if (WebInputEvent::isGestureEventType(event.type())) {
649 if (!rendering_scheduled) {
650 latency->AddLatencyNumber(
651 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0);
652 // TODO(jdduke): Consider exposing histograms for gesture event types.
653 }
654 return;
655 }
656
657 if (WebInputEvent::isTouchEventType(event.type())) { 598 if (WebInputEvent::isTouchEventType(event.type())) {
658 const WebTouchEvent& touch_event = 599 const WebTouchEvent& touch_event =
659 *static_cast<const WebTouchEvent*>(&event); 600 *static_cast<const WebTouchEvent*>(&event);
660 if (event.type() == WebInputEvent::TouchStart) { 601 if (event.type() == WebInputEvent::TouchStart) {
661 DCHECK(touch_event.touchesLength >= 1); 602 DCHECK(touch_event.touchesLength >= 1);
662 multi_finger_gesture_ = touch_event.touchesLength != 1; 603 multi_finger_gesture_ = touch_event.touchesLength != 1;
663 touch_start_default_prevented_ = 604 touch_start_default_prevented_ =
664 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; 605 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED;
665 } 606 }
666
667 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0);
668
669 if (!rendering_scheduled) {
670 latency->AddLatencyNumber(
671 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0);
672 }
673 ComputeInputLatencyHistograms(event.type(), latency_component_id_, *latency,
674 ack_result);
675 return;
676 } 607 }
677 608
678 if (event.type() == WebInputEvent::MouseWheel) { 609 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0);
679 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); 610 // If this event couldn't have caused a gesture event, and it didn't trigger
680 if (!rendering_scheduled) { 611 // rendering, we're done processing it.
681 latency->AddLatencyNumber( 612 if (!rendering_scheduled) {
682 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_WHEEL_COMPONENT, 0, 0); 613 latency->AddLatencyNumber(
683 } 614 ui::INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, 0, 0);
684 ComputeInputLatencyHistograms(event.type(), latency_component_id_, *latency,
685 ack_result);
686 return;
687 } 615 }
688 616
689 if (WebInputEvent::isMouseEventType(event.type()) && !rendering_scheduled) { 617 ComputeInputLatencyHistograms(event.type(), latency_component_id_, *latency,
690 latency->AddLatencyNumber( 618 ack_result);
691 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0);
692 return;
693 }
694
695 if (WebInputEvent::isKeyboardEventType(event.type()) &&
696 !rendering_scheduled) {
697 latency->AddLatencyNumber(
698 ui::INPUT_EVENT_LATENCY_TERMINATED_KEYBOARD_COMPONENT, 0, 0);
699 return;
700 }
701 } 619 }
702 620
703 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame( 621 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame(
704 std::vector<LatencyInfo>* latencies) { 622 std::vector<LatencyInfo>* latencies) {
705 DCHECK(latencies); 623 DCHECK(latencies);
706 for (LatencyInfo& latency : *latencies) { 624 for (LatencyInfo& latency : *latencies) {
707 AddLatencyInfoComponentIds(&latency, latency_component_id_); 625 AddLatencyInfoComponentIds(&latency, latency_component_id_);
708 latency.AddLatencyNumber( 626 latency.AddLatencyNumber(
709 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); 627 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0);
710 } 628 }
711 } 629 }
712 630
713 void RenderWidgetHostLatencyTracker::OnFrameSwapped( 631 void RenderWidgetHostLatencyTracker::OnFrameSwapped(
714 const LatencyInfo& latency, 632 const LatencyInfo& latency,
715 bool is_running_navigation_hint_task) { 633 bool is_running_navigation_hint_task) {
716
717 LatencyInfo::LatencyComponent gpu_swap_end_component; 634 LatencyInfo::LatencyComponent gpu_swap_end_component;
718 if (!latency.FindLatency( 635 if (!latency.FindLatency(
719 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 636 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0,
720 &gpu_swap_end_component)) { 637 &gpu_swap_end_component)) {
721 return; 638 return;
722 } 639 }
723 640
724 LatencyInfo::LatencyComponent gpu_swap_begin_component; 641 LatencyInfo::LatencyComponent gpu_swap_begin_component;
725 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 642 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0,
726 &gpu_swap_begin_component)) { 643 &gpu_swap_begin_component)) {
(...skipping 13 matching lines...) Expand all
740 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 657 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
741 latency_component_id_, nullptr)) { 658 latency_component_id_, nullptr)) {
742 return; 659 return;
743 } 660 }
744 661
745 ui::SourceEventType source_event_type = latency.source_event_type(); 662 ui::SourceEventType source_event_type = latency.source_event_type();
746 if (source_event_type == ui::SourceEventType::WHEEL || 663 if (source_event_type == ui::SourceEventType::WHEEL ||
747 source_event_type == ui::SourceEventType::TOUCH) { 664 source_event_type == ui::SourceEventType::TOUCH) {
748 ComputeTouchAndWheelScrollLatencyHistograms( 665 ComputeTouchAndWheelScrollLatencyHistograms(
749 render_widget_host_delegate_, gpu_swap_begin_component, 666 render_widget_host_delegate_, gpu_swap_begin_component,
750 gpu_swap_end_component, latency_component_id_, latency, 667 gpu_swap_end_component, latency_component_id_, latency);
751 source_event_type == ui::SourceEventType::WHEEL ? "Wheel" : "Touch");
752 } 668 }
753 669
754 // Compute the old scroll update latency metrics. They are exclusively 670 // Compute the old scroll update latency metrics. They are exclusively
755 // calculated for touch scrolls, and will be deprecated on M56. 671 // calculated for touch scrolls, and will be deprecated on M56.
756 // (https://crbug.com/649754) 672 // (https://crbug.com/649754)
757 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component; 673 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component;
758 if (!latency.FindLatency( 674 if (!latency.FindLatency(
759 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, 675 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0,
760 &mouse_wheel_scroll_update_component)) { 676 &mouse_wheel_scroll_update_component)) {
761 ComputeScrollLatencyHistograms( 677 ComputeScrollLatencyHistograms(
762 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, 678 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_,
763 latency, is_running_navigation_hint_task); 679 latency, is_running_navigation_hint_task);
764 } 680 }
765 } 681 }
766 682
767 void RenderWidgetHostLatencyTracker::SetDelegate( 683 void RenderWidgetHostLatencyTracker::SetDelegate(
768 RenderWidgetHostDelegate* delegate) { 684 RenderWidgetHostDelegate* delegate) {
769 render_widget_host_delegate_ = delegate; 685 render_widget_host_delegate_ = delegate;
770 } 686 }
771 687
772 } // namespace content 688 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698