| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SensorReading_h | 5 #ifndef SensorReading_h |
| 6 #define SensorReading_h | 6 #define SensorReading_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/dom/DOMHighResTimeStamp.h" | 9 #include "core/dom/DOMHighResTimeStamp.h" |
| 10 #include "core/dom/DOMTimeStamp.h" | 10 #include "core/dom/DOMTimeStamp.h" |
| 11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class MODULES_EXPORT SensorReading : public GarbageCollectedFinalized<SensorRead
ing>, public ScriptWrappable { | 15 class ExecutionContext; |
| 16 class SensorProxy; |
| 17 |
| 18 class MODULES_EXPORT SensorReading |
| 19 : public GarbageCollected<SensorReading> |
| 20 , public ScriptWrappable { |
| 16 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
| 17 | |
| 18 public: | 22 public: |
| 19 static SensorReading* create() | |
| 20 { | |
| 21 return new SensorReading; | |
| 22 } | |
| 23 | |
| 24 static SensorReading* create(bool providesTimeStamp, DOMHighResTimeStamp tim
estamp) | |
| 25 { | |
| 26 return new SensorReading(providesTimeStamp, timestamp); | |
| 27 } | |
| 28 | |
| 29 virtual ~SensorReading(); | |
| 30 | |
| 31 DOMHighResTimeStamp timeStamp(bool& isNull); | |
| 32 | |
| 33 void setTimeStamp(DOMHighResTimeStamp time) { m_timeStamp = time; } | |
| 34 | |
| 35 DECLARE_VIRTUAL_TRACE(); | 23 DECLARE_VIRTUAL_TRACE(); |
| 36 | 24 |
| 25 DOMHighResTimeStamp timeStamp() const; |
| 26 |
| 27 enum UpdateStatus { |
| 28 Updated, |
| 29 Error, |
| 30 Same |
| 31 }; |
| 32 virtual UpdateStatus updateInternalData() = 0; |
| 33 |
| 34 void attach(SensorProxy*); |
| 35 void detach(); |
| 36 |
| 37 protected: | 37 protected: |
| 38 bool m_canProvideTimeStamp; | 38 explicit SensorReading(ExecutionContext*); |
| 39 DOMHighResTimeStamp m_timeStamp; | 39 // Returns timestamp obtained from the shared buffer. |
| 40 virtual double platformTimeStamp() const = 0; |
| 40 | 41 |
| 41 SensorReading(); | 42 protected: |
| 42 SensorReading(bool providesTimeStamp, DOMHighResTimeStamp timestamp); | 43 WeakMember<SensorProxy> m_sensorProxy; |
| 44 WeakMember<ExecutionContext> m_context; |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 } // namepsace blink | 47 } // namepsace blink |
| 46 | 48 |
| 47 #endif // SensorReading_h | 49 #endif // SensorReading_h |
| OLD | NEW |