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

Unified Diff: device/generic_sensor/sensor_provider_impl.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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/sensor_provider_impl.cc
diff --git a/device/generic_sensor/sensor_provider_impl.cc b/device/generic_sensor/sensor_provider_impl.cc
index 63b2744f92f2795f8bcc6b939616adf5a94ada54..80faafc12d9a2fe92638268ceab87d8821d9955c 100644
--- a/device/generic_sensor/sensor_provider_impl.cc
+++ b/device/generic_sensor/sensor_provider_impl.cc
@@ -92,6 +92,13 @@ void SensorProviderImpl::SensorCreated(
init_params->mode = sensor->GetReportingMode();
init_params->default_configuration = sensor->GetDefaultConfiguration();
+ double maximum_frequency = sensor->GetMaximumSupportedFrequency();
+ DCHECK(maximum_frequency > 0);
+ if (maximum_frequency > mojom::SensorConfiguration::kMaxAllowedFrequency)
+ maximum_frequency = mojom::SensorConfiguration::kMaxAllowedFrequency;
+
+ init_params->maximum_frequency = maximum_frequency;
+
NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(),
callback);

Powered by Google App Engine
This is Rietveld 408576698