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

Side by Side Diff: device/gamepad/gamepad_provider.h

Issue 2466073002: Movw GamepadService out of content/browser/ and into device/ (Closed)
Patch Set: Fixed everything but one unittest Created 4 years, 1 month 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 | « device/gamepad/BUILD.gn ('k') | device/gamepad/gamepad_provider.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ 5 #ifndef DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_
6 #define DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ 6 #define DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 24 matching lines...) Expand all
35 virtual void OnGamepadConnectionChange(bool connected, 35 virtual void OnGamepadConnectionChange(bool connected,
36 int index, 36 int index,
37 const blink::WebGamepad& pad) = 0; 37 const blink::WebGamepad& pad) = 0;
38 }; 38 };
39 39
40 class DEVICE_GAMEPAD_EXPORT GamepadProvider 40 class DEVICE_GAMEPAD_EXPORT GamepadProvider
41 : public GamepadPadStateProvider, 41 : public GamepadPadStateProvider,
42 public base::SystemMonitor::DevicesChangedObserver { 42 public base::SystemMonitor::DevicesChangedObserver {
43 public: 43 public:
44 explicit GamepadProvider( 44 explicit GamepadProvider(
45 std::unique_ptr<GamepadSharedBuffer> buffer,
46 GamepadConnectionChangeClient* connection_change_client); 45 GamepadConnectionChangeClient* connection_change_client);
47 46
48 // Manually specifies the data fetcher. Used for testing. 47 // Manually specifies the data fetcher. Used for testing.
49 explicit GamepadProvider( 48 explicit GamepadProvider(
50 std::unique_ptr<GamepadSharedBuffer> buffer,
51 GamepadConnectionChangeClient* connection_change_client, 49 GamepadConnectionChangeClient* connection_change_client,
52 std::unique_ptr<GamepadDataFetcher> fetcher); 50 std::unique_ptr<GamepadDataFetcher> fetcher);
53 51
54 ~GamepadProvider() override; 52 ~GamepadProvider() override;
55 53
56 // Returns the shared memory handle of the gamepad data duplicated into the 54 // Returns the shared memory handle of the gamepad data duplicated into the
57 // given process. 55 // given process.
58 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( 56 base::SharedMemoryHandle GetSharedMemoryHandleForProcess(
59 base::ProcessHandle renderer_process); 57 base::ProcessHandle renderer_process);
60 58
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 144
147 bool ever_had_user_gesture_; 145 bool ever_had_user_gesture_;
148 bool sanitize_; 146 bool sanitize_;
149 147
150 // Only used on the polling thread. 148 // Only used on the polling thread.
151 typedef std::vector<std::unique_ptr<GamepadDataFetcher>> GamepadFetcherVector; 149 typedef std::vector<std::unique_ptr<GamepadDataFetcher>> GamepadFetcherVector;
152 GamepadFetcherVector data_fetchers_; 150 GamepadFetcherVector data_fetchers_;
153 151
154 base::Lock shared_memory_lock_; 152 base::Lock shared_memory_lock_;
155 std::unique_ptr<GamepadSharedBuffer> gamepad_shared_buffer_; 153 std::unique_ptr<GamepadSharedBuffer> gamepad_shared_buffer_;
154 base::SharedMemory* gamepad_shared_memory;
156 155
157 // Polling is done on this background thread. 156 // Polling is done on this background thread.
158 std::unique_ptr<base::Thread> polling_thread_; 157 std::unique_ptr<base::Thread> polling_thread_;
159 158
160 GamepadConnectionChangeClient* connection_change_client_; 159 GamepadConnectionChangeClient* connection_change_client_;
161 160
162 DISALLOW_COPY_AND_ASSIGN(GamepadProvider); 161 DISALLOW_COPY_AND_ASSIGN(GamepadProvider);
163 }; 162 };
164 163
165 } // namespace device 164 } // namespace device
166 165
167 #endif // DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ 166 #endif // DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_
OLDNEW
« no previous file with comments | « device/gamepad/BUILD.gn ('k') | device/gamepad/gamepad_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698