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

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

Issue 2553753002: Prevent repeated VRDisplay.requestPresent calls from spamming the device (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 friend class VRController; 87 friend class VRController;
88 88
89 VRDisplay(NavigatorVR*, 89 VRDisplay(NavigatorVR*,
90 device::mojom::blink::VRDisplayPtr, 90 device::mojom::blink::VRDisplayPtr,
91 device::mojom::blink::VRDisplayClientRequest); 91 device::mojom::blink::VRDisplayClientRequest);
92 92
93 void update(const device::mojom::blink::VRDisplayInfoPtr&); 93 void update(const device::mojom::blink::VRDisplayInfoPtr&);
94 94
95 void updatePose(); 95 void updatePose();
96 96
97 void beginPresent(ScriptPromiseResolver*); 97 void beginPresent();
98 void forceExitPresent(); 98 void forceExitPresent();
99 99
100 void updateLayerBounds(); 100 void updateLayerBounds();
101 void disconnected(); 101 void disconnected();
102 102
103 VRController* controller(); 103 VRController* controller();
104 104
105 private: 105 private:
106 void onFullscreenCheck(TimerBase*); 106 void onFullscreenCheck(TimerBase*);
107 void onPresentComplete(ScriptPromiseResolver*, bool); 107 void onPresentComplete(bool);
108 108
109 void onConnected(); 109 void onConnected();
110 void onDisconnected(); 110 void onDisconnected();
111 111
112 void OnPresentChange(); 112 void OnPresentChange();
113 113
114 // VRDisplayClient 114 // VRDisplayClient
115 void OnChanged(device::mojom::blink::VRDisplayInfoPtr) override; 115 void OnChanged(device::mojom::blink::VRDisplayInfoPtr) override;
116 void OnExitPresent() override; 116 void OnExitPresent() override;
117 void OnBlur() override; 117 void OnBlur() override;
(...skipping 28 matching lines...) Expand all
146 Member<WebGLRenderingContextBase> m_renderingContext; 146 Member<WebGLRenderingContextBase> m_renderingContext;
147 147
148 Member<ScriptedAnimationController> m_scriptedAnimationController; 148 Member<ScriptedAnimationController> m_scriptedAnimationController;
149 bool m_animationCallbackRequested; 149 bool m_animationCallbackRequested;
150 bool m_inAnimationFrame; 150 bool m_inAnimationFrame;
151 bool m_displayBlurred; 151 bool m_displayBlurred;
152 152
153 device::mojom::blink::VRDisplayPtr m_display; 153 device::mojom::blink::VRDisplayPtr m_display;
154 154
155 mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding; 155 mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding;
156
157 HeapDeque<Member<ScriptPromiseResolver>> m_pendingPresentResolvers;
156 }; 158 };
157 159
158 using VRDisplayVector = HeapVector<Member<VRDisplay>>; 160 using VRDisplayVector = HeapVector<Member<VRDisplay>>;
159 161
160 enum class PresentationResult { 162 enum class PresentationResult {
161 Requested = 0, 163 Requested = 0,
162 Success = 1, 164 Success = 1,
163 SuccessAlreadyPresenting = 2, 165 SuccessAlreadyPresenting = 2,
164 VRDisplayCannotPresent = 3, 166 VRDisplayCannotPresent = 3,
165 PresentationNotSupportedByDisplay = 4, 167 PresentationNotSupportedByDisplay = 4,
166 VRDisplayNotFound = 5, 168 VRDisplayNotFound = 5,
167 NotInitiatedByUserGesture = 6, 169 NotInitiatedByUserGesture = 6,
168 InvalidNumberOfLayers = 7, 170 InvalidNumberOfLayers = 7,
169 InvalidLayerSource = 8, 171 InvalidLayerSource = 8,
170 LayerSourceMissingWebGLContext = 9, 172 LayerSourceMissingWebGLContext = 9,
171 InvalidLayerBounds = 10, 173 InvalidLayerBounds = 10,
172 ServiceInactive = 11, 174 ServiceInactive = 11,
173 RequestDenied = 12, 175 RequestDenied = 12,
174 PresentationResultMax, // Must be last member of enum. 176 PresentationResultMax, // Must be last member of enum.
175 }; 177 };
176 178
177 void ReportPresentationResult(PresentationResult); 179 void ReportPresentationResult(PresentationResult);
178 180
179 } // namespace blink 181 } // namespace blink
180 182
181 #endif // VRDisplay_h 183 #endif // VRDisplay_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698