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

Unified Diff: ui/events/ozone/evdev/touch_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
Index: ui/events/ozone/evdev/touch_event_converter.cc
diff --git a/ui/events/ozone/evdev/touch_event_converter.cc b/ui/events/ozone/evdev/touch_event_converter.cc
index d21225e3f36638d703e0a1405a865e1e866c2ca5..651e8f0088b5548d7d3321d4226ff486bbba9242 100644
--- a/ui/events/ozone/evdev/touch_event_converter.cc
+++ b/ui/events/ozone/evdev/touch_event_converter.cc
@@ -16,7 +16,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_ozone.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
@@ -43,11 +42,12 @@ TouchEventConverterEvdev::TouchEventConverterEvdev(int fd, base::FilePath path)
fd_(fd),
path_(path) {
Init();
+ Start();
}
TouchEventConverterEvdev::~TouchEventConverterEvdev() {
- if (fd_ >= 0 && close(fd_) < 0)
- DLOG(WARNING) << "failed close on " << path_.value();
+ Stop();
+ close(fd_);
}
void TouchEventConverterEvdev::Init() {
@@ -99,6 +99,15 @@ void TouchEventConverterEvdev::Init() {
}
}
+void TouchEventConverterEvdev::Start() {
+ base::MessagePumpOzone::Current()->WatchFileDescriptor(
+ fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this);
+}
+
+void TouchEventConverterEvdev::Stop() {
+ controller_.StopWatchingFileDescriptor();
+}
+
void TouchEventConverterEvdev::OnFileCanWriteWithoutBlocking(int /* fd */) {
// Read-only file-descriptors.
NOTREACHED();
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter.h ('k') | ui/events/ozone/evdev/touch_event_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698