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

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

Issue 2894903002: VR: Fix invalidation race viewing native pages. (Closed)
Patch Set: remove logs Created 3 years, 7 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index db0123e8b4b3e6b3fad28fa193a8c02f8ad3145d..cc6884e0c60d3a67fdfe4124f0cc3127e3054bcd 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -412,6 +412,10 @@ void VrShell::SetSubmitClient(
base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
+ if (!content_surface_) {
+ return base::android::ScopedJavaGlobalRef<jobject>(env, nullptr);
+ }
+ taken_surface_ = true;
compositor_->SurfaceChanged(nullptr);
base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_);
content_surface_ = nullptr;
@@ -420,6 +424,9 @@ base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface(
void VrShell::RestoreContentSurface(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
+ // Don't try to restore the surface if we haven't successfully taken it yet.
+ if (!taken_surface_)
ymalik 2017/05/19 17:23:34 should we be restoring taken_surface_ to false?
mthiesse 2017/05/19 17:59:09 Oops yes.
+ return;
WaitForGlThread();
PostToGlThread(FROM_HERE, base::Bind(&VrShellGl::CreateContentSurface,
gl_thread_->GetVrShellGl()));
@@ -434,9 +441,9 @@ void VrShell::SetHistoryButtonsEnabled(JNIEnv* env,
void VrShell::ContentSurfaceChanged(jobject surface) {
content_surface_ = surface;
- compositor_->SurfaceChanged(surface);
JNIEnv* env = base::android::AttachCurrentThread();
Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj());
+ compositor_->SurfaceChanged(content_surface_);
}
void VrShell::GvrDelegateReady() {
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698