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

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

Issue 2729523002: Re-land^2 WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Further cleanups 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 #include "chrome/browser/android/vr_shell/vr_shell.h" 5 #include "chrome/browser/android/vr_shell/vr_shell.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" 29 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h"
30 #include "content/public/browser/navigation_controller.h" 30 #include "content/public/browser/navigation_controller.h"
31 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/render_widget_host.h" 32 #include "content/public/browser/render_widget_host.h"
33 #include "content/public/browser/render_widget_host_view.h" 33 #include "content/public/browser/render_widget_host_view.h"
34 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
35 #include "content/public/common/content_features.h" 35 #include "content/public/common/content_features.h"
36 #include "content/public/common/referrer.h" 36 #include "content/public/common/referrer.h"
37 #include "device/vr/android/gvr/gvr_device.h" 37 #include "device/vr/android/gvr/gvr_device.h"
38 #include "device/vr/android/gvr/gvr_device_provider.h" 38 #include "device/vr/android/gvr/gvr_device_provider.h"
39 #include "gpu/command_buffer/common/mailbox.h"
39 #include "jni/VrShellImpl_jni.h" 40 #include "jni/VrShellImpl_jni.h"
40 #include "third_party/WebKit/public/platform/WebInputEvent.h" 41 #include "third_party/WebKit/public/platform/WebInputEvent.h"
41 #include "ui/android/view_android.h" 42 #include "ui/android/view_android.h"
42 #include "ui/android/window_android.h" 43 #include "ui/android/window_android.h"
43 #include "ui/base/page_transition_types.h" 44 #include "ui/base/page_transition_types.h"
44 #include "ui/display/display.h" 45 #include "ui/display/display.h"
45 #include "ui/display/screen.h" 46 #include "ui/display/screen.h"
46 #include "ui/gfx/transform.h" 47 #include "ui/gfx/transform.h"
47 #include "ui/gfx/transform_util.h" 48 #include "ui/gfx/transform_util.h"
48 49
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 jboolean incognito, 318 jboolean incognito,
318 jint id) { 319 jint id) {
319 html_interface_->RemoveTab(incognito, id); 320 html_interface_->RemoveTab(incognito, id);
320 } 321 }
321 322
322 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { 323 void VrShell::SetWebVRSecureOrigin(bool secure_origin) {
323 // TODO(cjgrant): Align this state with the logic that drives the omnibox. 324 // TODO(cjgrant): Align this state with the logic that drives the omnibox.
324 html_interface_->SetWebVRSecureOrigin(secure_origin); 325 html_interface_->SetWebVRSecureOrigin(secure_origin);
325 } 326 }
326 327
327 void VrShell::SubmitWebVRFrame() {} 328 void VrShell::SubmitWebVRFrame(
mthiesse 2017/03/02 15:55:16 In a future patch we should consider binding Submi
klausw 2017/03/07 02:55:54 Acknowledged.
329 int frame_index, const gpu::Mailbox& mailbox,
330 device::mojom::VRSubmitFrameClientPtr submit_client) {
331 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SubmitWebVRFrame,
332 gl_thread_->GetVrShellGl(), frame_index,
333 mailbox));
334 webvr_submit_client_transferring_ = std::move(submit_client);
335 }
336
337 void VrShell::OnSubmitWebVRFrameTransferred(int frame_index) {
338 webvr_submit_client_transferring_->OnSubmitFrameTransferred();
339 webvr_submit_client_rendering_ = std::move(webvr_submit_client_transferring_);
340 }
341
342 void VrShell::OnSubmitWebVRFrameRendered(int frame_index) {
343 webvr_submit_client_rendering_->OnSubmitFrameRendered();
344 webvr_submit_client_rendering_.reset();
345 }
328 346
329 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index, 347 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index,
330 const gvr::Rectf& left_bounds, 348 const gvr::Rectf& left_bounds,
331 const gvr::Rectf& right_bounds) { 349 const gvr::Rectf& right_bounds) {
332 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, 350 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds,
333 gl_thread_->GetVrShellGl(), frame_index, 351 gl_thread_->GetVrShellGl(), frame_index,
334 left_bounds, right_bounds)); 352 left_bounds, right_bounds));
335 } 353 }
336 354
337 bool VrShell::SupportsPresentation() { 355 bool VrShell::SupportsPresentation() {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 jboolean reprojected_rendering) { 694 jboolean reprojected_rendering) {
677 return reinterpret_cast<intptr_t>(new VrShell( 695 return reinterpret_cast<intptr_t>(new VrShell(
678 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), 696 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android),
679 content::WebContents::FromJavaWebContents(ui_web_contents), 697 content::WebContents::FromJavaWebContents(ui_web_contents),
680 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, 698 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr,
681 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 699 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
682 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 700 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
683 } 701 }
684 702
685 } // namespace vr_shell 703 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698