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

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.cpp

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
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
index 6caf643251707c101b239a138b9a79c37d58a8a6..baa7be212caa72df4b93ed3c77bf24acfc2be9a3 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
@@ -24,8 +24,7 @@ SensorProxy::SensorProxy(SensorType sensorType,
m_provider(provider),
m_clientBinding(this),
m_state(SensorProxy::Uninitialized),
- m_suspended(false),
- m_maximumFrequency(0.0) {}
+ m_suspended(false) {}
SensorProxy::~SensorProxy() {}
@@ -211,9 +210,14 @@ void SensorProxy::onSensorCreated(SensorInitParamsPtr params,
handleSensorError();
return;
}
-
- m_maximumFrequency = params->maximum_frequency;
- DCHECK(m_maximumFrequency <= SensorConfiguration::kMaxAllowedFrequency);
+ m_frequencyLimits.first = params->minimum_frequency;
+ m_frequencyLimits.second = params->maximum_frequency;
+
+ DCHECK_GT(m_frequencyLimits.first, 0.0);
+ DCHECK_GE(m_frequencyLimits.second, m_frequencyLimits.first);
+ constexpr double kMaxAllowedFrequency =
+ SensorConfiguration::kMaxAllowedFrequency;
+ DCHECK_GE(kMaxAllowedFrequency, m_frequencyLimits.second);
auto errorCallback =
WTF::bind(&SensorProxy::handleSensorError, wrapWeakPersistent(this));
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698