OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 WebGestureEvent scroll_begin_event = event; | 111 WebGestureEvent scroll_begin_event = event; |
112 scroll_begin_event.type = WebInputEvent::GestureScrollBegin; | 112 scroll_begin_event.type = WebInputEvent::GestureScrollBegin; |
113 scroll_begin_event.data.scrollBegin.deltaXHint = 0; | 113 scroll_begin_event.data.scrollBegin.deltaXHint = 0; |
114 scroll_begin_event.data.scrollBegin.deltaYHint = 0; | 114 scroll_begin_event.data.scrollBegin.deltaYHint = 0; |
115 return scroll_begin_event; | 115 return scroll_begin_event; |
116 } | 116 } |
117 | 117 |
118 void SendScrollLatencyUma(const WebInputEvent& event, | 118 void SendScrollLatencyUma(const WebInputEvent& event, |
119 const ui::LatencyInfo& latency_info) { | 119 const ui::LatencyInfo& latency_info) { |
120 if (!(event.type == WebInputEvent::GestureScrollBegin || | 120 if (!(event.type == WebInputEvent::GestureScrollBegin || |
121 event.type == WebInputEvent::GestureScrollUpdate)) | 121 event.type == WebInputEvent::GestureScrollUpdate || |
| 122 event.type == WebInputEvent::GesturePinchBegin || |
| 123 event.type == WebInputEvent::GesturePinchUpdate || |
| 124 event.type == WebInputEvent::GestureFlingStart)) { |
122 return; | 125 return; |
| 126 } |
123 | 127 |
124 ui::LatencyInfo::LatencyMap::const_iterator it = | 128 ui::LatencyInfo::LatencyMap::const_iterator it = |
125 latency_info.latency_components.find(std::make_pair( | 129 latency_info.latency_components.find(std::make_pair( |
126 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0)); | 130 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0)); |
127 | 131 |
128 if (it == latency_info.latency_components.end()) | 132 if (it == latency_info.latency_components.end()) |
129 return; | 133 return; |
130 | 134 |
131 base::TimeDelta delta = base::TimeTicks::HighResNow() - it->second.event_time; | 135 base::TimeDelta delta = base::TimeTicks::HighResNow() - it->second.event_time; |
132 for (size_t i = 0; i < it->second.event_count; ++i) { | 136 for (size_t i = 0; i < it->second.event_count; ++i) { |
133 UMA_HISTOGRAM_CUSTOM_COUNTS( | 137 switch (event.type) { |
134 "Event.Latency.RendererImpl.GestureScroll2", | 138 case blink::WebInputEvent::GestureScrollBegin: |
135 delta.InMicroseconds(), | 139 UMA_HISTOGRAM_CUSTOM_COUNTS( |
136 1, | 140 "Event.Latency.RendererImpl.GestureScrollBegin", |
137 1000000, | 141 delta.InMicroseconds(), 1, 1000000, 100); |
138 100); | 142 break; |
| 143 case blink::WebInputEvent::GestureScrollUpdate: |
| 144 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 145 // So named for historical reasons. |
| 146 "Event.Latency.RendererImpl.GestureScroll2", |
| 147 delta.InMicroseconds(), 1, 1000000, 100); |
| 148 break; |
| 149 case blink::WebInputEvent::GesturePinchBegin: |
| 150 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 151 "Event.Latency.RendererImpl.GesturePinchBegin", |
| 152 delta.InMicroseconds(), 1, 1000000, 100); |
| 153 break; |
| 154 case blink::WebInputEvent::GesturePinchUpdate: |
| 155 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 156 "Event.Latency.RendererImpl.GesturePinchUpdate", |
| 157 delta.InMicroseconds(), 1, 1000000, 100); |
| 158 break; |
| 159 case blink::WebInputEvent::GestureFlingStart: |
| 160 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 161 "Event.Latency.RendererImpl.GestureFlingStart", |
| 162 delta.InMicroseconds(), 1, 1000000, 100); |
| 163 break; |
| 164 default: |
| 165 NOTREACHED(); |
| 166 break; |
| 167 } |
139 } | 168 } |
| 169 } |
| 170 |
140 } // namespace | 171 } // namespace |
141 | 172 |
142 } | |
143 | |
144 namespace content { | 173 namespace content { |
145 | 174 |
146 InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, | 175 InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, |
147 InputHandlerProxyClient* client) | 176 InputHandlerProxyClient* client) |
148 : client_(client), | 177 : client_(client), |
149 input_handler_(input_handler), | 178 input_handler_(input_handler), |
150 deferred_fling_cancel_time_seconds_(0), | 179 deferred_fling_cancel_time_seconds_(0), |
151 #ifndef NDEBUG | 180 #ifndef NDEBUG |
152 expect_scroll_update_end_(false), | 181 expect_scroll_update_end_(false), |
153 #endif | 182 #endif |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 915 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
887 // Return true in this case to prevent early fling termination. | 916 // Return true in this case to prevent early fling termination. |
888 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 917 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
889 std::abs(clipped_increment.height) < kScrollEpsilon) | 918 std::abs(clipped_increment.height) < kScrollEpsilon) |
890 return true; | 919 return true; |
891 | 920 |
892 return did_scroll; | 921 return did_scroll; |
893 } | 922 } |
894 | 923 |
895 } // namespace content | 924 } // namespace content |
OLD | NEW |