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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.h

Issue 2738683002: WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Less hacked up version 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 namespace blink { 27 namespace blink {
28 class WebInputEvent; 28 class WebInputEvent;
29 } 29 }
30 30
31 namespace content { 31 namespace content {
32 class WebContents; 32 class WebContents;
33 } 33 }
34 34
35 namespace gpu {
36 struct MailboxHolder;
37 }
38
35 namespace ui { 39 namespace ui {
36 class WindowAndroid; 40 class WindowAndroid;
37 } 41 }
38 42
39 namespace vr_shell { 43 namespace vr_shell {
40 44
41 class AndroidUiGestureTarget; 45 class AndroidUiGestureTarget;
42 class UiInterface; 46 class UiInterface;
43 class VrCompositor; 47 class VrCompositor;
44 class VrGLThread; 48 class VrGLThread;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 166
163 void ForceExitVr(); 167 void ForceExitVr();
164 168
165 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event); 169 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
166 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 170 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
167 171
168 // TODO(mthiesse): Find a better place for these functions to live. 172 // TODO(mthiesse): Find a better place for these functions to live.
169 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat); 173 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat);
170 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo( 174 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo(
171 gvr::GvrApi* gvr_api, 175 gvr::GvrApi* gvr_api,
172 gvr::Sizei compositor_size, 176 gvr::Sizei recommended_size,
173 uint32_t device_id); 177 uint32_t device_id);
178 void OnSubmitWebVRFrameTransferred(int frame_index);
179 void OnSubmitWebVRFrameRendered(int frame_index);
174 180
175 private: 181 private:
176 ~VrShell() override; 182 ~VrShell() override;
177 void PostToGlThreadWhenReady(const base::Closure& task); 183 void PostToGlThreadWhenReady(const base::Closure& task);
178 void SetContentPaused(bool paused); 184 void SetContentPaused(bool paused);
179 void SetUiState(); 185 void SetUiState();
180 186
181 // content::WebContentsObserver implementation. 187 // content::WebContentsObserver implementation.
182 void RenderViewHostChanged(content::RenderViewHost* old_host, 188 void RenderViewHostChanged(content::RenderViewHost* old_host,
183 content::RenderViewHost* new_host) override; 189 content::RenderViewHost* new_host) override;
184 void MainFrameWasResized(bool width_changed) override; 190 void MainFrameWasResized(bool width_changed) override;
185 void WebContentsDestroyed() override; 191 void WebContentsDestroyed() override;
186 192
187 // device::GvrDelegate implementation 193 // device::GvrDelegate implementation
188 void SetWebVRSecureOrigin(bool secure_origin) override; 194 void SetWebVRSecureOrigin(bool secure_origin) override;
189 void SubmitWebVRFrame() override; 195 void SubmitWebVRFrame(
196 int16_t frame_index,
197 const gpu::MailboxHolder& mailbox,
198 device::mojom::VRSubmitFrameClientPtr submit_client) override;
190 void UpdateWebVRTextureBounds(int16_t frame_index, 199 void UpdateWebVRTextureBounds(int16_t frame_index,
191 const gvr::Rectf& left_bounds, 200 const gvr::Rectf& left_bounds,
192 const gvr::Rectf& right_bounds) override; 201 const gvr::Rectf& right_bounds,
202 const gvr::Sizei& source_size) override;
193 void OnVRVsyncProviderRequest( 203 void OnVRVsyncProviderRequest(
194 device::mojom::VRVSyncProviderRequest request) override; 204 device::mojom::VRVSyncProviderRequest request) override;
195 void UpdateVSyncInterval(int64_t timebase_nanos, 205 void UpdateVSyncInterval(int64_t timebase_nanos,
196 double interval_seconds) override; 206 double interval_seconds) override;
197 bool SupportsPresentation() override; 207 bool SupportsPresentation() override;
198 void ResetPose() override; 208 void ResetPose() override;
199 void CreateVRDisplayInfo( 209 void CreateVRDisplayInfo(
200 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 210 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
201 uint32_t device_id) override; 211 uint32_t device_id) override;
202 212
203 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); 213 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito);
204 214
205 bool vr_shell_enabled_; 215 bool vr_shell_enabled_;
206 216
207 std::unique_ptr<UiInterface> html_interface_; 217 std::unique_ptr<UiInterface> html_interface_;
208 bool content_paused_ = false; 218 bool content_paused_ = false;
209 bool webvr_mode_ = false; 219 bool webvr_mode_ = false;
220 std::map<int, device::mojom::VRSubmitFrameClientPtr> webvr_submit_clients_;
221 std::map<int, bool> webvr_submit_client_transferring_;
222 std::map<int, bool> webvr_submit_client_rendering_;
210 223
211 content::WebContents* main_contents_ = nullptr; 224 content::WebContents* main_contents_ = nullptr;
212 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_; 225 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_;
213 ui::WindowAndroid* content_window_; 226 ui::WindowAndroid* content_window_;
214 std::unique_ptr<VrCompositor> content_compositor_; 227 std::unique_ptr<VrCompositor> content_compositor_;
215 content::WebContents* ui_contents_; 228 content::WebContents* ui_contents_;
216 std::unique_ptr<VrCompositor> ui_compositor_; 229 std::unique_ptr<VrCompositor> ui_compositor_;
217 230
218 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 231 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
219 232
(...skipping 18 matching lines...) Expand all
238 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 251 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
239 252
240 DISALLOW_COPY_AND_ASSIGN(VrShell); 253 DISALLOW_COPY_AND_ASSIGN(VrShell);
241 }; 254 };
242 255
243 bool RegisterVrShell(JNIEnv* env); 256 bool RegisterVrShell(JNIEnv* env);
244 257
245 } // namespace vr_shell 258 } // namespace vr_shell
246 259
247 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 260 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc ('k') | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698