| Index: device/generic_sensor/polling_platform_sensor.h
|
| diff --git a/device/generic_sensor/polling_platform_sensor.h b/device/generic_sensor/polling_platform_sensor.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ddbac68ecd4ae1cecf95e19210c24cee73fbbb6e
|
| --- /dev/null
|
| +++ b/device/generic_sensor/polling_platform_sensor.h
|
| @@ -0,0 +1,44 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
|
| +#define DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
|
| +
|
| +#include "base/timer/timer.h"
|
| +#include "device/generic_sensor/platform_sensor.h"
|
| +
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +}
|
| +
|
| +namespace device {
|
| +
|
| +class PollingPlatformSensor : public PlatformSensor {
|
| + public:
|
| + PollingPlatformSensor(
|
| + mojom::SensorType type,
|
| + mojo::ScopedSharedBufferMapping mapping,
|
| + PlatformSensorProvider* provider,
|
| + scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner);
|
| +
|
| + virtual void UpdateReading() = 0;
|
| +
|
| + protected:
|
| + ~PollingPlatformSensor() override;
|
| + bool StartSensor(const PlatformSensorConfiguration& configuration) override;
|
| + void StopSensor() override;
|
| + scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner_;
|
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
|
| + base::RepeatingTimer timer_;
|
| +
|
| + private:
|
| + void BeginPoll(const PlatformSensorConfiguration& configuration);
|
| + void StopPoll();
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PollingPlatformSensor);
|
| +};
|
| +
|
| +} // namespace device
|
| +
|
| +#endif // DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
|
|
|