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/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
10 #include "modules/vr/NavigatorVR.h" | 11 #include "modules/vr/NavigatorVR.h" |
11 #include "modules/vr/VRController.h" | 12 #include "modules/vr/VRController.h" |
12 #include "modules/vr/VRDisplayCapabilities.h" | 13 #include "modules/vr/VRDisplayCapabilities.h" |
13 #include "modules/vr/VREyeParameters.h" | 14 #include "modules/vr/VREyeParameters.h" |
14 #include "modules/vr/VRFrameData.h" | 15 #include "modules/vr/VRFrameData.h" |
15 #include "modules/vr/VRLayer.h" | 16 #include "modules/vr/VRLayer.h" |
16 #include "modules/vr/VRPose.h" | 17 #include "modules/vr/VRPose.h" |
17 #include "modules/vr/VRStageParameters.h" | 18 #include "modules/vr/VRStageParameters.h" |
18 #include "modules/webgl/WebGLRenderingContextBase.h" | 19 #include "modules/webgl/WebGLRenderingContextBase.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return false; | 91 return false; |
91 | 92 |
92 if (m_depthNear == m_depthFar) | 93 if (m_depthNear == m_depthFar) |
93 return false; | 94 return false; |
94 | 95 |
95 return frameData->update(m_framePose, m_eyeParametersLeft, m_eyeParametersRi
ght, m_depthNear, m_depthFar); | 96 return frameData->update(m_framePose, m_eyeParametersLeft, m_eyeParametersRi
ght, m_depthNear, m_depthFar); |
96 } | 97 } |
97 | 98 |
98 VRPose* VRDisplay::getPose() | 99 VRPose* VRDisplay::getPose() |
99 { | 100 { |
| 101 Document* document = m_navigatorVR->document(); |
| 102 if (document) |
| 103 UseCounter::count(*document, UseCounter::VRDeprecatedGetPose); |
| 104 |
100 updatePose(); | 105 updatePose(); |
101 | 106 |
102 if (!m_framePose) | 107 if (!m_framePose) |
103 return nullptr; | 108 return nullptr; |
104 | 109 |
105 VRPose* pose = VRPose::create(); | 110 VRPose* pose = VRPose::create(); |
106 pose->setPose(m_framePose); | 111 pose->setPose(m_framePose); |
107 return pose; | 112 return pose; |
108 } | 113 } |
109 | 114 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 forceExitPresent(); | 253 forceExitPresent(); |
249 DOMException* exception = DOMException::create(InvalidStateError, "VR Pr
esentation not implemented for this VRDisplay."); | 254 DOMException* exception = DOMException::create(InvalidStateError, "VR Pr
esentation not implemented for this VRDisplay."); |
250 resolver->reject(exception); | 255 resolver->reject(exception); |
251 return; | 256 return; |
252 } | 257 } |
253 | 258 |
254 m_isPresenting = true; | 259 m_isPresenting = true; |
255 | 260 |
256 updateLayerBounds(); | 261 updateLayerBounds(); |
257 | 262 |
| 263 Document* document = m_navigatorVR->document(); |
| 264 if (document) |
| 265 UseCounter::count(*document, UseCounter::VRPresent); |
| 266 |
258 resolver->resolve(); | 267 resolver->resolve(); |
259 m_navigatorVR->fireVRDisplayPresentChange(this); | 268 m_navigatorVR->fireVRDisplayPresentChange(this); |
260 } | 269 } |
261 | 270 |
262 void VRDisplay::forceExitPresent() | 271 void VRDisplay::forceExitPresent() |
263 { | 272 { |
264 if (m_isPresenting) { | 273 if (m_isPresenting) { |
265 if (!m_capabilities->hasExternalDisplay()) { | 274 if (!m_capabilities->hasExternalDisplay()) { |
266 Fullscreen::fullyExitFullscreen(m_layer.source()->document()); | 275 Fullscreen::fullyExitFullscreen(m_layer.source()->document()); |
267 m_fullscreenCheckTimer.stop(); | 276 m_fullscreenCheckTimer.stop(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 { | 354 { |
346 visitor->trace(m_navigatorVR); | 355 visitor->trace(m_navigatorVR); |
347 visitor->trace(m_capabilities); | 356 visitor->trace(m_capabilities); |
348 visitor->trace(m_stageParameters); | 357 visitor->trace(m_stageParameters); |
349 visitor->trace(m_eyeParametersLeft); | 358 visitor->trace(m_eyeParametersLeft); |
350 visitor->trace(m_eyeParametersRight); | 359 visitor->trace(m_eyeParametersRight); |
351 visitor->trace(m_layer); | 360 visitor->trace(m_layer); |
352 } | 361 } |
353 | 362 |
354 } // namespace blink | 363 } // namespace blink |
OLD | NEW |