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

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.h

Issue 873833002: [PATCH 11/11] ozone: evdev: Add dedicated events thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_factory_evdev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/task_runner.h" 12 #include "base/task_runner.h"
13 #include "ui/events/ozone/device/device_event_observer.h" 13 #include "ui/events/ozone/device/device_event_observer.h"
14 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" 14 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
16 #include "ui/events/ozone/evdev/event_thread_evdev.h"
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 17 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
17 #include "ui/events/ozone/evdev/input_controller_evdev.h" 18 #include "ui/events/ozone/evdev/input_controller_evdev.h"
18 #include "ui/events/ozone/evdev/keyboard_evdev.h" 19 #include "ui/events/ozone/evdev/keyboard_evdev.h"
19 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" 20 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
20 #include "ui/events/platform/platform_event_source.h" 21 #include "ui/events/platform/platform_event_source.h"
21 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
22 #include "ui/ozone/public/system_input_injector.h" 23 #include "ui/ozone/public/system_input_injector.h"
23 24
24 namespace gfx { 25 namespace gfx {
25 class PointF; 26 class PointF;
26 } // namespace gfx 27 } // namespace gfx
27 28
28 namespace ui { 29 namespace ui {
29 30
30 class CursorDelegateEvdev; 31 class CursorDelegateEvdev;
31 class DeviceManager; 32 class DeviceManager;
32 class InputDeviceFactoryEvdev; 33 class InputDeviceFactoryEvdev;
33 class InputDeviceFactoryEvdevProxy; 34 class InputDeviceFactoryEvdevProxy;
34 class SystemInputInjector; 35 class SystemInputInjector;
35 enum class DomCode; 36 enum class DomCode;
36 37
37 #if !defined(USE_EVDEV) 38 #if !defined(USE_EVDEV)
38 #error Missing dependency on ui/events/ozone:events_ozone_evdev 39 #error Missing dependency on ui/events/ozone:events_ozone_evdev
39 #endif 40 #endif
40 41
41 // Ozone events implementation for the Linux input subsystem ("evdev"). 42 // Ozone events implementation for the Linux input subsystem ("evdev").
43 //
44 // This is a UI thread object, but creates its own thread for I/O. See
45 // InputDeviceFactoryEvdev for the I/O thread part.
42 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver, 46 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
43 public PlatformEventSource { 47 public PlatformEventSource {
44 public: 48 public:
45 EventFactoryEvdev(CursorDelegateEvdev* cursor, 49 EventFactoryEvdev(CursorDelegateEvdev* cursor,
46 DeviceManager* device_manager, 50 DeviceManager* device_manager,
47 KeyboardLayoutEngine* keyboard_layout_engine); 51 KeyboardLayoutEngine* keyboard_layout_engine);
48 ~EventFactoryEvdev() override; 52 ~EventFactoryEvdev() override;
49 53
50 // Initialize. Must be called with a valid message loop. 54 // Initialize. Must be called with a valid message loop.
51 void Init(); 55 void Init();
(...skipping 29 matching lines...) Expand all
81 85
82 // PlatformEventSource: 86 // PlatformEventSource:
83 void OnDispatcherListChanged() override; 87 void OnDispatcherListChanged() override;
84 88
85 private: 89 private:
86 // Dispatch event via PlatformEventSource. 90 // Dispatch event via PlatformEventSource.
87 void DispatchUiEvent(ui::Event* event); 91 void DispatchUiEvent(ui::Event* event);
88 92
89 int NextDeviceId(); 93 int NextDeviceId();
90 94
95 // Device thread initialization.
96 void StartThread();
97 void OnThreadStarted(
98 scoped_ptr<InputDeviceFactoryEvdevProxy> input_device_factory);
99
91 // Used to uniquely identify input devices. 100 // Used to uniquely identify input devices.
92 int last_device_id_; 101 int last_device_id_;
93 102
94 // Interface for scanning & monitoring input devices. 103 // Interface for scanning & monitoring input devices.
95 DeviceManager* device_manager_; // Not owned. 104 DeviceManager* device_manager_; // Not owned.
96 105
97 // Factory for per-device objects.
98 scoped_ptr<InputDeviceFactoryEvdev> input_device_factory_;
99
100 // Proxy for input device factory (manages device I/O objects). 106 // Proxy for input device factory (manages device I/O objects).
107 // The real object lives on a different thread.
101 scoped_ptr<InputDeviceFactoryEvdevProxy> input_device_factory_proxy_; 108 scoped_ptr<InputDeviceFactoryEvdevProxy> input_device_factory_proxy_;
102 109
103 // Modifier key state (shift, ctrl, etc). 110 // Modifier key state (shift, ctrl, etc).
104 EventModifiersEvdev modifiers_; 111 EventModifiersEvdev modifiers_;
105 112
106 // Mouse button map. 113 // Mouse button map.
107 MouseButtonMapEvdev button_map_; 114 MouseButtonMapEvdev button_map_;
108 115
109 // Keyboard state. 116 // Keyboard state.
110 KeyboardEvdev keyboard_; 117 KeyboardEvdev keyboard_;
111 118
112 // Cursor movement. 119 // Cursor movement.
113 CursorDelegateEvdev* cursor_; 120 CursorDelegateEvdev* cursor_;
114 121
115 // Object for controlling input devices. 122 // Object for controlling input devices.
116 InputControllerEvdev input_controller_; 123 InputControllerEvdev input_controller_;
117 124
118 // Whether we've set up the device factory & done initial scan. 125 // Whether we've set up the device factory.
119 bool initialized_; 126 bool initialized_;
120 127
128 // Thread for device I/O.
129 EventThreadEvdev thread_;
130
121 // Support weak pointers for attach & detach callbacks. 131 // Support weak pointers for attach & detach callbacks.
122 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; 132 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_;
123 133
124 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); 134 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev);
125 }; 135 };
126 136
127 } // namespace ui 137 } // namespace ui
128 138
129 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ 139 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/event_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698