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

Side by Side Diff: device/generic_sensor/platform_sensor.cc

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comment from Tim Created 4 years, 1 month 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
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 "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "device/generic_sensor/platform_sensor_provider.h" 10 #include "device/generic_sensor/platform_sensor_provider.h"
(...skipping 11 matching lines...) Expand all
22 weak_factory_(this) {} 22 weak_factory_(this) {}
23 23
24 PlatformSensor::~PlatformSensor() { 24 PlatformSensor::~PlatformSensor() {
25 provider_->RemoveSensor(GetType()); 25 provider_->RemoveSensor(GetType());
26 } 26 }
27 27
28 mojom::SensorType PlatformSensor::GetType() const { 28 mojom::SensorType PlatformSensor::GetType() const {
29 return type_; 29 return type_;
30 } 30 }
31 31
32 double PlatformSensor::GetMaximumSupportedFrequency() {
33 return GetDefaultConfiguration().frequency();
34 }
35
32 bool PlatformSensor::StartListening(Client* client, 36 bool PlatformSensor::StartListening(Client* client,
33 const PlatformSensorConfiguration& config) { 37 const PlatformSensorConfiguration& config) {
34 DCHECK(clients_.HasObserver(client)); 38 DCHECK(clients_.HasObserver(client));
35 if (!CheckSensorConfiguration(config)) 39 if (!CheckSensorConfiguration(config))
36 return false; 40 return false;
37 41
38 auto& config_list = config_map_[client]; 42 auto& config_list = config_map_[client];
39 config_list.push_back(config); 43 config_list.push_back(config);
40 44
41 if (!UpdateSensorInternal(config_map_)) { 45 if (!UpdateSensorInternal(config_map_)) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 129
126 if (!optimal_configuration) { 130 if (!optimal_configuration) {
127 StopSensor(); 131 StopSensor();
128 return true; 132 return true;
129 } 133 }
130 134
131 return StartSensor(*optimal_configuration); 135 return StartSensor(*optimal_configuration);
132 } 136 }
133 137
134 } // namespace device 138 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor.h ('k') | device/generic_sensor/platform_sensor_and_provider_unittest_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698