Chromium Code Reviews| Index: third_party/WebKit/Source/modules/sensor/SensorProxy.h |
| diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.h b/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
| index 65baab79d07007162208214bb48d54b5a0d7c56b..8a2f53159b519427fdbc95a4caa8566ddcd327c1 100644 |
| --- a/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
| +++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
| @@ -31,18 +31,25 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
| WTF_MAKE_NONCOPYABLE(SensorProxy); |
| public: |
| - class Observer : public GarbageCollectedMixin { |
| + class Client : public GarbageCollectedMixin { |
|
Reilly Grant (use Gerrit)
2017/03/24 15:10:33
Why rename this? It is an observer.
Mikhail
2017/03/24 16:30:31
Agree, the newly added method is actually notifica
|
| public: |
| // Has valid 'Sensor' binding, {add, remove}Configuration() |
| // methods can be called. |
| virtual void onSensorInitialized() {} |
| // Platfrom sensort reading has changed. |
|
Reilly Grant (use Gerrit)
2017/03/24 15:10:33
sensort -> sensor
Mikhail
2017/03/24 16:30:31
Done.
|
| + virtual void onSensorReadingChanged() {} |
| + // Client should send 'onchange' event if needed. |
| + // The 'notifySensorChanged' calls are in sync with rAF. |
| + // Currently, we decide whether to send 'onchange' event based on the |
| + // time elapsed from the previous notification. |
| + // TODO: Reconsider this after https://github.com/w3c/sensors/issues/152 |
| + // is resolved. |
| // |timestamp| Reference timestamp in seconds of the moment when |
| // sensor reading was updated from the buffer. |
| // Note: |timestamp| values are only used to calculate elapsed time |
| // between shared buffer readings. These values *do not* correspond |
| // to sensor reading timestamps which are obtained on platform side. |
| - virtual void onSensorReadingChanged(double timestamp) {} |
| + virtual void notifySensorChanged(double timestamp) {} |
| // An error has occurred. |
| virtual void onSensorError(ExceptionCode, |
| const String& sanitizedMessage, |
| @@ -53,8 +60,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
| void dispose(); |
| - void addObserver(Observer*); |
| - void removeObserver(Observer*); |
| + void addClient(Client*); |
| + void removeClient(Client*); |
| void initialize(); |
| @@ -127,8 +134,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
| device::mojom::blink::SensorType m_type; |
| device::mojom::blink::ReportingMode m_mode; |
| Member<SensorProviderProxy> m_provider; |
| - using ObserversSet = HeapHashSet<WeakMember<Observer>>; |
| - ObserversSet m_observers; |
| + using ClientsSet = HeapHashSet<WeakMember<Client>>; |
| + ClientsSet m_clients; |
| device::mojom::blink::SensorPtr m_sensor; |
| device::mojom::blink::SensorConfigurationPtr m_defaultConfig; |