| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <linux/input.h> | 6 #include <linux/input.h> |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 9 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 path_(path), | 30 path_(path), |
| 31 input_device_(id, | 31 input_device_(id, |
| 32 type, | 32 type, |
| 33 name, | 33 name, |
| 34 GetInputPathInSys(path), | 34 GetInputPathInSys(path), |
| 35 vendor_id, | 35 vendor_id, |
| 36 product_id), | 36 product_id), |
| 37 controller_(FROM_HERE) {} | 37 controller_(FROM_HERE) {} |
| 38 | 38 |
| 39 EventConverterEvdev::~EventConverterEvdev() { | 39 EventConverterEvdev::~EventConverterEvdev() { |
| 40 DCHECK(!enabled_); | |
| 41 DCHECK(!watching_); | |
| 42 } | 40 } |
| 43 | 41 |
| 44 void EventConverterEvdev::Start() { | 42 void EventConverterEvdev::Start() { |
| 45 base::MessageLoopForUI::current()->WatchFileDescriptor( | 43 base::MessageLoopForUI::current()->WatchFileDescriptor( |
| 46 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 44 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
| 47 watching_ = true; | 45 watching_ = true; |
| 48 } | 46 } |
| 49 | 47 |
| 50 void EventConverterEvdev::Stop() { | 48 void EventConverterEvdev::Stop() { |
| 51 controller_.StopWatchingFileDescriptor(); | 49 controller_.StopWatchingFileDescriptor(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 155 |
| 158 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( | 156 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( |
| 159 const input_event& event) { | 157 const input_event& event) { |
| 160 base::TimeTicks timestamp = | 158 base::TimeTicks timestamp = |
| 161 ui::EventTimeStampFromSeconds(event.time.tv_sec) + | 159 ui::EventTimeStampFromSeconds(event.time.tv_sec) + |
| 162 base::TimeDelta::FromMicroseconds(event.time.tv_usec); | 160 base::TimeDelta::FromMicroseconds(event.time.tv_usec); |
| 163 ValidateEventTimeClock(×tamp); | 161 ValidateEventTimeClock(×tamp); |
| 164 return timestamp; | 162 return timestamp; |
| 165 } | 163 } |
| 166 } // namespace ui | 164 } // namespace ui |
| OLD | NEW |