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

Unified Diff: device/generic_sensor/platform_sensor.cc

Issue 2297593002: [sensors] Don't call OnSensorReadingChanged if client's suspended. (Closed)
Patch Set: patch Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/generic_sensor/platform_sensor.cc
diff --git a/device/generic_sensor/platform_sensor.cc b/device/generic_sensor/platform_sensor.cc
index 8123b6012b5127a608253a2cad777e1847d076fc..5712abc5f6e61ea8af8140796c1f67a82ab38399 100644
--- a/device/generic_sensor/platform_sensor.cc
+++ b/device/generic_sensor/platform_sensor.cc
@@ -81,7 +81,13 @@ void PlatformSensor::RemoveClient(Client* client) {
}
void PlatformSensor::NotifySensorReadingChanged() {
- FOR_EACH_OBSERVER(Client, clients_, OnSensorReadingChanged());
+ using ClientsList = decltype(clients_);
+ ClientsList::Iterator it(&clients_);
+ Client* client;
+ while ((client = it.GetNext()) != nullptr) {
+ if (!client->IsNotificationSuspended())
+ client->OnSensorReadingChanged();
+ }
}
void PlatformSensor::NotifySensorError() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698