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/base/events/event.h" | 5 #include "ui/base/events/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 phase_(EP_PREDISPATCH), | 177 phase_(EP_PREDISPATCH), |
178 result_(ER_UNHANDLED) { | 178 result_(ER_UNHANDLED) { |
179 base::TimeDelta delta = ui::EventTimeForNow() - time_stamp_; | 179 base::TimeDelta delta = ui::EventTimeForNow() - time_stamp_; |
180 if (type_ < ET_LAST) | 180 if (type_ < ET_LAST) |
181 name_ = EventTypeName(type_); | 181 name_ = EventTypeName(type_); |
182 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser", | 182 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser", |
183 delta.InMicroseconds(), 0, 1000000, 100); | 183 delta.InMicroseconds(), 0, 1000000, 100); |
184 std::string name_for_event = | 184 std::string name_for_event = |
185 base::StringPrintf("Event.Latency.Browser.%s", name_.c_str()); | 185 base::StringPrintf("Event.Latency.Browser.%s", name_.c_str()); |
186 base::HistogramBase* counter_for_type = | 186 base::HistogramBase* counter_for_type = |
187 base::Histogram::FactoryTimeGet( | 187 base::Histogram::FactoryGet( |
188 name_for_event, | 188 name_for_event, |
189 base::TimeDelta::FromMilliseconds(0), | 189 0, |
190 base::TimeDelta::FromMilliseconds(1000000), | 190 1000000, |
191 100, | 191 100, |
192 base::HistogramBase::kUmaTargetedHistogramFlag); | 192 base::HistogramBase::kUmaTargetedHistogramFlag); |
193 counter_for_type->AddTime(delta); | 193 counter_for_type->Add(delta.InMicroseconds()); |
194 InitWithNativeEvent(native_event); | 194 InitWithNativeEvent(native_event); |
195 } | 195 } |
196 | 196 |
197 Event::Event(const Event& copy) | 197 Event::Event(const Event& copy) |
198 : native_event_(::CopyNativeEvent(copy.native_event_)), | 198 : native_event_(::CopyNativeEvent(copy.native_event_)), |
199 type_(copy.type_), | 199 type_(copy.type_), |
200 time_stamp_(copy.time_stamp_), | 200 time_stamp_(copy.time_stamp_), |
201 flags_(copy.flags_), | 201 flags_(copy.flags_), |
202 dispatch_to_hidden_targets_(false), | 202 dispatch_to_hidden_targets_(false), |
203 delete_native_event_(false), | 203 delete_native_event_(false), |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 int GestureEvent::GetLowestTouchId() const { | 704 int GestureEvent::GetLowestTouchId() const { |
705 if (touch_ids_bitfield_ == 0) | 705 if (touch_ids_bitfield_ == 0) |
706 return -1; | 706 return -1; |
707 int i = -1; | 707 int i = -1; |
708 // Find the index of the least significant 1 bit | 708 // Find the index of the least significant 1 bit |
709 while (!(1 << ++i & touch_ids_bitfield_)); | 709 while (!(1 << ++i & touch_ids_bitfield_)); |
710 return i; | 710 return i; |
711 } | 711 } |
712 | 712 |
713 } // namespace ui | 713 } // namespace ui |
OLD | NEW |