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

Unified Diff: chrome/browser/android/compositor/compositor_view.cc

Issue 1801243003: Fix compositor view caching logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reword comment Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/compositor/compositor_view.cc
diff --git a/chrome/browser/android/compositor/compositor_view.cc b/chrome/browser/android/compositor/compositor_view.cc
index 69580802f389cc954c9c8ee991c79ef5aca21126..83e9fe65f3bf5a2d42cd75fbde2153ef1badbdfe 100644
--- a/chrome/browser/android/compositor/compositor_view.cc
+++ b/chrome/browser/android/compositor/compositor_view.cc
@@ -214,9 +214,12 @@ void CompositorView::SetSceneLayer(JNIEnv* env,
SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer);
if (scene_layer_ != scene_layer) {
- // Old tree provider is being detached.
- if (scene_layer_ != nullptr)
+ // The old tree should be detached only if it is not the cached layer or
+ // the cached layer is not somewhere in the new root.
+ if (scene_layer_ != nullptr
+ && !scene_layer_->layer()->HasAncestor(scene_layer->layer().get())) {
scene_layer_->OnDetach();
+ }
scene_layer_ = scene_layer;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698