Chromium Code Reviews| Index: device/generic_sensor/platform_sensor.h |
| diff --git a/device/generic_sensor/platform_sensor.h b/device/generic_sensor/platform_sensor.h |
| index 94629a552b9d9abe55556bce46e78145afa448c5..07a12b37af3a892202068c2de0e6017efce9ef7a 100644 |
| --- a/device/generic_sensor/platform_sensor.h |
| +++ b/device/generic_sensor/platform_sensor.h |
| @@ -41,6 +41,11 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor |
| virtual mojom::ReportingMode GetReportingMode() = 0; |
| virtual PlatformSensorConfiguration GetDefaultConfiguration() = 0; |
| + virtual bool StartSensor( |
| + const PlatformSensorConfiguration& configuration) = 0; |
| + virtual void StopSensor() = 0; |
| + virtual bool CheckSensorConfiguration( |
| + const PlatformSensorConfiguration& configuration) = 0; |
| // Can be overriden to return the sensor maximum sampling frequency |
| // value obtained from the platform if it is available. If platfrom |
| @@ -64,6 +69,8 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor |
| void AddClient(Client*); |
| void RemoveClient(Client*); |
| + bool GetLatestReading(SensorReading* result); |
|
Mikhail
2017/06/21 11:10:00
let's make it virtual, it seems the newly added Pl
juncai
2017/07/20 00:22:16
Not sure why makes it virtual. It should be the sa
|
| + |
| protected: |
| virtual ~PlatformSensor(); |
| PlatformSensor(mojom::SensorType type, |
| @@ -74,11 +81,6 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor |
| using ReadingBuffer = SensorReadingSharedBuffer; |
| virtual bool UpdateSensorInternal(const ConfigMap& configurations); |
| - virtual bool StartSensor( |
| - const PlatformSensorConfiguration& configuration) = 0; |
| - virtual void StopSensor() = 0; |
| - virtual bool CheckSensorConfiguration( |
| - const PlatformSensorConfiguration& configuration) = 0; |
| // Updates shared buffer with new sensor reading data. |
| // Note: this method is thread-safe. |
| @@ -94,12 +96,12 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor |
| // If platfrom sensor events are processed on a different |
| // thread, notifications are forwarded to |task_runner_|. |
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + base::ObserverList<Client, true> clients_; |
| private: |
| friend class base::RefCountedThreadSafe<PlatformSensor>; |
| const mojo::ScopedSharedBufferMapping shared_buffer_mapping_; |
| mojom::SensorType type_; |
| - base::ObserverList<Client, true> clients_; |
| ConfigMap config_map_; |
| PlatformSensorProvider* provider_; |
| base::WeakPtrFactory<PlatformSensor> weak_factory_; |