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

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

Issue 2644873002: [Sensors] Fix reading updates after page refresh (Closed)
Patch Set: Review comments 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
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.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/SensorReadingUpdater.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
index 3d35f7da1f8c0a31755ddbe5f2056c1113818b68..7660de6b7b7ed2524231e1f04c8f4970e74e23ac 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.cpp
@@ -17,12 +17,21 @@ SensorReadingUpdater::SensorReadingUpdater(SensorProxy* sensorProxy)
: m_sensorProxy(sensorProxy), m_hasPendingAnimationFrameTask(false) {}
void SensorReadingUpdater::enqueueAnimationFrameTask() {
+ if (m_document != m_sensorProxy->document()) {
haraken 2017/01/24 21:19:14 This condition doesn't look correct to me. Note t
+ // If the document has expired the scheduled callbacks
+ // will never be called.
+ m_hasPendingAnimationFrameTask = false;
+ m_document = m_sensorProxy->document();
+ if (!m_document)
+ return;
+ }
+
if (m_hasPendingAnimationFrameTask)
return;
auto callback = WTF::bind(&SensorReadingUpdater::onAnimationFrame,
wrapWeakPersistent(this));
- m_sensorProxy->document()->enqueueAnimationFrameTask(std::move(callback));
+ m_document->enqueueAnimationFrameTask(std::move(callback));
m_hasPendingAnimationFrameTask = true;
}
@@ -36,6 +45,7 @@ void SensorReadingUpdater::onAnimationFrame() {
}
DEFINE_TRACE(SensorReadingUpdater) {
+ visitor->trace(m_document);
visitor->trace(m_sensorProxy);
}
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorReadingUpdater.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698