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

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

Issue 2550863002: Prevent repeated VRDisplay.requestPresent calls from spamming the device (Closed)
Patch Set: Minor cleanup 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 29 matching lines...) Expand all
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 bool m_reenteredFullscreen; 152 bool m_reenteredFullscreen;
153 153
154 device::mojom::blink::VRDisplayPtr m_display; 154 device::mojom::blink::VRDisplayPtr m_display;
155 155
156 mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding; 156 mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding;
157
158 HeapDeque<Member<ScriptPromiseResolver>> m_pendingPresentResolvers;
157 }; 159 };
158 160
159 using VRDisplayVector = HeapVector<Member<VRDisplay>>; 161 using VRDisplayVector = HeapVector<Member<VRDisplay>>;
160 162
161 enum class PresentationResult { 163 enum class PresentationResult {
162 Requested = 0, 164 Requested = 0,
163 Success = 1, 165 Success = 1,
164 SuccessAlreadyPresenting = 2, 166 SuccessAlreadyPresenting = 2,
165 VRDisplayCannotPresent = 3, 167 VRDisplayCannotPresent = 3,
166 PresentationNotSupportedByDisplay = 4, 168 PresentationNotSupportedByDisplay = 4,
167 VRDisplayNotFound = 5, 169 VRDisplayNotFound = 5,
168 NotInitiatedByUserGesture = 6, 170 NotInitiatedByUserGesture = 6,
169 InvalidNumberOfLayers = 7, 171 InvalidNumberOfLayers = 7,
170 InvalidLayerSource = 8, 172 InvalidLayerSource = 8,
171 LayerSourceMissingWebGLContext = 9, 173 LayerSourceMissingWebGLContext = 9,
172 InvalidLayerBounds = 10, 174 InvalidLayerBounds = 10,
173 ServiceInactive = 11, 175 ServiceInactive = 11,
174 RequestDenied = 12, 176 RequestDenied = 12,
175 PresentationResultMax, // Must be last member of enum. 177 PresentationResultMax, // Must be last member of enum.
176 }; 178 };
177 179
178 void ReportPresentationResult(PresentationResult); 180 void ReportPresentationResult(PresentationResult);
179 181
180 } // namespace blink 182 } // namespace blink
181 183
182 #endif // VRDisplay_h 184 #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