OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "modules/sensor/SensorReading.h" | |
6 | |
7 #include "core/dom/ExecutionContext.h" | |
8 #include "core/frame/LocalDOMWindow.h" | |
9 #include "core/timing/DOMWindowPerformance.h" | |
10 #include "core/timing/Performance.h" | |
11 | |
12 namespace blink { | |
13 | |
14 SensorReading::SensorReading(const device::SensorReading& data) | |
15 : m_data(data) {} | |
16 | |
17 SensorReading::~SensorReading() = default; | |
18 | |
19 DOMHighResTimeStamp SensorReading::timeStamp(ScriptState* scriptState) const { | |
20 LocalDOMWindow* window = scriptState->domWindow(); | |
21 if (!window) | |
22 return 0.0; | |
23 | |
24 Performance* performance = DOMWindowPerformance::performance(*window); | |
25 DCHECK(performance); | |
26 | |
27 return performance->monotonicTimeToDOMHighResTimeStamp(data().timestamp); | |
28 } | |
29 | |
30 } // namespace blink | |
OLD | NEW |