OLD | NEW |
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 CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ | 6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 // Starts updating the shared memory buffer with sensor data at | 25 // Starts updating the shared memory buffer with sensor data at |
26 // regular intervals. Returns true if the relevant sensors could | 26 // regular intervals. Returns true if the relevant sensors could |
27 // be successfully activated. | 27 // be successfully activated. |
28 bool StartFetchingDeviceData(ConsumerType consumer_type); | 28 bool StartFetchingDeviceData(ConsumerType consumer_type); |
29 | 29 |
30 // Stops updating the shared memory buffer. Returns true if the | 30 // Stops updating the shared memory buffer. Returns true if the |
31 // relevant sensors could be successfully deactivated. | 31 // relevant sensors could be successfully deactivated. |
32 bool StopFetchingDeviceData(ConsumerType consumer_type); | 32 bool StopFetchingDeviceData(ConsumerType consumer_type); |
33 | 33 |
| 34 // Should be called before destruction to make sure all active |
| 35 // sensors are unregistered. |
| 36 void StopFetchingAllDeviceData(); |
| 37 |
34 // Returns the shared memory handle of the device sensor data | 38 // Returns the shared memory handle of the device sensor data |
35 // duplicated into the given process. This method should only be | 39 // duplicated into the given process. This method should only be |
36 // called after a call to StartFetchingDeviceData method with | 40 // called after a call to StartFetchingDeviceData method with |
37 // corresponding |consumer_type| parameter. | 41 // corresponding |consumer_type| parameter. |
38 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( | 42 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( |
39 ConsumerType consumer_type, base::ProcessHandle process); | 43 ConsumerType consumer_type, base::ProcessHandle process); |
40 | 44 |
41 enum FetcherType { | 45 enum FetcherType { |
42 // Fetcher runs on the same thread as its creator. | 46 // Fetcher runs on the same thread as its creator. |
43 FETCHER_TYPE_DEFAULT, | 47 FETCHER_TYPE_DEFAULT, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Owning pointers. Objects in the map are deleted in dtor. | 93 // Owning pointers. Objects in the map are deleted in dtor. |
90 typedef std::map<ConsumerType, base::SharedMemory*> SharedMemoryMap; | 94 typedef std::map<ConsumerType, base::SharedMemory*> SharedMemoryMap; |
91 SharedMemoryMap shared_memory_map_; | 95 SharedMemoryMap shared_memory_map_; |
92 | 96 |
93 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemoryBase); | 97 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemoryBase); |
94 }; | 98 }; |
95 | 99 |
96 } // namespace content | 100 } // namespace content |
97 | 101 |
98 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ | 102 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_BASE_H_ |
OLD | NEW |