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

Unified Diff: device/generic_sensor/sensor_provider_impl.cc

Issue 2704123006: [Sensors] Clamp given sampling frequency to the minimum supported one (Closed)
Patch Set: rebased Created 3 years, 10 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/sensor_provider_impl.cc
diff --git a/device/generic_sensor/sensor_provider_impl.cc b/device/generic_sensor/sensor_provider_impl.cc
index 7322901e3e0736cd37290db5df02d6970b491f53..8f36c47f0de32415364a4321fa4b1d49cfe1afbd 100644
--- a/device/generic_sensor/sensor_provider_impl.cc
+++ b/device/generic_sensor/sensor_provider_impl.cc
@@ -95,11 +95,13 @@ void SensorProviderImpl::SensorCreated(
init_params->default_configuration = sensor->GetDefaultConfiguration();
double maximum_frequency = sensor->GetMaximumSupportedFrequency();
- DCHECK(maximum_frequency > 0);
+ DCHECK_GT(maximum_frequency, 0.0);
if (maximum_frequency > mojom::SensorConfiguration::kMaxAllowedFrequency)
maximum_frequency = mojom::SensorConfiguration::kMaxAllowedFrequency;
init_params->maximum_frequency = maximum_frequency;
+ init_params->minimum_frequency = sensor->GetMinimumSupportedFrequency();
+ DCHECK_GT(init_params->minimum_frequency, 0.0);
NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(),
callback);

Powered by Google App Engine
This is Rietveld 408576698