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

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

Issue 873833002: [PATCH 11/11] ozone: evdev: Add dedicated events thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add Stop() to ~EvdevThread 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
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/event_thread_evdev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/event_factory_evdev.cc
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc
index e94630b8b73d63cd8f880d2d4dda92235290620f..cbc660d65e755e0fac874e9f38b1edffbec47799 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.cc
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -126,22 +126,7 @@ EventFactoryEvdev::~EventFactoryEvdev() {
void EventFactoryEvdev::Init() {
DCHECK(!initialized_);
- // Set up device factory.
- scoped_ptr<DeviceEventDispatcherEvdev> dispatcher(
- new ForwardingDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(),
- weak_ptr_factory_.GetWeakPtr()));
- input_device_factory_.reset(
- new InputDeviceFactoryEvdev(dispatcher.Pass(), cursor_));
- input_device_factory_proxy_.reset(
- new InputDeviceFactoryProxyEvdev(base::ThreadTaskRunnerHandle::Get(),
- input_device_factory_->GetWeakPtr()));
-
- // TODO(spang): This settings interface is really broken. crbug.com/450899
- input_controller_.SetInputDeviceFactory(input_device_factory_proxy_.get());
-
- // Scan & monitor devices.
- device_manager_->AddObserver(this);
- device_manager_->ScanDevices(this);
+ StartThread();
initialized_ = true;
}
@@ -312,4 +297,26 @@ int EventFactoryEvdev::NextDeviceId() {
return ++last_device_id_;
}
+void EventFactoryEvdev::StartThread() {
+ // Set up device factory.
+ scoped_ptr<DeviceEventDispatcherEvdev> dispatcher(
alexst (slow to review) 2015/01/28 21:06:12 per comments in previous patches, can this be disp
spang 2015/01/28 21:37:32 Done.
+ new ForwardingDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(),
+ weak_ptr_factory_.GetWeakPtr()));
+ thread_.Start(dispatcher.Pass(), cursor_,
+ base::Bind(&EventFactoryEvdev::OnThreadStarted,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void EventFactoryEvdev::OnThreadStarted(
+ scoped_ptr<InputDeviceFactoryProxyEvdev> input_device_factory) {
+ input_device_factory_proxy_ = input_device_factory.Pass();
+
+ // TODO(spang): This settings interface is really broken. crbug.com/450899
+ input_controller_.SetInputDeviceFactory(input_device_factory_proxy_.get());
+
+ // Scan & monitor devices.
+ device_manager_->AddObserver(this);
+ device_manager_->ScanDevices(this);
+}
+
} // namespace ui
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/event_thread_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698