OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ | 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/common/device_motion_hardware_buffer.h" | 11 #include "content/common/device_motion_hardware_buffer.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 class DataFetcherSharedMemory; |
15 // TODO(timvolodine): Add data fetcher to this class. | |
16 | 15 |
17 class CONTENT_EXPORT DeviceMotionProvider { | 16 class CONTENT_EXPORT DeviceMotionProvider { |
18 public: | 17 public: |
19 DeviceMotionProvider(); | 18 DeviceMotionProvider(); |
20 virtual ~DeviceMotionProvider(); | 19 virtual ~DeviceMotionProvider(); |
21 | 20 |
22 // Returns the shared memory handle of the device motion data duplicated | 21 // Returns the shared memory handle of the device motion data duplicated |
23 // into the given process. | 22 // into the given process. |
24 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( | 23 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( |
25 base::ProcessHandle renderer_process); | 24 base::ProcessHandle renderer_process); |
26 | 25 |
27 // Pause and resume the background polling thread. Can be called from any | 26 // Pause and resume the background polling thread. Can be called from any |
28 // thread. | 27 // thread. |
29 void StartFetchingDeviceMotionData(); | 28 void StartFetchingDeviceMotionData(); |
30 void StopFetchingDeviceMotionData(); | 29 void StopFetchingDeviceMotionData(); |
31 | 30 |
32 private: | 31 private: |
33 base::SharedMemory device_motion_shared_memory_; | 32 base::SharedMemory device_motion_shared_memory_; |
34 | 33 |
35 DeviceMotionHardwareBuffer* SharedMemoryAsHardwareBuffer(); | 34 DeviceMotionHardwareBuffer* SharedMemoryAsHardwareBuffer(); |
36 | 35 |
37 // TODO(timvolodine): add member variable, | 36 scoped_ptr<DataFetcherSharedMemory> data_fetcher_; |
38 // scoped_ptr<DataFetcherSharedMemory> data_fetcher_; | |
39 | 37 |
40 bool is_started_; | 38 bool is_started_; |
41 | 39 |
42 DISALLOW_COPY_AND_ASSIGN(DeviceMotionProvider); | 40 DISALLOW_COPY_AND_ASSIGN(DeviceMotionProvider); |
43 }; | 41 }; |
44 | 42 |
45 } // namespace content | 43 } // namespace content |
46 | 44 |
47 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ | 45 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
OLD | NEW |