Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: ui/events/ozone/evdev/event_converter_evdev.cc

Issue 2657533008: Merge "Fix double-close in EventConverterEvdevImpl" (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_converter_evdev_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 uint16_t vendor_id, 27 uint16_t vendor_id,
28 uint16_t product_id) 28 uint16_t product_id)
29 : fd_(fd), 29 : fd_(fd),
30 path_(path), 30 path_(path),
31 input_device_(id, type, name, GetInputPathInSys(path), vendor_id, 31 input_device_(id, type, name, GetInputPathInSys(path), vendor_id,
32 product_id) {} 32 product_id) {}
33 33
34 EventConverterEvdev::~EventConverterEvdev() { 34 EventConverterEvdev::~EventConverterEvdev() {
35 DCHECK(!enabled_); 35 DCHECK(!enabled_);
36 DCHECK(!watching_); 36 DCHECK(!watching_);
37 if (fd_ >= 0)
38 close(fd_);
39 } 37 }
40 38
41 void EventConverterEvdev::Start() { 39 void EventConverterEvdev::Start() {
42 base::MessageLoopForUI::current()->WatchFileDescriptor( 40 base::MessageLoopForUI::current()->WatchFileDescriptor(
43 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); 41 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this);
44 watching_ = true; 42 watching_ = true;
45 } 43 }
46 44
47 void EventConverterEvdev::Stop() { 45 void EventConverterEvdev::Stop() {
48 controller_.StopWatchingFileDescriptor(); 46 controller_.StopWatchingFileDescriptor();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 152
155 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( 153 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent(
156 const input_event& event) { 154 const input_event& event) {
157 base::TimeTicks timestamp = 155 base::TimeTicks timestamp =
158 ui::EventTimeStampFromSeconds(event.time.tv_sec) + 156 ui::EventTimeStampFromSeconds(event.time.tv_sec) +
159 base::TimeDelta::FromMicroseconds(event.time.tv_usec); 157 base::TimeDelta::FromMicroseconds(event.time.tv_usec);
160 ValidateEventTimeClock(&timestamp); 158 ValidateEventTimeClock(&timestamp);
161 return timestamp; 159 return timestamp;
162 } 160 }
163 } // namespace ui 161 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_converter_evdev_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698