Chromium Code Reviews| 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 |