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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_delegate.cc

Issue 2729523002: Re-land^2 WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Rebase to 11e28fd6b9380b77273db51ef0b6ccc7ea341944 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.h ('k') | chrome/browser/android/vr_shell/vr_shell_gl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_delegate.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
index 17a7ea3f9c603694d09864451bed19822a4e59aa..4563d1a04fbeab6197f542c9d37eea07f992f740 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -46,14 +46,9 @@ VrShellDelegate* VrShellDelegate::GetNativeVrShellDelegate(JNIEnv* env,
void VrShellDelegate::SetDelegate(device::GvrDelegate* delegate,
gvr_context* context) {
- context_ = context;
delegate_ = delegate;
// Clean up the non-presenting delegate.
- if (non_presenting_delegate_) {
- device::mojom::VRVSyncProviderRequest request =
- non_presenting_delegate_->OnSwitchToPresentingDelegate();
- if (request.is_pending())
- delegate->OnVRVsyncProviderRequest(std::move(request));
+ if (delegate_ && non_presenting_delegate_) {
non_presenting_delegate_ = nullptr;
JNIEnv* env = AttachCurrentThread();
Java_VrShellDelegate_shutdownNonPresentingNativeContext(
@@ -136,8 +131,16 @@ void VrShellDelegate::OpenNewTab(bool incognito) {
Java_VrShellDelegate_openNewTab(env, j_vr_shell_delegate_.obj(), incognito);
}
+device::mojom::VRSubmitFrameClientPtr VrShellDelegate::TakeSubmitFrameClient() {
+ return std::move(submit_client_);
+}
+
void VrShellDelegate::SetDeviceProvider(
device::GvrDeviceProvider* device_provider) {
+ if (device_provider_ == device_provider)
+ return;
+ if (device_provider_)
+ ClearDeviceProvider();
CHECK(!device_provider_);
device_provider_ = device_provider;
if (!delegate_)
@@ -154,6 +157,7 @@ void VrShellDelegate::ClearDeviceProvider() {
}
void VrShellDelegate::RequestWebVRPresent(
+ device::mojom::VRSubmitFrameClientPtr submit_client,
const base::Callback<void(bool)>& callback) {
if (!present_callback_.is_null()) {
// Can only handle one request at a time. This is also extremely unlikely to
@@ -163,6 +167,7 @@ void VrShellDelegate::RequestWebVRPresent(
}
present_callback_ = std::move(callback);
+ submit_client_ = std::move(submit_client);
// If/When VRShell is ready for use it will call SetPresentResult.
JNIEnv* env = AttachCurrentThread();
@@ -180,19 +185,11 @@ base::WeakPtr<VrShellDelegate> VrShellDelegate::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
-void VrShellDelegate::OnVRVsyncProviderRequest(
- device::mojom::VRVSyncProviderRequest request) {
- GetDelegate()->OnVRVsyncProviderRequest(std::move(request));
-}
-
void VrShellDelegate::CreateNonPresentingDelegate() {
JNIEnv* env = AttachCurrentThread();
gvr_context* context = reinterpret_cast<gvr_context*>(
Java_VrShellDelegate_createNonPresentingNativeContext(
env, j_vr_shell_delegate_.obj()));
- if (!context)
- return;
- context_ = context;
non_presenting_delegate_ =
base::MakeUnique<NonPresentingGvrDelegate>(context);
non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_,
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.h ('k') | chrome/browser/android/vr_shell/vr_shell_gl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698