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

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

Issue 2323683002: [Sensors] Implement sensor data polling (Closed)
Patch Set: Applied Tim's suggestions Created 4 years, 3 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 7b84ebc67fd698dda12789e0dae0914b0348f5b0..0c14fb3e9cdc5eee8592b3ac471ead37735f1518 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
@@ -19,6 +19,7 @@ SensorProxy::SensorProxy(SensorType sensorType, SensorProviderProxy* provider)
, m_clientBinding(this)
, m_state(SensorProxy::Uninitialized)
, m_reading()
+ , m_suspended(false)
{
}
@@ -76,6 +77,26 @@ void SensorProxy::removeConfiguration(SensorConfigurationPtr configuration, std:
m_sensor->RemoveConfiguration(std::move(configuration), convertToBaseCallback(std::move(callback)));
}
+void SensorProxy::suspend()
+{
+ DCHECK(isInitialized());
+ if (m_suspended)
+ return;
+
+ m_sensor->Suspend();
+ m_suspended = true;
+}
+
+void SensorProxy::resume()
+{
+ DCHECK(isInitialized());
+ if (!m_suspended)
+ return;
+
+ m_sensor->Resume();
+ m_suspended = false;
+}
+
void SensorProxy::updateInternalReading()
{
DCHECK(isInitialized());
« 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