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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 return false; | 97 return false; |
98 | 98 |
99 if (m_depthNear == m_depthFar) | 99 if (m_depthNear == m_depthFar) |
100 return false; | 100 return false; |
101 | 101 |
102 return frameData->update(m_framePose, m_eyeParametersLeft, m_eyeParametersRi ght, m_depthNear, m_depthFar); | 102 return frameData->update(m_framePose, m_eyeParametersLeft, m_eyeParametersRi ght, m_depthNear, m_depthFar); |
103 } | 103 } |
104 | 104 |
105 VRPose* VRDisplay::getPose() | 105 VRPose* VRDisplay::getPose() |
106 { | 106 { |
107 Document* document = m_navigatorVR->document(); | |
108 if (document) | |
109 UseCounter::count(*document, UseCounter::VRDeprecatedGetPose); | |
amp
2016/10/05 20:43:14
Do we not need this counter anymore?
billorr
2016/10/05 21:01:03
I moved it to the IDL, so it will generate a depre
billorr
2016/10/05 22:47:55
Done.
| |
110 | |
111 updatePose(); | 107 updatePose(); |
112 | 108 |
113 if (!m_framePose) | 109 if (!m_framePose) |
114 return nullptr; | 110 return nullptr; |
115 | 111 |
116 VRPose* pose = VRPose::create(); | 112 VRPose* pose = VRPose::create(); |
117 pose->setPose(m_framePose); | 113 pose->setPose(m_framePose); |
118 return pose; | 114 return pose; |
119 } | 115 } |
120 | 116 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 } | 150 } |
155 | 151 |
156 void VRDisplay::cancelAnimationFrame(int id) | 152 void VRDisplay::cancelAnimationFrame(int id) |
157 { | 153 { |
158 if (Document* document = m_navigatorVR->document()) | 154 if (Document* document = m_navigatorVR->document()) |
159 document->cancelAnimationFrame(id); | 155 document->cancelAnimationFrame(id); |
160 } | 156 } |
161 | 157 |
162 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, const HeapVect or<VRLayer>& layers) | 158 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, const HeapVect or<VRLayer>& layers) |
163 { | 159 { |
160 ExecutionContext* executionContext = scriptState->getExecutionContext(); | |
161 String errorMessage; | |
162 if (executionContext->isSecureContext(errorMessage)) { | |
ddorwin
2016/10/05 21:32:43
ditto
billorr
2016/10/05 21:55:27
Acknowledged.
billorr
2016/10/05 22:47:55
Done.
| |
163 UseCounter::count(executionContext, UseCounter::VRRequestPresent); | |
164 } else { | |
165 UseCounter::count(executionContext, | |
166 UseCounter::VRRequestPresentInsecureOrigin); | |
167 } | |
168 | |
164 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | 169 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; |
165 ScriptPromise promise = resolver->promise(); | 170 ScriptPromise promise = resolver->promise(); |
166 | 171 |
167 // If the VRDisplay does not advertise the ability to present reject the req uest. | 172 // If the VRDisplay does not advertise the ability to present reject the req uest. |
168 if (!m_capabilities->canPresent()) { | 173 if (!m_capabilities->canPresent()) { |
169 DOMException* exception = DOMException::create(InvalidStateError, "VRDis play cannot present."); | 174 DOMException* exception = DOMException::create(InvalidStateError, "VRDis play cannot present."); |
170 resolver->reject(exception); | 175 resolver->reject(exception); |
171 return promise; | 176 return promise; |
172 } | 177 } |
173 | 178 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 { | 373 { |
369 visitor->trace(m_navigatorVR); | 374 visitor->trace(m_navigatorVR); |
370 visitor->trace(m_capabilities); | 375 visitor->trace(m_capabilities); |
371 visitor->trace(m_stageParameters); | 376 visitor->trace(m_stageParameters); |
372 visitor->trace(m_eyeParametersLeft); | 377 visitor->trace(m_eyeParametersLeft); |
373 visitor->trace(m_eyeParametersRight); | 378 visitor->trace(m_eyeParametersRight); |
374 visitor->trace(m_layer); | 379 visitor->trace(m_layer); |
375 } | 380 } |
376 | 381 |
377 } // namespace blink | 382 } // namespace blink |
OLD | NEW |