Chromium Code Reviews| 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 baa7be212caa72df4b93ed3c77bf24acfc2be9a3..ea0a9199393487883fbd7d0a361bf38766c5dfe8 100644 |
| --- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp |
| +++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp |
| @@ -129,7 +129,11 @@ void SensorProxy::updateSensorReading() { |
| } |
| } |
| - m_reading = readingData; |
| + if (m_reading.timestamp != readingData.timestamp) { |
| + m_reading = readingData; |
| + for (Observer* observer : m_observers) |
|
haraken
2017/03/27 09:59:38
Don't you need to copy the observers before starti
Mikhail
2017/03/27 10:04:01
This callback will not cause invokes of JS handler
|
| + observer->onSensorReadingChanged(); |
| + } |
| } |
| void SensorProxy::notifySensorChanged(double timestamp) { |
| @@ -137,7 +141,7 @@ void SensorProxy::notifySensorChanged(double timestamp) { |
| // we must cache m_observers as it can be modified within event handlers. |
| auto copy = m_observers; |
| for (Observer* observer : copy) |
| - observer->onSensorReadingChanged(timestamp); |
| + observer->notifySensorChanged(timestamp); |
| } |
| void SensorProxy::RaiseError() { |