Chromium Code Reviews| 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() {} |
|
timvolodine
2016/11/07 15:49:19
why the change from DECLARE to DEFINE? is this int
haraken
2016/11/08 02:31:32
Now the trace method is empty, we can just inline
|
| 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 |