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

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.h

Issue 2746573002: [Sensors] Implement bindings for AbsoluteOrientationSensor (Closed)
Patch Set: Comments from Alex Created 3 years, 9 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/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;

Powered by Google App Engine
This is Rietveld 408576698