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

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

Issue 874723002: [PATCH 9/11] ozone: evdev: Add a device event dispatcher that forwards to UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates for events_unittests Created 5 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/input_device_factory_evdev.cc
diff --git a/ui/events/ozone/evdev/input_device_factory_evdev.cc b/ui/events/ozone/evdev/input_device_factory_evdev.cc
index 2d2904f5000fe8e6c23e05c8e1542259622abc5e..b095db01e656de1399810427614f6119569e37ea 100644
--- a/ui/events/ozone/evdev/input_device_factory_evdev.cc
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc
@@ -9,6 +9,7 @@
#include "base/debug/trace_event.h"
#include "base/stl_util.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
#include "ui/events/devices/device_data_manager.h"
@@ -180,15 +181,14 @@ void CloseInputDevice(const base::FilePath& path,
} // namespace
InputDeviceFactoryEvdev::InputDeviceFactoryEvdev(
- DeviceEventDispatcherEvdev* dispatcher,
- scoped_refptr<base::SingleThreadTaskRunner> dispatch_runner,
+ scoped_ptr<DeviceEventDispatcherEvdev> dispatcher,
CursorDelegateEvdev* cursor)
- : ui_task_runner_(dispatch_runner),
+ : task_runner_(base::ThreadTaskRunnerHandle::Get()),
cursor_(cursor),
#if defined(USE_EVDEV_GESTURES)
gesture_property_provider_(new GesturePropertyProvider),
#endif
- dispatcher_(dispatcher),
+ dispatcher_(dispatcher.Pass()),
weak_ptr_factory_(this) {
}
@@ -202,7 +202,7 @@ void InputDeviceFactoryEvdev::AddInputDevice(int id,
params->id = id;
params->path = path;
params->cursor = cursor_;
- params->dispatcher = dispatcher_;
+ params->dispatcher = dispatcher_.get();
#if defined(USE_EVDEV_GESTURES)
params->gesture_property_provider = gesture_property_provider_.get();
@@ -215,7 +215,7 @@ void InputDeviceFactoryEvdev::AddInputDevice(int id,
// Dispatch task to open from the worker pool, since open may block.
base::WorkerPool::PostTask(FROM_HERE,
base::Bind(&OpenInputDevice, base::Passed(&params),
- ui_task_runner_, reply_callback),
+ task_runner_, reply_callback),
true /* task_is_slow */);
}
@@ -228,7 +228,7 @@ void InputDeviceFactoryEvdev::AttachInputDevice(
const base::FilePath& path = converter->path();
TRACE_EVENT1("ozone", "AttachInputDevice", "path", path.value());
- DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ DCHECK(task_runner_->RunsTasksOnCurrentThread());
// If we have an existing device, detach it. We don't want two
// devices with the same name open at the same time.
@@ -244,7 +244,7 @@ void InputDeviceFactoryEvdev::AttachInputDevice(
void InputDeviceFactoryEvdev::DetachInputDevice(const base::FilePath& path) {
TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value());
- DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ DCHECK(task_runner_->RunsTasksOnCurrentThread());
// Remove device from map.
scoped_ptr<EventConverterEvdev> converter(converters_[path]);

Powered by Google App Engine
This is Rietveld 408576698