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

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

Issue 2562733002: Implement our own GLThread for VR Shell. (Closed)
Patch Set: sigh 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 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 01b70d1b2ce8309a63a366a120856f805d0def18..ab7ec0a3c2525ce2f83f971499d497955229a2f6 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -59,8 +59,21 @@ VrShellDelegate* VrShellDelegate::GetNativeDelegate(
return reinterpret_cast<VrShellDelegate*>(native_delegate);
}
-base::WeakPtr<device::GvrDeviceProvider> VrShellDelegate::GetDeviceProvider() {
- return device_provider_;
+void VrShellDelegate::SetDelegate(
+ const base::WeakPtr<device::GvrDelegate>& delegate) {
+ // TODO(mthiesse): There's no reason for this delegate to be a WeakPtr
+ // anymore.
+ delegate_ = delegate;
+ if (device_provider_.get()) {
+ device_provider_->OnGvrDelegateReady(delegate_);
+ }
+}
+
+void VrShellDelegate::RemoveDelegate() {
+ delegate_.reset();
+ if (device_provider_.get()) {
+ device_provider_->OnGvrDelegateRemoved();
+ }
}
void VrShellDelegate::SetPresentResult(JNIEnv* env, jobject obj,
@@ -79,6 +92,9 @@ void VrShellDelegate::DisplayActivate(JNIEnv* env, jobject obj) {
void VrShellDelegate::SetDeviceProvider(
base::WeakPtr<device::GvrDeviceProvider> device_provider) {
device_provider_ = device_provider;
+ if (delegate_.get()) {
+ device_provider_->OnGvrDelegateReady(delegate_);
+ }
}
void VrShellDelegate::RequestWebVRPresent(
« 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