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

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: rebase 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 92eb8ef9359b72079066dad58c9c0d13e636b5b3..001ee7f2924836063cff480939f93b6acf90269b 100644
--- a/ui/events/ozone/evdev/input_device_factory_evdev.cc
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc
@@ -10,6 +10,7 @@
#include "base/debug/trace_event.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.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"
@@ -247,15 +248,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) {
}
@@ -269,7 +269,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();
@@ -282,7 +282,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 */);
}
@@ -295,7 +295,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.
@@ -311,7 +311,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]);
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev.h ('k') | ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698