Index: third_party/WebKit/Source/modules/sensor/SensorReading.cpp |
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp |
index 9eb63d020623789918c2b59697b9332bb8155687..12c14881bc9af7be3a74f93e364ea500abd8c641 100644 |
--- a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp |
+++ b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp |
@@ -4,33 +4,34 @@ |
#include "modules/sensor/SensorReading.h" |
+#include "core/dom/ExecutionContext.h" |
+#include "core/frame/LocalDOMWindow.h" |
+#include "core/timing/DOMWindowPerformance.h" |
+#include "core/timing/Performance.h" |
+ |
namespace blink { |
-SensorReading::SensorReading() |
+SensorReading::SensorReading(SensorProxy* sensorProxy) |
+ : m_sensorProxy(sensorProxy) |
{ |
+ DCHECK(m_sensorProxy); |
} |
-SensorReading::SensorReading(bool providesTimeStamp, DOMHighResTimeStamp timeStamp) |
- : m_canProvideTimeStamp(providesTimeStamp) |
- , m_timeStamp(timeStamp) |
+DEFINE_TRACE(SensorReading) |
{ |
+ visitor->trace(m_sensorProxy); |
} |
-DOMHighResTimeStamp SensorReading::timeStamp(bool& isNull) |
+DOMHighResTimeStamp SensorReading::timeStamp(ScriptState* scriptState) const |
{ |
- if (m_canProvideTimeStamp) |
- return m_timeStamp; |
- |
- isNull = true; |
- return 0; |
-} |
+ LocalDOMWindow* window = scriptState->domWindow(); |
+ if (!window) |
+ return 0.0; |
-SensorReading::~SensorReading() |
-{ |
-} |
+ Performance* performance = DOMWindowPerformance::performance(*window); |
+ DCHECK(performance); |
-DEFINE_TRACE(SensorReading) |
-{ |
+ return performance->monotonicTimeToDOMHighResTimeStamp(m_sensorProxy->reading().timestamp); |
} |
} // namespace blink |