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 "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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 device::mojom::blink::VRVSyncProvider::Status); | 140 device::mojom::blink::VRVSyncProvider::Status); |
141 void ConnectVSyncProvider(); | 141 void ConnectVSyncProvider(); |
142 void OnVSyncConnectionError(); | 142 void OnVSyncConnectionError(); |
143 | 143 |
144 bool FocusedOrPresenting(); | 144 bool FocusedOrPresenting(); |
145 | 145 |
146 ScriptedAnimationController& EnsureScriptedAnimationController(Document*); | 146 ScriptedAnimationController& EnsureScriptedAnimationController(Document*); |
147 void ProcessScheduledAnimations(double timestamp); | 147 void ProcessScheduledAnimations(double timestamp); |
148 void ProcessScheduledWindowAnimations(double timestamp); | 148 void ProcessScheduledWindowAnimations(double timestamp); |
149 | 149 |
| 150 // In order to help the VR device with scheduling, never request a new VSync |
| 151 // until the current frame is either submitted or abandoned. If vrDisplay.rAF |
| 152 // is called earlier, defer the GetVSync until vrDisplay.submitFrame is |
| 153 // called. If the rAF callback exits without submitting a frame, call it at |
| 154 // that time. |
| 155 void RequestVSync(); |
| 156 |
150 Member<NavigatorVR> navigator_vr_; | 157 Member<NavigatorVR> navigator_vr_; |
151 unsigned display_id_ = 0; | 158 unsigned display_id_ = 0; |
152 String display_name_; | 159 String display_name_; |
153 bool is_connected_ = false; | 160 bool is_connected_ = false; |
154 bool is_presenting_ = false; | 161 bool is_presenting_ = false; |
155 bool is_valid_device_for_presenting_ = true; | 162 bool is_valid_device_for_presenting_ = true; |
156 Member<VRDisplayCapabilities> capabilities_; | 163 Member<VRDisplayCapabilities> capabilities_; |
157 Member<VRStageParameters> stage_parameters_; | 164 Member<VRStageParameters> stage_parameters_; |
158 Member<VREyeParameters> eye_parameters_left_; | 165 Member<VREyeParameters> eye_parameters_left_; |
159 Member<VREyeParameters> eye_parameters_right_; | 166 Member<VREyeParameters> eye_parameters_right_; |
(...skipping 18 matching lines...) Expand all Loading... |
178 Member<WebGLRenderingContextBase> rendering_context_; | 185 Member<WebGLRenderingContextBase> rendering_context_; |
179 | 186 |
180 // Used to keep the image alive until the next frame if using | 187 // Used to keep the image alive until the next frame if using |
181 // waitForPreviousTransferToFinish. | 188 // waitForPreviousTransferToFinish. |
182 RefPtr<Image> previous_image_; | 189 RefPtr<Image> previous_image_; |
183 | 190 |
184 Member<ScriptedAnimationController> scripted_animation_controller_; | 191 Member<ScriptedAnimationController> scripted_animation_controller_; |
185 bool pending_vrdisplay_raf_ = false; | 192 bool pending_vrdisplay_raf_ = false; |
186 bool pending_vsync_ = false; | 193 bool pending_vsync_ = false; |
187 bool in_animation_frame_ = false; | 194 bool in_animation_frame_ = false; |
| 195 bool did_submit_this_frame_ = false; |
188 bool in_display_activate_ = false; | 196 bool in_display_activate_ = false; |
189 bool display_blurred_ = false; | 197 bool display_blurred_ = false; |
190 double timebase_ = -1; | 198 double timebase_ = -1; |
191 bool pending_previous_frame_render_ = false; | 199 bool pending_previous_frame_render_ = false; |
192 bool pending_submit_frame_ = false; | 200 bool pending_submit_frame_ = false; |
193 bool v_sync_connection_failed_ = false; | 201 bool v_sync_connection_failed_ = false; |
194 bool pending_present_request_ = false; | 202 bool pending_present_request_ = false; |
195 | 203 |
196 device::mojom::blink::VRDisplayPtr display_; | 204 device::mojom::blink::VRDisplayPtr display_; |
197 | 205 |
(...skipping 23 matching lines...) Expand all Loading... |
221 kRequestDenied = 12, | 229 kRequestDenied = 12, |
222 kFullscreenNotEnabled = 13, | 230 kFullscreenNotEnabled = 13, |
223 kPresentationResultMax, // Must be last member of enum. | 231 kPresentationResultMax, // Must be last member of enum. |
224 }; | 232 }; |
225 | 233 |
226 void ReportPresentationResult(PresentationResult); | 234 void ReportPresentationResult(PresentationResult); |
227 | 235 |
228 } // namespace blink | 236 } // namespace blink |
229 | 237 |
230 #endif // VRDisplay_h | 238 #endif // VRDisplay_h |
OLD | NEW |