| 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_macros.h" | 9 #include "base/metrics/histogram_macros.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 // On Mac, ET_SCROLL and ET_MOUSEWHEEL represent the same class of events. |
| 115 case ET_SCROLL: |
| 116 #endif |
| 113 case ET_MOUSEWHEEL: | 117 case ET_MOUSEWHEEL: |
| 114 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", | 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", |
| 115 delta.InMicroseconds(), 1, 1000000, 50); | 119 delta.InMicroseconds(), 1, 1000000, 50); |
| 116 return; | 120 return; |
| 117 case ET_TOUCH_MOVED: | 121 case ET_TOUCH_MOVED: |
| 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", | 122 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", |
| 119 delta.InMicroseconds(), 1, 1000000, 50); | 123 delta.InMicroseconds(), 1, 1000000, 50); |
| 120 return; | 124 return; |
| 121 case ET_TOUCH_PRESSED: | 125 case ET_TOUCH_PRESSED: |
| 122 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", | 126 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", |
| 123 delta.InMicroseconds(), 1, 1000000, 50); | 127 delta.InMicroseconds(), 1, 1000000, 50); |
| 124 return; | 128 return; |
| 125 case ET_TOUCH_RELEASED: | 129 case ET_TOUCH_RELEASED: |
| 126 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 130 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 127 delta.InMicroseconds(), 1, 1000000, 50); | 131 delta.InMicroseconds(), 1, 1000000, 50); |
| 128 return; | 132 return; |
| 129 default: | 133 default: |
| 130 return; | 134 return; |
| 131 } | 135 } |
| 132 } | 136 } |
| 133 | 137 |
| 134 } // namespace ui | 138 } // namespace ui |
| OLD | NEW |