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/css/StylePropertySet.h" | 7 #include "core/css/StylePropertySet.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/dom/DocumentUserGestureToken.h" | 9 #include "core/dom/DocumentUserGestureToken.h" |
10 #include "core/dom/FrameRequestCallback.h" | 10 #include "core/dom/FrameRequestCallback.h" |
11 #include "core/dom/Fullscreen.h" | 11 #include "core/dom/Fullscreen.h" |
12 #include "core/dom/ScriptedAnimationController.h" | 12 #include "core/dom/ScriptedAnimationController.h" |
13 #include "core/frame/UseCounter.h" | 13 #include "core/frame/UseCounter.h" |
14 #include "core/inspector/ConsoleMessage.h" | 14 #include "core/inspector/ConsoleMessage.h" |
15 #include "gpu/command_buffer/client/gles2_interface.h" | 15 #include "gpu/command_buffer/client/gles2_interface.h" |
16 #include "modules/EventTargetModules.h" | |
16 #include "modules/vr/NavigatorVR.h" | 17 #include "modules/vr/NavigatorVR.h" |
17 #include "modules/vr/VRController.h" | 18 #include "modules/vr/VRController.h" |
18 #include "modules/vr/VRDisplayCapabilities.h" | 19 #include "modules/vr/VRDisplayCapabilities.h" |
19 #include "modules/vr/VREyeParameters.h" | 20 #include "modules/vr/VREyeParameters.h" |
20 #include "modules/vr/VRFrameData.h" | 21 #include "modules/vr/VRFrameData.h" |
21 #include "modules/vr/VRLayer.h" | 22 #include "modules/vr/VRLayer.h" |
22 #include "modules/vr/VRPose.h" | 23 #include "modules/vr/VRPose.h" |
23 #include "modules/vr/VRStageParameters.h" | 24 #include "modules/vr/VRStageParameters.h" |
24 #include "modules/webgl/WebGLRenderingContextBase.h" | 25 #include "modules/webgl/WebGLRenderingContextBase.h" |
25 #include "platform/Histogram.h" | 26 #include "platform/Histogram.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
55 } | 56 } |
56 | 57 |
57 Member<VRDisplay> m_vrDisplay; | 58 Member<VRDisplay> m_vrDisplay; |
58 }; | 59 }; |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
62 VRDisplay::VRDisplay(NavigatorVR* navigatorVR, | 63 VRDisplay::VRDisplay(NavigatorVR* navigatorVR, |
63 device::mojom::blink::VRDisplayPtr display, | 64 device::mojom::blink::VRDisplayPtr display, |
64 device::mojom::blink::VRDisplayClientRequest request) | 65 device::mojom::blink::VRDisplayClientRequest request) |
65 : m_navigatorVR(navigatorVR), | 66 : ActiveScriptWrappable(this), |
67 ActiveDOMObject(navigatorVR->document()), | |
68 m_navigatorVR(navigatorVR), | |
66 m_isConnected(false), | 69 m_isConnected(false), |
67 m_isPresenting(false), | 70 m_isPresenting(false), |
68 m_canUpdateFramePose(true), | 71 m_canUpdateFramePose(true), |
69 m_capabilities(new VRDisplayCapabilities()), | 72 m_capabilities(new VRDisplayCapabilities()), |
70 m_eyeParametersLeft(new VREyeParameters()), | 73 m_eyeParametersLeft(new VREyeParameters()), |
71 m_eyeParametersRight(new VREyeParameters()), | 74 m_eyeParametersRight(new VREyeParameters()), |
72 m_depthNear(0.01), | 75 m_depthNear(0.01), |
73 m_depthFar(10000.0), | 76 m_depthFar(10000.0), |
74 m_fullscreenCheckTimer(this, &VRDisplay::onFullscreenCheck), | 77 m_fullscreenCheckTimer(this, &VRDisplay::onFullscreenCheck), |
75 m_contextGL(nullptr), | 78 m_contextGL(nullptr), |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
659 if (!m_scriptedAnimationController) | 662 if (!m_scriptedAnimationController) |
660 m_scriptedAnimationController = ScriptedAnimationController::create(doc); | 663 m_scriptedAnimationController = ScriptedAnimationController::create(doc); |
661 | 664 |
662 return *m_scriptedAnimationController; | 665 return *m_scriptedAnimationController; |
663 } | 666 } |
664 | 667 |
665 void VRDisplay::dispose() { | 668 void VRDisplay::dispose() { |
666 m_binding.Close(); | 669 m_binding.Close(); |
667 } | 670 } |
668 | 671 |
672 ExecutionContext* VRDisplay::getExecutionContext() const { | |
673 return ContextLifecycleObserver::getExecutionContext(); | |
bajones
2016/11/29 00:15:44
Seems more common in objects that derive from Acti
| |
674 } | |
675 | |
676 const AtomicString& VRDisplay::interfaceName() const { | |
677 return EventTargetNames::VRDisplay; | |
678 } | |
679 | |
680 void VRDisplay::suspend() { | |
681 // TODO(xing.xu): Implement suspend. | |
682 } | |
683 | |
684 void VRDisplay::resume() { | |
685 // TODO(xing.xu): Implement resume. | |
686 } | |
687 | |
688 void VRDisplay::contextDestroyed() { | |
689 // TODO(xing.xu): Implement destory. Such as forceExitPresent(). | |
bajones
2016/11/29 00:15:44
Minor typo here ("destory" -> "destroy") but rathe
haraken
2016/11/29 01:43:28
If you're not sure what to do in contextDestroyed,
mlamouri (slow - plz ping)
2016/12/01 10:10:06
+1, it sounds that you dan't have a need for the o
| |
690 } | |
691 | |
692 bool VRDisplay::hasPendingActivity() const { | |
693 // Prevent V8 from garbage collecting the wrapper object if there are | |
694 // event listeners attached to it. | |
695 return hasEventListeners(); | |
696 } | |
697 | |
669 DEFINE_TRACE(VRDisplay) { | 698 DEFINE_TRACE(VRDisplay) { |
699 EventTargetWithInlineData::trace(visitor); | |
700 ActiveDOMObject::trace(visitor); | |
670 visitor->trace(m_navigatorVR); | 701 visitor->trace(m_navigatorVR); |
671 visitor->trace(m_capabilities); | 702 visitor->trace(m_capabilities); |
672 visitor->trace(m_stageParameters); | 703 visitor->trace(m_stageParameters); |
673 visitor->trace(m_eyeParametersLeft); | 704 visitor->trace(m_eyeParametersLeft); |
674 visitor->trace(m_eyeParametersRight); | 705 visitor->trace(m_eyeParametersRight); |
675 visitor->trace(m_layer); | 706 visitor->trace(m_layer); |
676 visitor->trace(m_renderingContext); | 707 visitor->trace(m_renderingContext); |
677 visitor->trace(m_scriptedAnimationController); | 708 visitor->trace(m_scriptedAnimationController); |
678 } | 709 } |
679 | 710 |
680 } // namespace blink | 711 } // namespace blink |
OLD | NEW |