| 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_DEVICE_SENSOR_SERVICE_H_ | 5 #ifndef DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ | 6 #define DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "content/browser/device_sensors/device_sensors_consts.h" | 15 #include "device/sensors/device_sensor_export.h" |
| 16 #include "content/common/content_export.h" | 16 #include "device/sensors/device_sensors_consts.h" |
| 17 #include "mojo/public/cpp/system/buffer.h" | 17 #include "mojo/public/cpp/system/buffer.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace device { |
| 20 | 20 |
| 21 class DataFetcherSharedMemory; | 21 class DataFetcherSharedMemory; |
| 22 | 22 |
| 23 // Owns the data fetcher for Device Motion and Orientation and keeps track of | 23 // Owns the data fetcher for Device Motion and Orientation and keeps track of |
| 24 // the number of consumers currently using the data. The data fetcher is stopped | 24 // the number of consumers currently using the data. The data fetcher is stopped |
| 25 // when there are no consumers. | 25 // when there are no consumers. |
| 26 class CONTENT_EXPORT DeviceSensorService { | 26 class DEVICE_SENSOR_EXPORT DeviceSensorService { |
| 27 public: | 27 public: |
| 28 // Returns the DeviceSensorService singleton. | 28 // Returns the DeviceSensorService singleton. |
| 29 static DeviceSensorService* GetInstance(); | 29 static DeviceSensorService* GetInstance(); |
| 30 | 30 |
| 31 // Increments the number of users of the provider. The Provider is running | 31 // Increments the number of users of the provider. The Provider is running |
| 32 // when there's > 0 users, and is paused when the count drops to 0. | 32 // when there's > 0 users, and is paused when the count drops to 0. |
| 33 // Must be called on the I/O thread. | 33 // Must be called on the I/O thread. |
| 34 void AddConsumer(ConsumerType consumer_type); | 34 void AddConsumer(ConsumerType consumer_type); |
| 35 | 35 |
| 36 // Removes a consumer. Should be matched with an AddConsumer call. | 36 // Removes a consumer. Should be matched with an AddConsumer call. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 61 int num_motion_readers_; | 61 int num_motion_readers_; |
| 62 int num_orientation_readers_; | 62 int num_orientation_readers_; |
| 63 int num_orientation_absolute_readers_; | 63 int num_orientation_absolute_readers_; |
| 64 bool is_shutdown_; | 64 bool is_shutdown_; |
| 65 std::unique_ptr<DataFetcherSharedMemory> data_fetcher_; | 65 std::unique_ptr<DataFetcherSharedMemory> data_fetcher_; |
| 66 base::ThreadChecker thread_checker_; | 66 base::ThreadChecker thread_checker_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(DeviceSensorService); | 68 DISALLOW_COPY_AND_ASSIGN(DeviceSensorService); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace content | 71 } // namespace device |
| 72 | 72 |
| 73 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ | 73 #endif // DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ |
| OLD | NEW |