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

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

Issue 1502703002: [Contextual Search] Remove layers when no longer needed. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2564
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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java ('k') | 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/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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (brightness_ < 1.f) 118 if (brightness_ < 1.f)
119 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_)); 119 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_));
120 layer_->SetFilters(filters); 120 layer_->SetFilters(filters);
121 } 121 }
122 } 122 }
123 123
124 void StaticTabSceneLayer::SetContentSceneLayer(JNIEnv* env, 124 void StaticTabSceneLayer::SetContentSceneLayer(JNIEnv* env,
125 jobject jobj, 125 jobject jobj,
126 jobject jcontent_scene_layer) { 126 jobject jcontent_scene_layer) {
127 SceneLayer* content_scene_layer = FromJavaObject(env, jcontent_scene_layer); 127 SceneLayer* content_scene_layer = FromJavaObject(env, jcontent_scene_layer);
128 if (content_scene_layer && content_scene_layer->layer()) { 128 scoped_refptr<cc::Layer> layer = content_scene_layer ?
129 content_scene_layer_ = content_scene_layer->layer(); 129 content_scene_layer->layer() : nullptr;
130 if (content_scene_layer_.get()) 130
131 layer_->AddChild(content_scene_layer_); 131 if (content_scene_layer_ && content_scene_layer_ != layer) {
132 } else if (content_scene_layer_) {
133 content_scene_layer_->RemoveFromParent(); 132 content_scene_layer_->RemoveFromParent();
134 content_scene_layer_ = nullptr; 133 content_scene_layer_ = nullptr;
135 } 134 }
135
136 // TODO(pedrosimonetti): Consider being smarter with regards to when to
137 // add the layer to the hierarchy. For now, we need to keep adding the
138 // content_scene_layer on every frame because the content_layer is also
139 // added on every frame. This means that if we only add it once, the
140 // content_layer will be added again on the next frame and will
141 // occlude the content_scene_layer.
142 if (layer) {
143 content_scene_layer_ = layer;
144 layer_->AddChild(layer);
145 }
136 } 146 }
137 147
138 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { 148 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
139 // This will automatically bind to the Java object and pass ownership there. 149 // This will automatically bind to the Java object and pass ownership there.
140 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); 150 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj);
141 return reinterpret_cast<intptr_t>(scene_layer); 151 return reinterpret_cast<intptr_t>(scene_layer);
142 } 152 }
143 153
144 bool RegisterStaticTabSceneLayer(JNIEnv* env) { 154 bool RegisterStaticTabSceneLayer(JNIEnv* env) {
145 return RegisterNativesImpl(env); 155 return RegisterNativesImpl(env);
146 } 156 }
147 157
148 } // namespace android 158 } // namespace android
149 } // namespace chrome 159 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698