| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/events/event_utils.h" | 5 #include "ui/events/event_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "ui/display/display.h" | 10 #include "ui/display/display.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return display::Display::TOUCH_SUPPORT_UNAVAILABLE; | 103 return display::Display::TOUCH_SUPPORT_UNAVAILABLE; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ComputeEventLatencyOS(const base::NativeEvent& native_event) { | 106 void ComputeEventLatencyOS(const base::NativeEvent& native_event) { |
| 107 base::TimeTicks current_time = EventTimeForNow(); | 107 base::TimeTicks current_time = EventTimeForNow(); |
| 108 base::TimeTicks time_stamp = EventTimeFromNative(native_event); | 108 base::TimeTicks time_stamp = EventTimeFromNative(native_event); |
| 109 base::TimeDelta delta = current_time - time_stamp; | 109 base::TimeDelta delta = current_time - time_stamp; |
| 110 | 110 |
| 111 EventType type = EventTypeFromNative(native_event); | 111 EventType type = EventTypeFromNative(native_event); |
| 112 switch (type) { | 112 switch (type) { |
| 113 #if defined(OS_MACOSX) |
| 114 // ui::MouseWheelEvent is too basic to represent a NSScrollWheel event, so |
| 115 // it is wrapped in a ui::ScrollEvent, but recorded the same in UMA. |
| 116 case ET_SCROLL: |
| 117 #endif |
| 113 case ET_MOUSEWHEEL: | 118 case ET_MOUSEWHEEL: |
| 114 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", | 119 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", |
| 115 delta.InMicroseconds(), 1, 1000000, 50); | 120 delta.InMicroseconds(), 1, 1000000, 50); |
| 116 return; | 121 return; |
| 117 case ET_TOUCH_MOVED: | 122 case ET_TOUCH_MOVED: |
| 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", | 123 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", |
| 119 delta.InMicroseconds(), 1, 1000000, 50); | 124 delta.InMicroseconds(), 1, 1000000, 50); |
| 120 return; | 125 return; |
| 121 case ET_TOUCH_PRESSED: | 126 case ET_TOUCH_PRESSED: |
| 122 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", | 127 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", |
| 123 delta.InMicroseconds(), 1, 1000000, 50); | 128 delta.InMicroseconds(), 1, 1000000, 50); |
| 124 return; | 129 return; |
| 125 case ET_TOUCH_RELEASED: | 130 case ET_TOUCH_RELEASED: |
| 126 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 131 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 127 delta.InMicroseconds(), 1, 1000000, 50); | 132 delta.InMicroseconds(), 1, 1000000, 50); |
| 128 return; | 133 return; |
| 129 default: | 134 default: |
| 130 return; | 135 return; |
| 131 } | 136 } |
| 132 } | 137 } |
| 133 | 138 |
| 134 } // namespace ui | 139 } // namespace ui |
| OLD | NEW |