OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/ozone/evdev/event_thread_evdev.h" | 5 #include "ui/events/ozone/evdev/event_thread_evdev.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
15 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 16 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
16 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" | 17 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" |
17 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" | 18 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 // Internal base::Thread subclass for events thread. | 24 // Internal base::Thread subclass for events thread. |
24 class EvdevThread : public base::Thread { | 25 class EvdevThread : public base::Thread { |
(...skipping 10 matching lines...) Expand all Loading... |
35 | 36 |
36 void Init() override { | 37 void Init() override { |
37 TRACE_EVENT0("evdev", "EvdevThread::Init"); | 38 TRACE_EVENT0("evdev", "EvdevThread::Init"); |
38 input_device_factory_ = | 39 input_device_factory_ = |
39 new InputDeviceFactoryEvdev(std::move(dispatcher_), cursor_); | 40 new InputDeviceFactoryEvdev(std::move(dispatcher_), cursor_); |
40 | 41 |
41 std::unique_ptr<InputDeviceFactoryEvdevProxy> proxy( | 42 std::unique_ptr<InputDeviceFactoryEvdevProxy> proxy( |
42 new InputDeviceFactoryEvdevProxy(base::ThreadTaskRunnerHandle::Get(), | 43 new InputDeviceFactoryEvdevProxy(base::ThreadTaskRunnerHandle::Get(), |
43 input_device_factory_->GetWeakPtr())); | 44 input_device_factory_->GetWeakPtr())); |
44 | 45 |
| 46 cursor_->InitializeOnEvdev(); |
| 47 |
45 init_runner_->PostTask(FROM_HERE, | 48 init_runner_->PostTask(FROM_HERE, |
46 base::Bind(init_callback_, base::Passed(&proxy))); | 49 base::Bind(init_callback_, base::Passed(&proxy))); |
47 } | 50 } |
48 | 51 |
49 void CleanUp() override { | 52 void CleanUp() override { |
50 TRACE_EVENT0("evdev", "EvdevThread::CleanUp"); | 53 TRACE_EVENT0("evdev", "EvdevThread::CleanUp"); |
51 delete input_device_factory_; | 54 delete input_device_factory_; |
52 } | 55 } |
53 | 56 |
54 private: | 57 private: |
(...skipping 20 matching lines...) Expand all Loading... |
75 CursorDelegateEvdev* cursor, | 78 CursorDelegateEvdev* cursor, |
76 const EventThreadStartCallback& callback) { | 79 const EventThreadStartCallback& callback) { |
77 TRACE_EVENT0("evdev", "EventThreadEvdev::Start"); | 80 TRACE_EVENT0("evdev", "EventThreadEvdev::Start"); |
78 thread_.reset(new EvdevThread(std::move(dispatcher), cursor, callback)); | 81 thread_.reset(new EvdevThread(std::move(dispatcher), cursor, callback)); |
79 if (!thread_->StartWithOptions( | 82 if (!thread_->StartWithOptions( |
80 base::Thread::Options(base::MessageLoop::TYPE_UI, 0))) | 83 base::Thread::Options(base::MessageLoop::TYPE_UI, 0))) |
81 LOG(FATAL) << "Failed to create input thread"; | 84 LOG(FATAL) << "Failed to create input thread"; |
82 } | 85 } |
83 | 86 |
84 } // namespace ui | 87 } // namespace ui |
OLD | NEW |