Chromium Code Reviews| 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/FrameRequestCallback.h" | 8 #include "core/dom/FrameRequestCallback.h" |
| 9 #include "core/dom/Fullscreen.h" | 9 #include "core/dom/Fullscreen.h" |
| 10 #include "core/dom/ScriptedAnimationController.h" | 10 #include "core/dom/ScriptedAnimationController.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 m_displayId(0), | 62 m_displayId(0), |
| 63 m_isConnected(false), | 63 m_isConnected(false), |
| 64 m_isPresenting(false), | 64 m_isPresenting(false), |
| 65 m_canUpdateFramePose(true), | 65 m_canUpdateFramePose(true), |
| 66 m_capabilities(new VRDisplayCapabilities()), | 66 m_capabilities(new VRDisplayCapabilities()), |
| 67 m_eyeParametersLeft(new VREyeParameters()), | 67 m_eyeParametersLeft(new VREyeParameters()), |
| 68 m_eyeParametersRight(new VREyeParameters()), | 68 m_eyeParametersRight(new VREyeParameters()), |
| 69 m_depthNear(0.01), | 69 m_depthNear(0.01), |
| 70 m_depthFar(10000.0), | 70 m_depthFar(10000.0), |
| 71 m_fullscreenCheckTimer(this, &VRDisplay::onFullscreenCheck), | 71 m_fullscreenCheckTimer(this, &VRDisplay::onFullscreenCheck), |
| 72 m_contextGL(nullptr), | |
| 72 m_animationCallbackRequested(false), | 73 m_animationCallbackRequested(false), |
| 73 m_inAnimationFrame(false) {} | 74 m_inAnimationFrame(false) {} |
| 74 | 75 |
| 75 VRDisplay::~VRDisplay() {} | 76 VRDisplay::~VRDisplay() {} |
| 76 | 77 |
| 77 VRController* VRDisplay::controller() { | 78 VRController* VRDisplay::controller() { |
| 78 return m_navigatorVR->controller(); | 79 return m_navigatorVR->controller(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void VRDisplay::update(const device::blink::VRDisplayPtr& display) { | 82 void VRDisplay::update(const device::blink::VRDisplayPtr& display) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 callback->m_useLegacyTimeBase = false; | 168 callback->m_useLegacyTimeBase = false; |
| 168 return ensureScriptedAnimationController(doc).registerCallback(callback); | 169 return ensureScriptedAnimationController(doc).registerCallback(callback); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void VRDisplay::cancelAnimationFrame(int id) { | 172 void VRDisplay::cancelAnimationFrame(int id) { |
| 172 if (!m_scriptedAnimationController) | 173 if (!m_scriptedAnimationController) |
| 173 return; | 174 return; |
| 174 m_scriptedAnimationController->cancelCallback(id); | 175 m_scriptedAnimationController->cancelCallback(id); |
| 175 } | 176 } |
| 176 | 177 |
| 178 void VRDisplay::pausePresent() { | |
| 179 Document* doc = m_navigatorVR->document(); | |
| 180 if (!doc) | |
| 181 return; | |
| 182 doc->suspendScheduledTasks(); | |
| 183 m_scriptedAnimationController->suspend(); | |
|
bajones
2016/11/01 18:11:31
This would be the perfect place to fire the "vrdis
mthiesse
2016/11/02 14:39:02
Done.
| |
| 184 } | |
| 185 | |
| 186 void VRDisplay::resumePresent() { | |
| 187 Document* doc = m_navigatorVR->document(); | |
| 188 if (!doc) | |
| 189 return; | |
| 190 m_scriptedAnimationController->resume(); | |
| 191 doc->resumeScheduledTasks(); | |
|
bajones
2016/11/01 18:11:31
Likewise, let's fire "vrdisplayfocus" here.
mthiesse
2016/11/02 14:39:02
Done.
| |
| 192 } | |
| 193 | |
| 177 void VRDisplay::serviceScriptedAnimations(double monotonicAnimationStartTime) { | 194 void VRDisplay::serviceScriptedAnimations(double monotonicAnimationStartTime) { |
| 178 if (!m_scriptedAnimationController) | 195 if (!m_scriptedAnimationController) |
| 179 return; | 196 return; |
| 180 AutoReset<bool> animating(&m_inAnimationFrame, true); | 197 AutoReset<bool> animating(&m_inAnimationFrame, true); |
| 181 m_animationCallbackRequested = false; | 198 m_animationCallbackRequested = false; |
| 182 m_scriptedAnimationController->serviceScriptedAnimations( | 199 m_scriptedAnimationController->serviceScriptedAnimations( |
| 183 monotonicAnimationStartTime); | 200 monotonicAnimationStartTime); |
| 184 } | 201 } |
| 185 | 202 |
| 186 void ReportPresentationResult(PresentationResult result) { | 203 void ReportPresentationResult(PresentationResult result) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 visitor->trace(m_capabilities); | 516 visitor->trace(m_capabilities); |
| 500 visitor->trace(m_stageParameters); | 517 visitor->trace(m_stageParameters); |
| 501 visitor->trace(m_eyeParametersLeft); | 518 visitor->trace(m_eyeParametersLeft); |
| 502 visitor->trace(m_eyeParametersRight); | 519 visitor->trace(m_eyeParametersRight); |
| 503 visitor->trace(m_layer); | 520 visitor->trace(m_layer); |
| 504 visitor->trace(m_renderingContext); | 521 visitor->trace(m_renderingContext); |
| 505 visitor->trace(m_scriptedAnimationController); | 522 visitor->trace(m_scriptedAnimationController); |
| 506 } | 523 } |
| 507 | 524 |
| 508 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |