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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 default: | 110 default: |
| 111 // Must include default to let blink::WebInputEvent add new event types | 111 // Must include default to let blink::WebInputEvent add new event types |
| 112 // before they're added here. | 112 // before they're added here. |
| 113 DLOG(WARNING) << "Unhandled WebInputEvent type: " << event_type; | 113 DLOG(WARNING) << "Unhandled WebInputEvent type: " << event_type; |
| 114 break; | 114 break; |
| 115 } | 115 } |
| 116 | 116 |
| 117 #undef CASE_TYPE | 117 #undef CASE_TYPE |
| 118 } | 118 } |
| 119 | 119 |
| 120 void LogPassiveLatency(int64_t latency) { | |
| 121 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", latency, 1, | |
| 122 10000000, 100); | |
| 123 } | |
| 124 | |
| 125 void LogPassiveEventListenersUma(WebInputEventResult result, | 120 void LogPassiveEventListenersUma(WebInputEventResult result, |
| 126 WebInputEvent::DispatchType dispatch_type, | 121 WebInputEvent::DispatchType dispatch_type, |
| 127 double event_timestamp, | 122 double event_timestamp, |
| 128 const ui::LatencyInfo& latency_info) { | 123 const ui::LatencyInfo& latency_info) { |
| 129 enum { | 124 enum { |
| 130 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, | 125 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, |
| 131 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, | 126 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, |
| 132 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, | 127 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, |
| 133 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, | 128 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, |
| 134 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, | 129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 156 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; | 151 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; |
| 157 break; | 152 break; |
| 158 default: | 153 default: |
| 159 NOTREACHED(); | 154 NOTREACHED(); |
| 160 return; | 155 return; |
| 161 } | 156 } |
| 162 | 157 |
| 163 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, | 158 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, |
| 164 PASSIVE_LISTENER_UMA_ENUM_COUNT); | 159 PASSIVE_LISTENER_UMA_ENUM_COUNT); |
| 165 | 160 |
| 166 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE && | 161 if (base::TimeTicks::IsHighResolution()) { |
| 167 base::TimeTicks::IsHighResolution()) { | 162 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE) { |
| 168 base::TimeTicks now = base::TimeTicks::Now(); | 163 base::TimeTicks now = base::TimeTicks::Now(); |
|
tdresser
2016/04/21 20:54:52
Move computation of now outside of conditional.
dtapuska
2016/04/21 21:02:41
this is an if, else if.. since it avoids a costly
tdresser
2016/04/21 21:03:27
Sorry, I was thinking this was an "if/else" not "i
| |
| 169 LogPassiveLatency(GetEventLatencyMicros(event_timestamp, now)); | 164 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", |
| 165 GetEventLatencyMicros(event_timestamp, now), | |
| 166 1, 10000000, 100); | |
| 167 } else if (enum_value == PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING) { | |
| 168 base::TimeTicks now = base::TimeTicks::Now(); | |
| 169 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
| 170 "Event.PassiveListeners.ForcedNonBlockingLatency", | |
| 171 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); | |
| 172 } | |
| 170 } | 173 } |
| 171 } | 174 } |
| 172 | 175 |
| 173 } // namespace | 176 } // namespace |
| 174 | 177 |
| 175 RenderWidgetInputHandler::RenderWidgetInputHandler( | 178 RenderWidgetInputHandler::RenderWidgetInputHandler( |
| 176 RenderWidgetInputHandlerDelegate* delegate, | 179 RenderWidgetInputHandlerDelegate* delegate, |
| 177 RenderWidget* widget) | 180 RenderWidget* widget) |
| 178 : delegate_(delegate), | 181 : delegate_(delegate), |
| 179 widget_(widget), | 182 widget_(widget), |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 if (pending_input_event_ack_) { | 545 if (pending_input_event_ack_) { |
| 543 TRACE_EVENT_ASYNC_END0("input", | 546 TRACE_EVENT_ASYNC_END0("input", |
| 544 "RenderWidgetInputHandler::ThrottledInputEventAck", | 547 "RenderWidgetInputHandler::ThrottledInputEventAck", |
| 545 pending_input_event_ack_.get()); | 548 pending_input_event_ack_.get()); |
| 546 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); | 549 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); |
| 547 } | 550 } |
| 548 total_input_handling_time_this_frame_ = base::TimeDelta(); | 551 total_input_handling_time_this_frame_ = base::TimeDelta(); |
| 549 } | 552 } |
| 550 | 553 |
| 551 } // namespace content | 554 } // namespace content |
| OLD | NEW |