Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1321)

Side by Side Diff: device/generic_sensor/polling_platform_sensor.h

Issue 2332903002: [sensors] [mac] Implement ambient light sensor for macOS (Closed)
Patch Set: Fix comments from Mikhail Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
6 #define DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
7
8 #include "base/timer/timer.h"
9 #include "device/generic_sensor/platform_sensor.h"
10
11 namespace base {
12 class SingleThreadTaskRunner;
13 }
14
15 namespace device {
16
17 class PollingPlatformSensor : public PlatformSensor {
18 public:
19 PollingPlatformSensor(
20 mojom::SensorType type,
21 mojo::ScopedSharedBufferMapping mapping,
22 PlatformSensorProvider* provider,
23 scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner);
24
25 virtual void UpdateReading() = 0;
26
27 protected:
28 ~PollingPlatformSensor() override;
29 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
30 void StopSensor() override;
31 scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner_;
32 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
33 base::RepeatingTimer timer_;
34
35 private:
36 void BeginPoll(const PlatformSensorConfiguration& configuration);
37 void StopPoll();
38
39 DISALLOW_COPY_AND_ASSIGN(PollingPlatformSensor);
40 };
41
42 } // namespace device
43
44 #endif // DEVICE_GENERIC_SENSOR_POLLING_PLATFORM_SENSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698