Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRDisplay.h

Issue 2413903002: Allow VRDisplay to manage it's own rAF callbacks (Closed)
Patch Set: Address review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/ScriptWrappable.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 "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 "platform/Timer.h" 14 #include "platform/Timer.h"
15 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
16 #include "public/platform/WebGraphicsContext3DProvider.h" 16 #include "public/platform/WebGraphicsContext3DProvider.h"
17 #include "wtf/Forward.h" 17 #include "wtf/Forward.h"
18 #include "wtf/text/WTFString.h" 18 #include "wtf/text/WTFString.h"
19 19
20 namespace gpu { 20 namespace gpu {
21 namespace gles2 { 21 namespace gles2 {
22 class GLES2Interface; 22 class GLES2Interface;
23 } 23 }
24 } 24 }
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class NavigatorVR; 28 class NavigatorVR;
29 class ScriptedAnimationController;
29 class VRController; 30 class VRController;
30 class VREyeParameters; 31 class VREyeParameters;
31 class VRFrameData; 32 class VRFrameData;
32 class VRStageParameters; 33 class VRStageParameters;
33 class VRPose; 34 class VRPose;
34 35
35 class WebGLRenderingContextBase; 36 class WebGLRenderingContextBase;
36 37
37 enum VREye { VREyeNone, VREyeLeft, VREyeRight }; 38 enum VREye { VREyeNone, VREyeLeft, VREyeRight };
38 39
(...skipping 20 matching lines...) Expand all
59 double depthNear() const { return m_depthNear; } 60 double depthNear() const { return m_depthNear; }
60 double depthFar() const { return m_depthFar; } 61 double depthFar() const { return m_depthFar; }
61 62
62 void setDepthNear(double value) { m_depthNear = value; } 63 void setDepthNear(double value) { m_depthNear = value; }
63 void setDepthFar(double value) { m_depthFar = value; } 64 void setDepthFar(double value) { m_depthFar = value; }
64 65
65 VREyeParameters* getEyeParameters(const String&); 66 VREyeParameters* getEyeParameters(const String&);
66 67
67 int requestAnimationFrame(FrameRequestCallback*); 68 int requestAnimationFrame(FrameRequestCallback*);
68 void cancelAnimationFrame(int id); 69 void cancelAnimationFrame(int id);
70 void serviceScriptedAnimations(double monotonicAnimationStartTime);
69 71
70 ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers); 72 ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers);
71 ScriptPromise exitPresent(ScriptState*); 73 ScriptPromise exitPresent(ScriptState*);
72 74
73 HeapVector<VRLayer> getLayers(); 75 HeapVector<VRLayer> getLayers();
74 76
75 void submitFrame(); 77 void submitFrame();
76 78
77 DECLARE_VIRTUAL_TRACE(); 79 DECLARE_VIRTUAL_TRACE();
78 80
(...skipping 10 matching lines...) Expand all
89 void forceExitPresent(); 91 void forceExitPresent();
90 92
91 void updateLayerBounds(); 93 void updateLayerBounds();
92 void disconnected(); 94 void disconnected();
93 95
94 VRController* controller(); 96 VRController* controller();
95 97
96 private: 98 private:
97 void onFullscreenCheck(TimerBase*); 99 void onFullscreenCheck(TimerBase*);
98 100
101 ScriptedAnimationController& ensureScriptedAnimationController(Document*);
102
99 Member<NavigatorVR> m_navigatorVR; 103 Member<NavigatorVR> m_navigatorVR;
100 unsigned m_displayId; 104 unsigned m_displayId;
101 String m_displayName; 105 String m_displayName;
102 bool m_isConnected; 106 bool m_isConnected;
103 bool m_isPresenting; 107 bool m_isPresenting;
104 bool m_canUpdateFramePose; 108 bool m_canUpdateFramePose;
105 unsigned m_compositorHandle; 109 unsigned m_compositorHandle;
106 Member<VRDisplayCapabilities> m_capabilities; 110 Member<VRDisplayCapabilities> m_capabilities;
107 Member<VRStageParameters> m_stageParameters; 111 Member<VRStageParameters> m_stageParameters;
108 Member<VREyeParameters> m_eyeParametersLeft; 112 Member<VREyeParameters> m_eyeParametersLeft;
109 Member<VREyeParameters> m_eyeParametersRight; 113 Member<VREyeParameters> m_eyeParametersRight;
110 device::blink::VRPosePtr m_framePose; 114 device::blink::VRPosePtr m_framePose;
111 VRLayer m_layer; 115 VRLayer m_layer;
112 double m_depthNear; 116 double m_depthNear;
113 double m_depthFar; 117 double m_depthFar;
114 118
115 Timer<VRDisplay> m_fullscreenCheckTimer; 119 Timer<VRDisplay> m_fullscreenCheckTimer;
116 gpu::gles2::GLES2Interface* m_contextGL; 120 gpu::gles2::GLES2Interface* m_contextGL;
117 Member<WebGLRenderingContextBase> m_renderingContext; 121 Member<WebGLRenderingContextBase> m_renderingContext;
122
123 Member<ScriptedAnimationController> m_scriptedAnimationController;
124 bool m_animationCallbackRequested;
125 bool m_inAnimationFrame;
118 }; 126 };
119 127
120 using VRDisplayVector = HeapVector<Member<VRDisplay>>; 128 using VRDisplayVector = HeapVector<Member<VRDisplay>>;
121 129
122 enum class PresentationResult { 130 enum class PresentationResult {
123 Requested = 0, 131 Requested = 0,
124 Success = 1, 132 Success = 1,
125 SuccessAlreadyPresenting = 2, 133 SuccessAlreadyPresenting = 2,
126 VRDisplayCannotPresent = 3, 134 VRDisplayCannotPresent = 3,
127 PresentationNotSupportedByDisplay = 4, 135 PresentationNotSupportedByDisplay = 4,
128 VRDisplayNotFound = 5, 136 VRDisplayNotFound = 5,
129 NotInitiatedByUserGesture = 6, 137 NotInitiatedByUserGesture = 6,
130 InvalidNumberOfLayers = 7, 138 InvalidNumberOfLayers = 7,
131 InvalidLayerSource = 8, 139 InvalidLayerSource = 8,
132 LayerSourceMissingWebGLContext = 9, 140 LayerSourceMissingWebGLContext = 9,
133 InvalidLayerBounds = 10, 141 InvalidLayerBounds = 10,
134 ServiceInactive = 11, 142 ServiceInactive = 11,
135 RequestDenied = 12, 143 RequestDenied = 12,
136 PresentationResultMax, // Must be last member of enum. 144 PresentationResultMax, // Must be last member of enum.
137 }; 145 };
138 146
139 void ReportPresentationResult(PresentationResult); 147 void ReportPresentationResult(PresentationResult);
140 148
141 } // namespace blink 149 } // namespace blink
142 150
143 #endif // VRDisplay_h 151 #endif // VRDisplay_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptedAnimationController.h ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698