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

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

Issue 2739973002: Revert of WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Created 3 years, 9 months 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 "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/FrameRequestCallback.h" 9 #include "core/dom/FrameRequestCallback.h"
10 #include "core/events/EventTarget.h" 10 #include "core/events/EventTarget.h"
(...skipping 23 matching lines...) Expand all
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 EventTargetWithInlineData, 41 class VRDisplay final : public EventTargetWithInlineData,
42 public ActiveScriptWrappable<VRDisplay>, 42 public ActiveScriptWrappable<VRDisplay>,
43 public ContextLifecycleObserver, 43 public ContextLifecycleObserver,
44 public device::mojom::blink::VRDisplayClient, 44 public device::mojom::blink::VRDisplayClient {
45 public device::mojom::blink::VRSubmitFrameClient {
46 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
47 USING_GARBAGE_COLLECTED_MIXIN(VRDisplay); 46 USING_GARBAGE_COLLECTED_MIXIN(VRDisplay);
48 USING_PRE_FINALIZER(VRDisplay, dispose); 47 USING_PRE_FINALIZER(VRDisplay, dispose);
49 48
50 public: 49 public:
51 ~VRDisplay(); 50 ~VRDisplay();
52 51
53 unsigned displayId() const { return m_displayId; } 52 unsigned displayId() const { return m_displayId; }
54 const String& displayName() const { return m_displayName; } 53 const String& displayName() const { return m_displayName; }
55 54
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 109
111 void beginPresent(); 110 void beginPresent();
112 void forceExitPresent(); 111 void forceExitPresent();
113 112
114 void updateLayerBounds(); 113 void updateLayerBounds();
115 void disconnected(); 114 void disconnected();
116 115
117 VRController* controller(); 116 VRController* controller();
118 117
119 private: 118 private:
119 void onFullscreenCheck(TimerBase*);
120 void onPresentComplete(bool); 120 void onPresentComplete(bool);
121 121
122 void onConnected(); 122 void onConnected();
123 void onDisconnected(); 123 void onDisconnected();
124 124
125 void stopPresenting(); 125 void stopPresenting();
126 126
127 void OnPresentChange(); 127 void OnPresentChange();
128 128
129 // VRSubmitFrameClient
130 void OnSubmitFrameTransferred();
131 void OnSubmitFrameRendered();
132
133 // VRDisplayClient 129 // VRDisplayClient
134 void OnChanged(device::mojom::blink::VRDisplayInfoPtr) override; 130 void OnChanged(device::mojom::blink::VRDisplayInfoPtr) override;
135 void OnExitPresent() override; 131 void OnExitPresent() override;
136 void OnBlur() override; 132 void OnBlur() override;
137 void OnFocus() override; 133 void OnFocus() override;
138 void OnActivate(device::mojom::blink::VRDisplayEventReason) override; 134 void OnActivate(device::mojom::blink::VRDisplayEventReason) override;
139 void OnDeactivate(device::mojom::blink::VRDisplayEventReason) override; 135 void OnDeactivate(device::mojom::blink::VRDisplayEventReason) override;
140 136
141 void OnVSync(device::mojom::blink::VRPosePtr, 137 void OnVSync(device::mojom::blink::VRPosePtr,
142 mojo::common::mojom::blink::TimeDeltaPtr, 138 mojo::common::mojom::blink::TimeDeltaPtr,
143 int16_t frameId, 139 int16_t frameId,
144 device::mojom::blink::VRVSyncProvider::Status); 140 device::mojom::blink::VRVSyncProvider::Status);
145 void ConnectVSyncProvider(); 141 void ConnectVSyncProvider();
146 void OnVSyncConnectionError();
147 142
148 ScriptedAnimationController& ensureScriptedAnimationController(Document*); 143 ScriptedAnimationController& ensureScriptedAnimationController(Document*);
149 144
150 Member<NavigatorVR> m_navigatorVR; 145 Member<NavigatorVR> m_navigatorVR;
151 unsigned m_displayId = 0; 146 unsigned m_displayId = 0;
152 String m_displayName; 147 String m_displayName;
153 bool m_isConnected = false; 148 bool m_isConnected = false;
154 bool m_isPresenting = false; 149 bool m_isPresenting = false;
155 bool m_isValidDeviceForPresenting = true; 150 bool m_isValidDeviceForPresenting = true;
156 Member<VRDisplayCapabilities> m_capabilities; 151 Member<VRDisplayCapabilities> m_capabilities;
157 Member<VRStageParameters> m_stageParameters; 152 Member<VRStageParameters> m_stageParameters;
158 Member<VREyeParameters> m_eyeParametersLeft; 153 Member<VREyeParameters> m_eyeParametersLeft;
159 Member<VREyeParameters> m_eyeParametersRight; 154 Member<VREyeParameters> m_eyeParametersRight;
160 device::mojom::blink::VRPosePtr m_framePose; 155 device::mojom::blink::VRPosePtr m_framePose;
161 156
162 // This frame ID is vr-specific and is used to track when frames arrive at the 157 // This frame ID is vr-specific and is used to track when frames arrive at the
163 // VR compositor so that it knows which poses to use, when to apply bounds 158 // VR compositor so that it knows which poses to use, when to apply bounds
164 // updates, etc. 159 // updates, etc.
165 int16_t m_vrFrameId = -1; 160 int16_t m_vrFrameId = -1;
166 VRLayer m_layer; 161 VRLayer m_layer;
167 double m_depthNear = 0.01; 162 double m_depthNear = 0.01;
168 double m_depthFar = 10000.0; 163 double m_depthFar = 10000.0;
169 164
170 // Current dimensions of the WebVR source canvas. May be different from
171 // the recommended renderWidth/Height if the client overrides dimensions.
172 int m_sourceWidth = 0;
173 int m_sourceHeight = 0;
174
175 void dispose(); 165 void dispose();
176 166
167 TaskRunnerTimer<VRDisplay> m_fullscreenCheckTimer;
168 String m_fullscreenOrigWidth;
169 String m_fullscreenOrigHeight;
177 gpu::gles2::GLES2Interface* m_contextGL = nullptr; 170 gpu::gles2::GLES2Interface* m_contextGL = nullptr;
178 Member<WebGLRenderingContextBase> m_renderingContext; 171 Member<WebGLRenderingContextBase> m_renderingContext;
179 172
180 // Used to keep the image alive until the next frame if using
181 // waitForPreviousTransferToFinish.
182 RefPtr<Image> m_previousImage;
183
184 Member<ScriptedAnimationController> m_scriptedAnimationController; 173 Member<ScriptedAnimationController> m_scriptedAnimationController;
185 bool m_pendingRaf = false; 174 bool m_pendingRaf = false;
186 bool m_pendingVsync = false; 175 bool m_pendingVsync = false;
187 bool m_inAnimationFrame = false; 176 bool m_inAnimationFrame = false;
188 bool m_displayBlurred = false; 177 bool m_displayBlurred = false;
178 bool m_reenteredFullscreen = false;
189 double m_timebase = -1; 179 double m_timebase = -1;
190 bool m_pendingPreviousFrameRender = false;
191 bool m_pendingSubmitFrame = false;
192 180
193 device::mojom::blink::VRDisplayPtr m_display; 181 device::mojom::blink::VRDisplayPtr m_display;
194 182
195 mojo::Binding<device::mojom::blink::VRSubmitFrameClient>
196 m_submit_frame_client_binding;
197 mojo::Binding<device::mojom::blink::VRDisplayClient> m_displayClientBinding; 183 mojo::Binding<device::mojom::blink::VRDisplayClient> m_displayClientBinding;
198 device::mojom::blink::VRVSyncProviderPtr m_vrVSyncProvider; 184 device::mojom::blink::VRVSyncProviderPtr m_vrVSyncProvider;
199 185
200 HeapDeque<Member<ScriptPromiseResolver>> m_pendingPresentResolvers; 186 HeapDeque<Member<ScriptPromiseResolver>> m_pendingPresentResolvers;
201 }; 187 };
202 188
203 using VRDisplayVector = HeapVector<Member<VRDisplay>>; 189 using VRDisplayVector = HeapVector<Member<VRDisplay>>;
204 190
205 enum class PresentationResult { 191 enum class PresentationResult {
206 Requested = 0, 192 Requested = 0,
(...skipping 11 matching lines...) Expand all
218 RequestDenied = 12, 204 RequestDenied = 12,
219 FullscreenNotEnabled = 13, 205 FullscreenNotEnabled = 13,
220 PresentationResultMax, // Must be last member of enum. 206 PresentationResultMax, // Must be last member of enum.
221 }; 207 };
222 208
223 void ReportPresentationResult(PresentationResult); 209 void ReportPresentationResult(PresentationResult);
224 210
225 } // namespace blink 211 } // namespace blink
226 212
227 #endif // VRDisplay_h 213 #endif // VRDisplay_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/DEPS ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698