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

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

Issue 2739973002: Revert of WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: 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 4563d1a04fbeab6197f542c9d37eea07f992f740..17a7ea3f9c603694d09864451bed19822a4e59aa 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -46,9 +46,14 @@
void VrShellDelegate::SetDelegate(device::GvrDelegate* delegate,
gvr_context* context) {
+ context_ = context;
delegate_ = delegate;
// Clean up the non-presenting delegate.
- if (delegate_ && non_presenting_delegate_) {
+ if (non_presenting_delegate_) {
+ device::mojom::VRVSyncProviderRequest request =
+ non_presenting_delegate_->OnSwitchToPresentingDelegate();
+ if (request.is_pending())
+ delegate->OnVRVsyncProviderRequest(std::move(request));
non_presenting_delegate_ = nullptr;
JNIEnv* env = AttachCurrentThread();
Java_VrShellDelegate_shutdownNonPresentingNativeContext(
@@ -131,16 +136,8 @@
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_)
@@ -157,7 +154,6 @@
}
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
@@ -167,7 +163,6 @@
}
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();
@@ -185,11 +180,19 @@
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