Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/input/render_widget_input_handler.h" | 5 #include "content/renderer/input/render_widget_input_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 void LogPassiveEventListenersUma(WebInputEventResult result, | 120 void LogPassiveEventListenersUma(WebInputEventResult result, |
| 121 WebInputEvent::DispatchType dispatch_type, | 121 WebInputEvent::DispatchType dispatch_type, |
| 122 double event_timestamp, | 122 double event_timestamp, |
| 123 const ui::LatencyInfo& latency_info) { | 123 const ui::LatencyInfo& latency_info) { |
| 124 enum { | 124 enum { |
| 125 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, | 125 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, |
| 126 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, | 126 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, |
| 127 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, | 127 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, |
| 128 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, | 128 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, |
| 129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, | 129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, |
| 130 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING, | 130 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, |
| 131 PASSIVE_LISTENER_UMA_ENUM_COUNT | 131 PASSIVE_LISTENER_UMA_ENUM_COUNT |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 int enum_value; | 134 int enum_value; |
| 135 switch (dispatch_type) { | 135 switch (dispatch_type) { |
| 136 case WebInputEvent::ListenersForcedNonBlockingPassive: | 136 case WebInputEvent::ListenersForcedNonBlockingPassiveDueToFling: |
| 137 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING; | 137 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING; |
| 138 break; | 138 break; |
| 139 case WebInputEvent::ListenersNonBlockingPassive: | 139 case WebInputEvent::ListenersNonBlockingPassive: |
| 140 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; | 140 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; |
| 141 break; | 141 break; |
| 142 case WebInputEvent::EventNonBlocking: | 142 case WebInputEvent::EventNonBlocking: |
| 143 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; | 143 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; |
| 144 break; | 144 break; |
| 145 case WebInputEvent::Blocking: | 145 case WebInputEvent::Blocking: |
| 146 if (result == WebInputEventResult::HandledApplication) | 146 if (result == WebInputEventResult::HandledApplication) |
| 147 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; | 147 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; |
| 148 else if (result == WebInputEventResult::HandledSuppressed) | 148 else if (result == WebInputEventResult::HandledSuppressed) |
| 149 enum_value = PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED; | 149 enum_value = PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED; |
| 150 else | 150 else |
| 151 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; | 151 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; |
| 152 break; | 152 break; |
| 153 default: | 153 default: |
| 154 NOTREACHED(); | 154 NOTREACHED(); |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 | 157 |
| 158 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, | 158 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, |
| 159 PASSIVE_LISTENER_UMA_ENUM_COUNT); | 159 PASSIVE_LISTENER_UMA_ENUM_COUNT); |
| 160 | 160 |
| 161 if (base::TimeTicks::IsHighResolution()) { | 161 if (base::TimeTicks::IsHighResolution()) { |
| 162 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE) { | 162 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE) { |
| 163 base::TimeTicks now = base::TimeTicks::Now(); | 163 base::TimeTicks now = base::TimeTicks::Now(); |
| 164 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", | 164 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", |
| 165 GetEventLatencyMicros(event_timestamp, now), | 165 GetEventLatencyMicros(event_timestamp, now), |
| 166 1, 10000000, 100); | 166 1, 10000000, 100); |
| 167 } else if (enum_value == PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING) { | 167 } else if (enum_value == |
| 168 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) { | |
| 168 base::TimeTicks now = base::TimeTicks::Now(); | 169 base::TimeTicks now = base::TimeTicks::Now(); |
| 169 UMA_HISTOGRAM_CUSTOM_COUNTS( | 170 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 170 "Event.PassiveListeners.ForcedNonBlockingLatency", | 171 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling", |
| 171 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); | 172 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace | 177 } // namespace |
| 177 | 178 |
| 178 RenderWidgetInputHandler::RenderWidgetInputHandler( | 179 RenderWidgetInputHandler::RenderWidgetInputHandler( |
| 179 RenderWidgetInputHandlerDelegate* delegate, | 180 RenderWidgetInputHandlerDelegate* delegate, |
| 180 RenderWidget* widget) | 181 RenderWidget* widget) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 // ideally this should be when the event was sent by the compositor to the | 328 // ideally this should be when the event was sent by the compositor to the |
| 328 // renderer. crbug.com/565348 | 329 // renderer. crbug.com/565348 |
| 329 if (input_event.type == WebInputEvent::TouchStart || | 330 if (input_event.type == WebInputEvent::TouchStart || |
| 330 input_event.type == WebInputEvent::TouchMove || | 331 input_event.type == WebInputEvent::TouchMove || |
| 331 input_event.type == WebInputEvent::TouchEnd) { | 332 input_event.type == WebInputEvent::TouchEnd) { |
| 332 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); | 333 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); |
| 333 | 334 |
| 334 LogPassiveEventListenersUma(processed, touch.dispatchType, | 335 LogPassiveEventListenersUma(processed, touch.dispatchType, |
| 335 input_event.timeStampSeconds, latency_info); | 336 input_event.timeStampSeconds, latency_info); |
| 336 | 337 |
| 337 if (input_event.type == WebInputEvent::TouchStart && | 338 // TODO(lanwei): May remove it when we no longer need any metric for event |
|
tdresser
2016/08/17 14:32:28
Make it clear what "it" is here.
Make this a bit m
lanwei
2016/08/18 12:31:47
Done.
| |
| 338 touch.dispatchType == WebInputEvent::Blocking && | 339 // latency outside fling. |
| 340 if (touch.dispatchType == WebInputEvent::Blocking && | |
| 341 touch.touchStartOrFirstTouchMove && | |
| 339 base::TimeTicks::IsHighResolution()) { | 342 base::TimeTicks::IsHighResolution()) { |
| 340 base::TimeTicks now = base::TimeTicks::Now(); | 343 base::TimeTicks now = base::TimeTicks::Now(); |
| 341 if (touch.dispatchedDuringFling) { | 344 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 342 UMA_HISTOGRAM_CUSTOM_COUNTS( | 345 "Event.Touch.TouchLatencyOutsideFling", |
| 343 "Event.Touch.TouchStartLatencyDuringFling", | 346 GetEventLatencyMicros(input_event.timeStampSeconds, now), 1, |
| 344 GetEventLatencyMicros(input_event.timeStampSeconds, now), 1, | 347 100000000, 50); |
| 345 100000000, 50); | |
| 346 } else { | |
| 347 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
| 348 "Event.Touch.TouchStartLatencyOutsideFling", | |
| 349 GetEventLatencyMicros(input_event.timeStampSeconds, now), 1, | |
| 350 100000000, 50); | |
| 351 } | |
| 352 } | 348 } |
| 353 } else if (input_event.type == WebInputEvent::MouseWheel) { | 349 } else if (input_event.type == WebInputEvent::MouseWheel) { |
| 354 LogPassiveEventListenersUma( | 350 LogPassiveEventListenersUma( |
| 355 processed, | 351 processed, |
| 356 static_cast<const WebMouseWheelEvent&>(input_event).dispatchType, | 352 static_cast<const WebMouseWheelEvent&>(input_event).dispatchType, |
| 357 input_event.timeStampSeconds, latency_info); | 353 input_event.timeStampSeconds, latency_info); |
| 358 } | 354 } |
| 359 | 355 |
| 360 // If this RawKeyDown event corresponds to a browser keyboard shortcut and | 356 // If this RawKeyDown event corresponds to a browser keyboard shortcut and |
| 361 // it's not processed by webkit, then we need to suppress the upcoming Char | 357 // it's not processed by webkit, then we need to suppress the upcoming Char |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 if (pending_input_event_ack_) { | 550 if (pending_input_event_ack_) { |
| 555 TRACE_EVENT_ASYNC_END0("input", | 551 TRACE_EVENT_ASYNC_END0("input", |
| 556 "RenderWidgetInputHandler::ThrottledInputEventAck", | 552 "RenderWidgetInputHandler::ThrottledInputEventAck", |
| 557 pending_input_event_ack_.get()); | 553 pending_input_event_ack_.get()); |
| 558 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); | 554 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); |
| 559 } | 555 } |
| 560 total_input_handling_time_this_frame_ = base::TimeDelta(); | 556 total_input_handling_time_this_frame_ = base::TimeDelta(); |
| 561 } | 557 } |
| 562 | 558 |
| 563 } // namespace content | 559 } // namespace content |
| OLD | NEW |