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

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

Issue 2472403002: [Sensors] Align sensor reading attribute implementation with the specification (Closed)
Patch Set: Comments from Tim Created 4 years, 1 month 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 d32f384a8a43f9eccd6e8879b9b759c3b5e38a9b..49428124bfccfd450a623f067d10b292b1585e4b 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReading.h
+++ b/third_party/WebKit/Source/modules/sensor/SensorReading.h
@@ -19,21 +19,41 @@ class SensorReading : public GarbageCollectedFinalized<SensorReading>,
DEFINE_WRAPPERTYPEINFO();
public:
- DECLARE_VIRTUAL_TRACE();
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
DOMHighResTimeStamp timeStamp(ScriptState*) const;
// 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;
+ virtual bool isReadingUpdated(
+ const device::SensorReading& previous) const = 0;
+
+ const device::SensorReading& data() const { return m_data; }
virtual ~SensorReading();
protected:
- explicit SensorReading(SensorProxy*);
+ explicit SensorReading(const device::SensorReading&);
+
+ private:
+ device::SensorReading m_data;
+};
+
+class SensorReadingFactory {
+ public:
+ virtual SensorReading* createSensorReading(const device::SensorReading&) = 0;
protected:
- Member<SensorProxy> m_sensorProxy;
+ SensorReadingFactory() = default;
+};
+
+template <typename SensorReadingType>
+class SensorReadingFactoryImpl : public SensorReadingFactory {
+ public:
+ SensorReading* createSensorReading(
+ const device::SensorReading& reading) override {
+ return SensorReadingType::create(reading);
+ }
};
} // namepsace blink
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorProxy.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorReading.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698