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

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: 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: 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 53c7e9f3597fae81ededb1a03cacf3b82841a112..632019fd16533b364511841d5ef908032e34256b 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() {}
@@ -212,9 +211,12 @@ void SensorProxy::onSensorCreated(SensorInitParamsPtr params,
handleSensorError();
return;
}
+ m_frequencyLimits.first = params->minimum_frequency;
+ m_frequencyLimits.second = params->maximum_frequency;
- m_maximumFrequency = params->maximum_frequency;
- DCHECK(m_maximumFrequency <= SensorConfiguration::kMaxAllowedFrequency);
+ DCHECK_GT(m_frequencyLimits.first, 0);
+ DCHECK(m_frequencyLimits.first <= m_frequencyLimits.second);
Reilly Grant (use Gerrit) 2017/02/22 18:40:15 DCHECK_GE
Mikhail 2017/02/23 12:42:34 Done.
+ DCHECK(m_frequencyLimits.second <= SensorConfiguration::kMaxAllowedFrequency);
Reilly Grant (use Gerrit) 2017/02/22 18:40:15 DCHECK_GE
Mikhail 2017/02/23 12:42:34 Done.
auto errorCallback =
WTF::bind(&SensorProxy::handleSensorError, wrapWeakPersistent(this),

Powered by Google App Engine
This is Rietveld 408576698