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

Unified Diff: ui/events/ozone/evdev/key_event_converter.cc

Issue 133233008: evdev: Move EventConverterOzone ownership from EventFactoryOzone to subclass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unbreak events_unittests Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/ozone/evdev/key_event_converter.h ('k') | ui/events/ozone/evdev/key_event_converter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/key_event_converter.cc
diff --git a/ui/events/ozone/evdev/key_event_converter.cc b/ui/events/ozone/evdev/key_event_converter.cc
index 30fd476d2719a1663c6eb845c03947262135725b..3c07898e3ee748e6188bfe9e1a0eb9d070548aa1 100644
--- a/ui/events/ozone/evdev/key_event_converter.cc
+++ b/ui/events/ozone/evdev/key_event_converter.cc
@@ -6,6 +6,7 @@
#include <linux/input.h>
+#include "base/message_loop/message_pump_ozone.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/ozone/evdev/event_modifiers.h"
@@ -189,11 +190,21 @@ KeyEventConverterEvdev::KeyEventConverterEvdev(int fd,
EventModifiersEvdev* modifiers)
: fd_(fd), path_(path), modifiers_(modifiers) {
// TODO(spang): Initialize modifiers using EVIOCGKEY.
+ Start();
}
KeyEventConverterEvdev::~KeyEventConverterEvdev() {
- if (fd_ >= 0 && close(fd_) < 0)
- DLOG(WARNING) << "failed close on " << path_.value();
+ Stop();
+ close(fd_);
+}
+
+void KeyEventConverterEvdev::Start() {
+ base::MessagePumpOzone::Current()->WatchFileDescriptor(
+ fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this);
+}
+
+void KeyEventConverterEvdev::Stop() {
+ controller_.StopWatchingFileDescriptor();
}
void KeyEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
« no previous file with comments | « ui/events/ozone/evdev/key_event_converter.h ('k') | ui/events/ozone/evdev/key_event_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698