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