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/vr/VRDisplay.h" | 5 #include "modules/vr/VRDisplay.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/Fullscreen.h" | 8 #include "core/dom/Fullscreen.h" |
9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void VRDisplay::cancelAnimationFrame(int id) { | 144 void VRDisplay::cancelAnimationFrame(int id) { |
145 if (Document* document = m_navigatorVR->document()) | 145 if (Document* document = m_navigatorVR->document()) |
146 document->cancelAnimationFrame(id); | 146 document->cancelAnimationFrame(id); |
147 } | 147 } |
148 | 148 |
149 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, | 149 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, |
150 const HeapVector<VRLayer>& layers) { | 150 const HeapVector<VRLayer>& layers) { |
151 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 151 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
152 ScriptPromise promise = resolver->promise(); | 152 ScriptPromise promise = resolver->promise(); |
153 | 153 |
154 // If the VRDisplay does not advertise the ability to present reject the reque
st. | 154 // If the VRDisplay does not advertise the ability to present reject the |
| 155 // request. |
155 if (!m_capabilities->canPresent()) { | 156 if (!m_capabilities->canPresent()) { |
156 DOMException* exception = | 157 DOMException* exception = |
157 DOMException::create(InvalidStateError, "VRDisplay cannot present."); | 158 DOMException::create(InvalidStateError, "VRDisplay cannot present."); |
158 resolver->reject(exception); | 159 resolver->reject(exception); |
159 return promise; | 160 return promise; |
160 } | 161 } |
161 | 162 |
162 bool firstPresent = !m_isPresenting; | 163 bool firstPresent = !m_isPresenting; |
163 | 164 |
164 // Initiating VR presentation is only allowed in response to a user gesture. | 165 // Initiating VR presentation is only allowed in response to a user gesture. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 DEFINE_TRACE(VRDisplay) { | 365 DEFINE_TRACE(VRDisplay) { |
365 visitor->trace(m_navigatorVR); | 366 visitor->trace(m_navigatorVR); |
366 visitor->trace(m_capabilities); | 367 visitor->trace(m_capabilities); |
367 visitor->trace(m_stageParameters); | 368 visitor->trace(m_stageParameters); |
368 visitor->trace(m_eyeParametersLeft); | 369 visitor->trace(m_eyeParametersLeft); |
369 visitor->trace(m_eyeParametersRight); | 370 visitor->trace(m_eyeParametersRight); |
370 visitor->trace(m_layer); | 371 visitor->trace(m_layer); |
371 } | 372 } |
372 | 373 |
373 } // namespace blink | 374 } // namespace blink |
OLD | NEW |