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(); |