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

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

Issue 2644873002: [Sensors] Fix reading updates after page refresh (Closed)
Patch Set: Created 3 years, 11 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/SensorReadingUpdater.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
index 3d35f7da1f8c0a31755ddbe5f2056c1113818b68..88e9b91c66c96558da421f2c4653981985f470b1 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
@@ -22,14 +22,21 @@ void SensorReadingUpdater::enqueueAnimationFrameTask() {
auto callback = WTF::bind(&SensorReadingUpdater::onAnimationFrame,
shalamov 2017/01/20 09:25:32 can be moved inside if (...)
Mikhail 2017/01/24 12:00:18 Done.
wrapWeakPersistent(this));
- m_sensorProxy->document()->enqueueAnimationFrameTask(std::move(callback));
- m_hasPendingAnimationFrameTask = true;
+ auto document = m_sensorProxy->document();
+ if (document) {
+ document->enqueueAnimationFrameTask(std::move(callback));
+ m_hasPendingAnimationFrameTask = true;
+ }
}
void SensorReadingUpdater::start() {
enqueueAnimationFrameTask();
}
+void SensorReadingUpdater::reset() {
+ m_hasPendingAnimationFrameTask = false;
haraken 2017/01/19 13:57:28 Would you help me understand why you need to set i
shalamov 2017/01/20 09:25:33 haraken@ is right, looks like if task was enqueued
Mikhail 2017/01/24 12:00:18 I thought it as just a "reset" of the internal sta
+}
+
void SensorReadingUpdater::onAnimationFrame() {
m_hasPendingAnimationFrameTask = false;
onAnimationFrameInternal();

Powered by Google App Engine
This is Rietveld 408576698