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

Unified Diff: device/generic_sensor/platform_sensor_provider_base.h

Issue 2434073002: [sensors] PlatformSensorProvider implementations are notified when there are no sensor instances (Closed)
Patch Set: rebased Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/platform_sensor_provider_base.h
diff --git a/device/generic_sensor/platform_sensor_provider_base.h b/device/generic_sensor/platform_sensor_provider_base.h
index 2065a3f695fb5836240640da9940bb0dee03ae68..a5da624c4f0e241e00c80110b3e45c72603ed7d8 100644
--- a/device/generic_sensor/platform_sensor_provider_base.h
+++ b/device/generic_sensor/platform_sensor_provider_base.h
@@ -31,6 +31,10 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensorProviderBase
// Shared buffer getters.
mojo::ScopedSharedBufferHandle CloneSharedBufferHandle();
+ // Returns 'true' if some of sensor instances produced by this provider are
+ // alive; 'false' otherwise.
+ bool HasSensors() const;
+
protected:
PlatformSensorProviderBase();
virtual ~PlatformSensorProviderBase();
@@ -40,6 +44,10 @@ class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensorProviderBase
mojo::ScopedSharedBufferMapping mapping,
const CreateSensorCallback& callback) = 0;
+ // Implementations might override this method to free resources when there
+ // are no sensors left.
+ virtual void AllSensorsRemoved() {}
+
private:
friend class PlatformSensor; // To call RemoveSensor();
« no previous file with comments | « device/generic_sensor/fake_platform_sensor_provider.cc ('k') | device/generic_sensor/platform_sensor_provider_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698