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

Unified Diff: device/generic_sensor/platform_sensor_linux.h

Issue 2533793002: [sensors](CrOS/Linux) Implement Sensor device manager for sensors (Closed)
Patch Set: construct manager Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/platform_sensor_linux.h
diff --git a/device/generic_sensor/platform_sensor_linux.h b/device/generic_sensor/platform_sensor_linux.h
index ff9b9c1c8d740f53e82b7c74180278839ee4b82a..e8555d931ee1486401d85ed2f0f3a9a19baabf52 100644
--- a/device/generic_sensor/platform_sensor_linux.h
+++ b/device/generic_sensor/platform_sensor_linux.h
@@ -8,15 +8,13 @@
#include "device/generic_sensor/platform_sensor.h"
namespace base {
-class RepeatingTimer;
class SingleThreadTaskRunner;
-class Thread;
}
namespace device {
class SensorReader;
-struct SensorDataLinux;
+struct SensorInfoLinux;
class PlatformSensorLinux : public PlatformSensor {
public:
@@ -24,13 +22,17 @@ class PlatformSensorLinux : public PlatformSensor {
mojom::SensorType type,
mojo::ScopedSharedBufferMapping mapping,
PlatformSensorProvider* provider,
- const SensorDataLinux& data,
- std::unique_ptr<SensorReader> sensor_reader,
+ const SensorInfoLinux* sensor_device,
scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner);
- // Thread safe.
mojom::ReportingMode GetReportingMode() override;
+ // Called by a sensor reader. Takes new readings.
+ void UpdatePlatformSensorReading(SensorReading reading);
+
+ // Called by a sensor reader if an error occurs.
+ void NotifyPlatformSensorError();
+
protected:
~PlatformSensorLinux() override;
bool StartSensor(const PlatformSensorConfiguration& configuration) override;
@@ -40,16 +42,6 @@ class PlatformSensorLinux : public PlatformSensor {
PlatformSensorConfiguration GetDefaultConfiguration() override;
private:
- void BeginPoll(const PlatformSensorConfiguration& configuration);
- void StopPoll();
-
- // Triggers |sensor_reader_| to read new sensor data.
- // If new data is read, UpdateSensorReading() is called.
- void PollForReadingData();
-
- // Owned timer to be deleted on a polling thread.
- base::RepeatingTimer* timer_;
-
const PlatformSensorConfiguration default_configuration_;
const mojom::ReportingMode reporting_mode_;
@@ -57,9 +49,6 @@ class PlatformSensorLinux : public PlatformSensor {
// and stores them to a SensorReading structure.
std::unique_ptr<SensorReader> sensor_reader_;
- // A task runner that is used to poll sensor data.
- scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner_;
-
// Stores previously read values that are used to
// determine whether the recent values are changed
// and IPC can be notified that updates are available.

Powered by Google App Engine
This is Rietveld 408576698