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

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

Issue 2317743002: [Sensors] Implementation of the Generic Sensor API (Closed)
Patch Set: Comments from Tim and haraken Created 4 years, 3 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..2eaf7e6a177db48e75962b885ee31ae8b643de3d 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReading.h
+++ b/third_party/WebKit/Source/modules/sensor/SensorReading.h
@@ -8,38 +8,31 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/DOMHighResTimeStamp.h"
#include "core/dom/DOMTimeStamp.h"
-#include "modules/ModulesExport.h"
+#include "modules/sensor/SensorProxy.h"
namespace blink {
-class MODULES_EXPORT SensorReading : public GarbageCollectedFinalized<SensorReading>, public ScriptWrappable {
- DEFINE_WRAPPERTYPEINFO();
+class ExecutionContext;
+class ScriptState;
+class 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();
-
- DOMHighResTimeStamp timeStamp(bool& isNull);
+ DECLARE_VIRTUAL_TRACE();
- void setTimeStamp(DOMHighResTimeStamp time) { m_timeStamp = time; }
+ DOMHighResTimeStamp timeStamp(ScriptState*) const;
- DECLARE_VIRTUAL_TRACE();
+ // Returns 'true' if the current reading value is different than the given
+ // previous one; otherwise returns 'false'.
+ virtual bool isReadingUpdated(const SensorProxy::Reading& previous) const = 0;
protected:
- bool m_canProvideTimeStamp;
- DOMHighResTimeStamp m_timeStamp;
+ explicit SensorReading(SensorProxy*);
- SensorReading();
- SensorReading(bool providesTimeStamp, DOMHighResTimeStamp timestamp);
+protected:
+ Member<SensorProxy> m_sensorProxy;
};
} // namepsace blink

Powered by Google App Engine
This is Rietveld 408576698