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

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

Issue 2894903002: VR: Fix invalidation race viewing native pages. (Closed)
Patch Set: Address comments 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..638f3cf1081f052f4731a45e39e0e4bbc1e81eb8 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,10 @@ 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_)
+ return;
+ taken_surface_ = false;
WaitForGlThread();
PostToGlThread(FROM_HERE, base::Bind(&VrShellGl::CreateContentSurface,
gl_thread_->GetVrShellGl()));
@@ -434,9 +442,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