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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/compositor/compositor_view.h" 5 #include "chrome/browser/android/compositor/compositor_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include <android/bitmap.h> 9 #include <android/bitmap.h>
10 #include <android/native_window_jni.h> 10 #include <android/native_window_jni.h>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 compositor_->SetHasTransparentBackground(enabled); 207 compositor_->SetHasTransparentBackground(enabled);
208 SetNeedsComposite(env, object); 208 SetNeedsComposite(env, object);
209 } 209 }
210 210
211 void CompositorView::SetSceneLayer(JNIEnv* env, 211 void CompositorView::SetSceneLayer(JNIEnv* env,
212 const JavaParamRef<jobject>& object, 212 const JavaParamRef<jobject>& object,
213 const JavaParamRef<jobject>& jscene_layer) { 213 const JavaParamRef<jobject>& jscene_layer) {
214 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); 214 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer);
215 215
216 if (scene_layer_ != scene_layer) { 216 if (scene_layer_ != scene_layer) {
217 // Old tree provider is being detached. 217 // The old tree should be detached only if it is not the cached layer or
218 if (scene_layer_ != nullptr) 218 // the cached layer is not somewhere in the new root.
219 if (scene_layer_ != nullptr
220 && !scene_layer_->layer()->HasAncestor(scene_layer->layer().get())) {
219 scene_layer_->OnDetach(); 221 scene_layer_->OnDetach();
222 }
220 223
221 scene_layer_ = scene_layer; 224 scene_layer_ = scene_layer;
222 225
223 if (scene_layer == nullptr) { 226 if (scene_layer == nullptr) {
224 scene_layer_layer_ = nullptr; 227 scene_layer_layer_ = nullptr;
225 return; 228 return;
226 } 229 }
227 230
228 scene_layer_layer_ = scene_layer->layer(); 231 scene_layer_layer_ = scene_layer->layer();
229 root_layer_->InsertChild(scene_layer->layer(), 0); 232 root_layer_->InsertChild(scene_layer->layer(), 0);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // through here but through BrowserChildProcessHostDisconnected() instead. 321 // through here but through BrowserChildProcessHostDisconnected() instead.
319 } 322 }
320 323
321 // Register native methods 324 // Register native methods
322 bool RegisterCompositorView(JNIEnv* env) { 325 bool RegisterCompositorView(JNIEnv* env) {
323 return RegisterNativesImpl(env); 326 return RegisterNativesImpl(env);
324 } 327 }
325 328
326 } // namespace android 329 } // namespace android
327 } // namespace chrome 330 } // namespace chrome
OLDNEW
« 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