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

Side by Side Diff: chrome/browser/android/compositor/layer_title_cache.cc

Issue 2320623003: Move title creation logic to native (Closed)
Patch Set: don't trigger creation inside of GetTitleLayer Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layer_title_cache.h" 5 #include "chrome/browser/android/compositor/layer_title_cache.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 const int id = iter.GetCurrentKey(); 95 const int id = iter.GetCurrentKey();
96 if (id != except_id) 96 if (id != except_id)
97 layer_cache_.Remove(id); 97 layer_cache_.Remove(id);
98 } 98 }
99 } 99 }
100 100
101 DecorationTitle* LayerTitleCache::GetTitleLayer(int tab_id) { 101 DecorationTitle* LayerTitleCache::GetTitleLayer(int tab_id) {
102 return layer_cache_.Lookup(tab_id); 102 return layer_cache_.Lookup(tab_id);
103 } 103 }
104 104
105 void LayerTitleCache::BuildTitleLayer(int tab_id) {
David Trainor- moved to gerrit 2016/09/09 05:29:09 Should this logic just live in GetTitleLayer?
mdjones 2016/09/09 15:40:13 Done.
106 if (layer_cache_.Lookup(tab_id))
107 return;
108
109 JNIEnv* env = base::android::AttachCurrentThread();
110 Java_LayerTitleCache_buildUpdatedTitle(env, weak_java_title_cache_.get(env),
111 tab_id);
112 }
113
105 void LayerTitleCache::SetResourceManager( 114 void LayerTitleCache::SetResourceManager(
106 ui::ResourceManager* resource_manager) { 115 ui::ResourceManager* resource_manager) {
107 resource_manager_ = resource_manager; 116 resource_manager_ = resource_manager;
108 117
109 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_); 118 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_);
110 for (; !iter.IsAtEnd(); iter.Advance()) { 119 for (; !iter.IsAtEnd(); iter.Advance()) {
111 iter.GetCurrentValue()->SetResourceManager(resource_manager_); 120 iter.GetCurrentValue()->SetResourceManager(resource_manager_);
112 } 121 }
113 } 122 }
114 123
(...skipping 16 matching lines...) Expand all
131 jint spinner_resource_id, 140 jint spinner_resource_id,
132 jint spinner_incognito_resource_id) { 141 jint spinner_incognito_resource_id) {
133 LayerTitleCache* cache = new LayerTitleCache( 142 LayerTitleCache* cache = new LayerTitleCache(
134 env, obj, fade_width, favicon_start_padding, favicon_end_padding, 143 env, obj, fade_width, favicon_start_padding, favicon_end_padding,
135 spinner_resource_id, spinner_incognito_resource_id); 144 spinner_resource_id, spinner_incognito_resource_id);
136 return reinterpret_cast<intptr_t>(cache); 145 return reinterpret_cast<intptr_t>(cache);
137 } 146 }
138 147
139 } // namespace android 148 } // namespace android
140 } // namespace chrome 149 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698