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

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

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comments from Alex 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: 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 add04b99327deacdb576b82b73261f851d955c05..d83362e6f5a58deefecac3aa770e43b7f9d79a31 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
@@ -20,7 +20,8 @@ SensorProxy::SensorProxy(SensorType sensorType, SensorProviderProxy* provider)
m_clientBinding(this),
m_state(SensorProxy::Uninitialized),
m_reading(),
- m_suspended(false) {}
+ m_suspended(false),
+ m_maximumFrequency(0.0) {}
SensorProxy::~SensorProxy() {}
@@ -98,6 +99,10 @@ const device::mojom::blink::SensorConfiguration* SensorProxy::defaultConfig()
return m_defaultConfig.get();
}
+double SensorProxy::maximumFrequency() const {
+ return m_maximumFrequency;
+}
+
void SensorProxy::updateInternalReading() {
DCHECK(isInitialized());
int readAttempts = 0;
@@ -168,6 +173,9 @@ void SensorProxy::onSensorCreated(SensorInitParamsPtr params,
return;
}
+ m_maximumFrequency = params->maximum_frequency;
+ DCHECK(m_maximumFrequency <= SensorConfiguration::kMaxAllowedFrequency);
+
auto errorCallback =
WTF::bind(&SensorProxy::handleSensorError, wrapWeakPersistent(this),
UnknownError, String("Internal error"), String());

Powered by Google App Engine
This is Rietveld 408576698