| OLD | NEW |
| 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.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", | 263 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", |
| 264 ui_delta.InMicroseconds(), 1, 20000, 100); | 264 ui_delta.InMicroseconds(), 1, 20000, 100); |
| 265 | 265 |
| 266 } else { | 266 } else { |
| 267 DCHECK(WebInputEvent::isTouchEventType(type)); | 267 DCHECK(WebInputEvent::isTouchEventType(type)); |
| 268 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", | 268 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", |
| 269 ui_delta.InMicroseconds(), 1, 20000, 100); | 269 ui_delta.InMicroseconds(), 1, 20000, 100); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 // Both tap and scroll gestures depend on the disposition of the touch start |
| 274 // and the current touch. For touch start, touch_start_default_prevented_ == |
| 275 // (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED). |
| 276 bool action_prevented = touch_start_default_prevented_ || |
| 277 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
| 278 |
| 273 LatencyInfo::LatencyComponent main_component; | 279 LatencyInfo::LatencyComponent main_component; |
| 274 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, | 280 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, |
| 275 &main_component)) { | 281 &main_component)) { |
| 276 DCHECK_EQ(main_component.event_count, 1u); | 282 DCHECK_EQ(main_component.event_count, 1u); |
| 277 base::TimeDelta queueing_delta = | 283 base::TimeDelta queueing_delta = |
| 278 main_component.event_time - rwh_component.event_time; | 284 main_component.event_time - rwh_component.event_time; |
| 279 if (type == WebInputEvent::TouchMove && !multi_finger_gesture_) { | 285 |
| 280 if (touch_start_default_prevented_ || | 286 if (!multi_finger_gesture_) { |
| 281 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { | 287 if (action_prevented) { |
| 282 UMA_HISTOGRAM_TIMES( | 288 switch (type) { |
| 283 "Event.Latency.QueueingTime.TouchMoveDefaultPrevented", | 289 case WebInputEvent::TouchStart: |
| 284 queueing_delta); | 290 UMA_HISTOGRAM_TIMES( |
| 285 } else if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { | 291 "Event.Latency.QueueingTime.TouchStartDefaultPrevented", |
| 286 UMA_HISTOGRAM_TIMES( | 292 queueing_delta); |
| 287 "Event.Latency.QueueingTime.TouchMoveDefaultAllowed", | 293 break; |
| 288 queueing_delta); | 294 case WebInputEvent::TouchMove: |
| 295 UMA_HISTOGRAM_TIMES( |
| 296 "Event.Latency.QueueingTime.TouchMoveDefaultPrevented", |
| 297 queueing_delta); |
| 298 break; |
| 299 case WebInputEvent::TouchEnd: |
| 300 UMA_HISTOGRAM_TIMES( |
| 301 "Event.Latency.QueueingTime.TouchEndDefaultPrevented", |
| 302 queueing_delta); |
| 303 break; |
| 304 default: |
| 305 break; |
| 306 } |
| 307 } else { |
| 308 switch (type) { |
| 309 case WebInputEvent::TouchStart: |
| 310 UMA_HISTOGRAM_TIMES( |
| 311 "Event.Latency.QueueingTime.TouchStartDefaultAllowed", |
| 312 queueing_delta); |
| 313 break; |
| 314 case WebInputEvent::TouchMove: |
| 315 UMA_HISTOGRAM_TIMES( |
| 316 "Event.Latency.QueueingTime.TouchMoveDefaultAllowed", |
| 317 queueing_delta); |
| 318 break; |
| 319 case WebInputEvent::TouchEnd: |
| 320 UMA_HISTOGRAM_TIMES( |
| 321 "Event.Latency.QueueingTime.TouchEndDefaultAllowed", |
| 322 queueing_delta); |
| 323 break; |
| 324 default: |
| 325 break; |
| 326 } |
| 289 } | 327 } |
| 290 } | 328 } |
| 291 } | 329 } |
| 292 | 330 |
| 293 LatencyInfo::LatencyComponent acked_component; | 331 LatencyInfo::LatencyComponent acked_component; |
| 294 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, | 332 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, |
| 295 &acked_component)) { | 333 &acked_component)) { |
| 296 DCHECK_EQ(acked_component.event_count, 1u); | 334 DCHECK_EQ(acked_component.event_count, 1u); |
| 297 base::TimeDelta acked_delta = | 335 base::TimeDelta acked_delta = |
| 298 acked_component.event_time - rwh_component.event_time; | 336 acked_component.event_time - rwh_component.event_time; |
| 299 if (type == blink::WebInputEvent::MouseWheel) { | 337 if (type == blink::WebInputEvent::MouseWheel) { |
| 300 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelAcked", | 338 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelAcked", |
| 301 acked_delta.InMicroseconds(), 1, 1000000, | 339 acked_delta.InMicroseconds(), 1, 1000000, |
| 302 100); | 340 100); |
| 303 } else { | 341 } else { |
| 304 DCHECK(WebInputEvent::isTouchEventType(type)); | 342 DCHECK(WebInputEvent::isTouchEventType(type)); |
| 305 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchAcked", | 343 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchAcked", |
| 306 acked_delta.InMicroseconds(), 1, 1000000, | 344 acked_delta.InMicroseconds(), 1, 1000000, |
| 307 100); | 345 100); |
| 308 } | 346 } |
| 309 | 347 |
| 310 if (type == WebInputEvent::TouchMove && !multi_finger_gesture_ && | 348 if (!multi_finger_gesture_ && |
| 311 main_component.event_time != base::TimeTicks()) { | 349 main_component.event_time != base::TimeTicks()) { |
| 312 base::TimeDelta blocking_delta; | 350 base::TimeDelta blocking_delta; |
| 313 blocking_delta = acked_component.event_time - main_component.event_time; | 351 blocking_delta = acked_component.event_time - main_component.event_time; |
| 314 | 352 |
| 315 if (touch_start_default_prevented_ || | 353 if (action_prevented) { |
| 316 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { | 354 switch (type) { |
| 317 UMA_HISTOGRAM_TIMES( | 355 case WebInputEvent::TouchStart: |
| 318 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented", | 356 UMA_HISTOGRAM_TIMES( |
| 319 blocking_delta); | 357 "Event.Latency.BlockingTime.TouchStartDefaultPrevented", |
| 320 } else if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { | 358 blocking_delta); |
| 321 UMA_HISTOGRAM_TIMES( | 359 break; |
| 322 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed", | 360 case WebInputEvent::TouchMove: |
| 323 blocking_delta); | 361 UMA_HISTOGRAM_TIMES( |
| 362 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented", |
| 363 blocking_delta); |
| 364 break; |
| 365 case WebInputEvent::TouchEnd: |
| 366 UMA_HISTOGRAM_TIMES( |
| 367 "Event.Latency.BlockingTime.TouchEndDefaultPrevented", |
| 368 blocking_delta); |
| 369 break; |
| 370 default: |
| 371 break; |
| 372 } |
| 373 } else { |
| 374 switch (type) { |
| 375 case WebInputEvent::TouchStart: |
| 376 UMA_HISTOGRAM_TIMES( |
| 377 "Event.Latency.BlockingTime.TouchStartDefaultAllowed", |
| 378 blocking_delta); |
| 379 break; |
| 380 case WebInputEvent::TouchMove: |
| 381 UMA_HISTOGRAM_TIMES( |
| 382 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed", |
| 383 blocking_delta); |
| 384 break; |
| 385 case WebInputEvent::TouchEnd: |
| 386 UMA_HISTOGRAM_TIMES( |
| 387 "Event.Latency.BlockingTime.TouchEndDefaultAllowed", |
| 388 blocking_delta); |
| 389 break; |
| 390 default: |
| 391 break; |
| 392 } |
| 324 } | 393 } |
| 325 } | 394 } |
| 326 } | 395 } |
| 327 } | 396 } |
| 328 | 397 |
| 329 void RenderWidgetHostLatencyTracker::OnInputEvent( | 398 void RenderWidgetHostLatencyTracker::OnInputEvent( |
| 330 const blink::WebInputEvent& event, | 399 const blink::WebInputEvent& event, |
| 331 LatencyInfo* latency) { | 400 LatencyInfo* latency) { |
| 332 DCHECK(latency); | 401 DCHECK(latency); |
| 333 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 402 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 latency_component_id_, nullptr)) { | 568 latency_component_id_, nullptr)) { |
| 500 return; | 569 return; |
| 501 } | 570 } |
| 502 | 571 |
| 503 ComputeScrollLatencyHistograms(gpu_swap_begin_component, | 572 ComputeScrollLatencyHistograms(gpu_swap_begin_component, |
| 504 gpu_swap_end_component, latency_component_id_, | 573 gpu_swap_end_component, latency_component_id_, |
| 505 latency); | 574 latency); |
| 506 } | 575 } |
| 507 | 576 |
| 508 } // namespace content | 577 } // namespace content |
| OLD | NEW |