| 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 #include "modules/sensor/Sensor.h" | 5 #include "modules/sensor/Sensor.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return ToString(m_state); | 105 return ToString(m_state); |
| 106 } | 106 } |
| 107 | 107 |
| 108 DOMHighResTimeStamp Sensor::timestamp(ScriptState* scriptState, | 108 DOMHighResTimeStamp Sensor::timestamp(ScriptState* scriptState, |
| 109 bool& isNull) const { | 109 bool& isNull) const { |
| 110 if (!canReturnReadings()) { | 110 if (!canReturnReadings()) { |
| 111 isNull = true; | 111 isNull = true; |
| 112 return 0.0; | 112 return 0.0; |
| 113 } | 113 } |
| 114 | 114 |
| 115 LocalDOMWindow* window = scriptState->domWindow(); | 115 LocalDOMWindow* window = LocalDOMWindow::from(scriptState); |
| 116 if (!window) { | 116 if (!window) { |
| 117 isNull = true; | 117 isNull = true; |
| 118 return 0.0; | 118 return 0.0; |
| 119 } | 119 } |
| 120 | 120 |
| 121 Performance* performance = DOMWindowPerformance::performance(*window); | 121 Performance* performance = DOMWindowPerformance::performance(*window); |
| 122 DCHECK(performance); | 122 DCHECK(performance); |
| 123 DCHECK(m_sensorProxy); | 123 DCHECK(m_sensorProxy); |
| 124 isNull = false; | 124 isNull = false; |
| 125 | 125 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool Sensor::canReturnReadings() const { | 322 bool Sensor::canReturnReadings() const { |
| 323 if (!isActivated()) | 323 if (!isActivated()) |
| 324 return false; | 324 return false; |
| 325 DCHECK(m_sensorProxy); | 325 DCHECK(m_sensorProxy); |
| 326 return m_sensorProxy->reading().timestamp != 0.0; | 326 return m_sensorProxy->reading().timestamp != 0.0; |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |