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 #ifndef VRDisplay_h | 5 #ifndef VRDisplay_h |
6 #define VRDisplay_h | 6 #define VRDisplay_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "core/dom/ActiveDOMObject.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/FrameRequestCallback.h" | 10 #include "core/dom/FrameRequestCallback.h" |
11 #include "core/events/EventTarget.h" | |
11 #include "device/vr/vr_service.mojom-blink.h" | 12 #include "device/vr/vr_service.mojom-blink.h" |
12 #include "modules/vr/VRDisplayCapabilities.h" | 13 #include "modules/vr/VRDisplayCapabilities.h" |
13 #include "modules/vr/VRLayer.h" | 14 #include "modules/vr/VRLayer.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "platform/Timer.h" | 16 #include "platform/Timer.h" |
16 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
17 #include "public/platform/WebGraphicsContext3DProvider.h" | 18 #include "public/platform/WebGraphicsContext3DProvider.h" |
18 #include "wtf/Forward.h" | 19 #include "wtf/Forward.h" |
19 #include "wtf/text/WTFString.h" | 20 #include "wtf/text/WTFString.h" |
20 | 21 |
(...skipping 10 matching lines...) Expand all Loading... | |
31 class VRController; | 32 class VRController; |
32 class VREyeParameters; | 33 class VREyeParameters; |
33 class VRFrameData; | 34 class VRFrameData; |
34 class VRStageParameters; | 35 class VRStageParameters; |
35 class VRPose; | 36 class VRPose; |
36 | 37 |
37 class WebGLRenderingContextBase; | 38 class WebGLRenderingContextBase; |
38 | 39 |
39 enum VREye { VREyeNone, VREyeLeft, VREyeRight }; | 40 enum VREye { VREyeNone, VREyeLeft, VREyeRight }; |
40 | 41 |
41 class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>, | 42 class VRDisplay final : public EventTargetWithInlineData, |
42 public device::mojom::blink::VRDisplayClient, | 43 public ActiveScriptWrappable, |
43 public ScriptWrappable { | 44 public ActiveDOMObject, |
45 public device::mojom::blink::VRDisplayClient { | |
44 DEFINE_WRAPPERTYPEINFO(); | 46 DEFINE_WRAPPERTYPEINFO(); |
47 USING_GARBAGE_COLLECTED_MIXIN(VRDisplay); | |
45 USING_PRE_FINALIZER(VRDisplay, dispose); | 48 USING_PRE_FINALIZER(VRDisplay, dispose); |
46 | 49 |
47 public: | 50 public: |
48 ~VRDisplay(); | 51 ~VRDisplay(); |
49 | 52 |
50 unsigned displayId() const { return m_displayId; } | 53 unsigned displayId() const { return m_displayId; } |
51 const String& displayName() const { return m_displayName; } | 54 const String& displayName() const { return m_displayName; } |
52 | 55 |
53 VRDisplayCapabilities* capabilities() const { return m_capabilities; } | 56 VRDisplayCapabilities* capabilities() const { return m_capabilities; } |
54 VRStageParameters* stageParameters() const { return m_stageParameters; } | 57 VRStageParameters* stageParameters() const { return m_stageParameters; } |
(...skipping 17 matching lines...) Expand all Loading... | |
72 void cancelAnimationFrame(int id); | 75 void cancelAnimationFrame(int id); |
73 void serviceScriptedAnimations(double monotonicAnimationStartTime); | 76 void serviceScriptedAnimations(double monotonicAnimationStartTime); |
74 | 77 |
75 ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers); | 78 ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers); |
76 ScriptPromise exitPresent(ScriptState*); | 79 ScriptPromise exitPresent(ScriptState*); |
77 | 80 |
78 HeapVector<VRLayer> getLayers(); | 81 HeapVector<VRLayer> getLayers(); |
79 | 82 |
80 void submitFrame(); | 83 void submitFrame(); |
81 | 84 |
85 // EventTarget overrides: | |
86 ExecutionContext* getExecutionContext() const override; | |
87 const AtomicString& interfaceName() const override; | |
88 | |
89 // ActiveDOMObject implementation. | |
90 void suspend() override; | |
91 void resume() override; | |
haraken
2016/11/29 01:43:28
Do you really want to implement suspend/resume? Ot
| |
92 void contextDestroyed() override; | |
93 | |
94 // ScriptWrappable implementation. | |
95 bool hasPendingActivity() const final; | |
96 | |
82 DECLARE_VIRTUAL_TRACE(); | 97 DECLARE_VIRTUAL_TRACE(); |
83 | 98 |
84 protected: | 99 protected: |
85 friend class VRController; | 100 friend class VRController; |
86 | 101 |
87 VRDisplay(NavigatorVR*, | 102 VRDisplay(NavigatorVR*, |
88 device::mojom::blink::VRDisplayPtr, | 103 device::mojom::blink::VRDisplayPtr, |
89 device::mojom::blink::VRDisplayClientRequest); | 104 device::mojom::blink::VRDisplayClientRequest); |
90 | 105 |
91 void update(const device::mojom::blink::VRDisplayInfoPtr&); | 106 void update(const device::mojom::blink::VRDisplayInfoPtr&); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 ServiceInactive = 11, | 184 ServiceInactive = 11, |
170 RequestDenied = 12, | 185 RequestDenied = 12, |
171 PresentationResultMax, // Must be last member of enum. | 186 PresentationResultMax, // Must be last member of enum. |
172 }; | 187 }; |
173 | 188 |
174 void ReportPresentationResult(PresentationResult); | 189 void ReportPresentationResult(PresentationResult); |
175 | 190 |
176 } // namespace blink | 191 } // namespace blink |
177 | 192 |
178 #endif // VRDisplay_h | 193 #endif // VRDisplay_h |
OLD | NEW |