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

Side by Side 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, 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/generic_sensor/platform_sensor.h" 5 #include "device/generic_sensor/platform_sensor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "device/generic_sensor/platform_sensor_configuration.h" 9 #include "device/generic_sensor/platform_sensor_configuration.h"
10 #include "device/generic_sensor/platform_sensor_provider.h" 10 #include "device/generic_sensor/platform_sensor_provider.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DCHECK(client); 74 DCHECK(client);
75 clients_.RemoveObserver(client); 75 clients_.RemoveObserver(client);
76 auto client_entry = config_map_.find(client); 76 auto client_entry = config_map_.find(client);
77 if (client_entry != config_map_.end()) { 77 if (client_entry != config_map_.end()) {
78 config_map_.erase(client_entry); 78 config_map_.erase(client_entry);
79 UpdateSensorInternal(config_map_); 79 UpdateSensorInternal(config_map_);
80 } 80 }
81 } 81 }
82 82
83 void PlatformSensor::NotifySensorReadingChanged() { 83 void PlatformSensor::NotifySensorReadingChanged() {
84 FOR_EACH_OBSERVER(Client, clients_, OnSensorReadingChanged()); 84 using ClientsList = decltype(clients_);
85 ClientsList::Iterator it(&clients_);
86 Client* client;
87 while ((client = it.GetNext()) != nullptr) {
88 if (!client->IsNotificationSuspended())
89 client->OnSensorReadingChanged();
90 }
85 } 91 }
86 92
87 void PlatformSensor::NotifySensorError() { 93 void PlatformSensor::NotifySensorError() {
88 FOR_EACH_OBSERVER(Client, clients_, OnSensorError()); 94 FOR_EACH_OBSERVER(Client, clients_, OnSensorError());
89 } 95 }
90 96
91 } // namespace device 97 } // namespace device
OLDNEW
« 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