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

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

Issue 2121313002: [sensors] Generic Sensors Framework blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sensors_mojo_interfaces
Patch Set: Rebased Created 4 years, 4 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/SensorReading.h
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReading.h b/third_party/WebKit/Source/modules/sensor/SensorReading.h
index 0796dfcdec4fa16b9fd6823083690ba18e726e0b..cc56835992d0e9efb80242497b1d2b7e6169ce6b 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReading.h
+++ b/third_party/WebKit/Source/modules/sensor/SensorReading.h
@@ -12,34 +12,36 @@
namespace blink {
-class MODULES_EXPORT SensorReading : public GarbageCollectedFinalized<SensorReading>, public ScriptWrappable {
- DEFINE_WRAPPERTYPEINFO();
+class ExecutionContext;
+class SensorProxy;
+class MODULES_EXPORT SensorReading
+ : public GarbageCollected<SensorReading>
+ , public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
public:
- static SensorReading* create()
- {
- return new SensorReading;
- }
-
- static SensorReading* create(bool providesTimeStamp, DOMHighResTimeStamp timestamp)
- {
- return new SensorReading(providesTimeStamp, timestamp);
- }
-
- virtual ~SensorReading();
+ DECLARE_VIRTUAL_TRACE();
- DOMHighResTimeStamp timeStamp(bool& isNull);
+ DOMHighResTimeStamp timeStamp() const;
- void setTimeStamp(DOMHighResTimeStamp time) { m_timeStamp = time; }
+ enum UpdateStatus {
+ Updated,
+ Error,
+ Same
+ };
+ virtual UpdateStatus updateInternalData() = 0;
- DECLARE_VIRTUAL_TRACE();
+ void attach(SensorProxy*);
+ void detach();
protected:
- bool m_canProvideTimeStamp;
- DOMHighResTimeStamp m_timeStamp;
+ explicit SensorReading(ExecutionContext*);
+ // Returns timestamp obtained from the shared buffer.
+ virtual double platformTimeStamp() const = 0;
- SensorReading();
- SensorReading(bool providesTimeStamp, DOMHighResTimeStamp timestamp);
+protected:
+ WeakMember<SensorProxy> m_sensorProxy;
+ WeakMember<ExecutionContext> m_context;
};
} // namepsace blink

Powered by Google App Engine
This is Rietveld 408576698