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

Side by Side Diff: chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc

Issue 1489213002: [Contextual Search] Remove layers when no longer needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
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/scene_layer/static_tab_scene_layer.h " 5 #include "chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h "
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "chrome/browser/android/compositor/layer/content_layer.h" 8 #include "chrome/browser/android/compositor/layer/content_layer.h"
9 #include "chrome/browser/android/compositor/layer_title_cache.h" 9 #include "chrome/browser/android/compositor/layer_title_cache.h"
10 #include "chrome/browser/android/compositor/tab_content_manager.h" 10 #include "chrome/browser/android/compositor/tab_content_manager.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_)); 120 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_));
121 layer_->SetFilters(filters); 121 layer_->SetFilters(filters);
122 } 122 }
123 } 123 }
124 124
125 void StaticTabSceneLayer::SetContentSceneLayer( 125 void StaticTabSceneLayer::SetContentSceneLayer(
126 JNIEnv* env, 126 JNIEnv* env,
127 const JavaParamRef<jobject>& jobj, 127 const JavaParamRef<jobject>& jobj,
128 const JavaParamRef<jobject>& jcontent_scene_layer) { 128 const JavaParamRef<jobject>& jcontent_scene_layer) {
129 SceneLayer* content_scene_layer = FromJavaObject(env, jcontent_scene_layer); 129 SceneLayer* content_scene_layer = FromJavaObject(env, jcontent_scene_layer);
130 if (content_scene_layer && content_scene_layer->layer()) { 130 // If |content_scene_layer| is null, or different from the previously added
David Trainor- moved to gerrit 2015/12/02 16:34:13 Would this be easier if we just pulled out the act
pedro (no code reviews) 2015/12/02 23:56:14 As we've discussed offline, the problem is that th
131 content_scene_layer_ = content_scene_layer->layer(); 131 // layer (which means a new scene layer will replace the old one), then
132 if (content_scene_layer_.get()) 132 // the layer should be removed from the hierarchy.
133 layer_->AddChild(content_scene_layer_); 133 if (content_scene_layer_ && (!content_scene_layer || (content_scene_layer &&
134 } else if (content_scene_layer_) { 134 content_scene_layer->layer().get() != content_scene_layer_.get()))) {
135 content_scene_layer_->RemoveFromParent(); 135 content_scene_layer_->RemoveFromParent();
136 content_scene_layer_ = nullptr; 136 content_scene_layer_ = nullptr;
137 } 137 }
138
139 if (content_scene_layer && content_scene_layer->layer()) {
140 content_scene_layer_ = content_scene_layer->layer();
141 if (content_scene_layer_.get()) {
142 layer_->AddChild(content_scene_layer_);
143 }
144 }
138 } 145 }
139 146
140 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { 147 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
141 // This will automatically bind to the Java object and pass ownership there. 148 // This will automatically bind to the Java object and pass ownership there.
142 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); 149 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj);
143 return reinterpret_cast<intptr_t>(scene_layer); 150 return reinterpret_cast<intptr_t>(scene_layer);
144 } 151 }
145 152
146 bool RegisterStaticTabSceneLayer(JNIEnv* env) { 153 bool RegisterStaticTabSceneLayer(JNIEnv* env) {
147 return RegisterNativesImpl(env); 154 return RegisterNativesImpl(env);
148 } 155 }
149 156
150 } // namespace android 157 } // namespace android
151 } // namespace chrome 158 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698