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 265b3c7253c14b2bee3682355f34d16b3dab401e..714eba041e3f5e9a9bb1115e6985ba0b227cc85b 100644 |
--- a/ui/events/ozone/evdev/event_factory_evdev.cc |
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc |
@@ -134,22 +134,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; |
} |
@@ -327,4 +312,26 @@ int EventFactoryEvdev::NextDeviceId() { |
return ++last_device_id_; |
} |
+void EventFactoryEvdev::StartThread() { |
+ // Set up device factory. |
+ scoped_ptr<DeviceEventDispatcherEvdev> dispatcher( |
+ 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 |