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

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

Issue 2320623003: Move title creation logic to native (Closed)
Patch Set: address comments 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 jint except_id) { 92 jint except_id) {
93 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_); 93 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_);
94 for (; !iter.IsAtEnd(); iter.Advance()) { 94 for (; !iter.IsAtEnd(); iter.Advance()) {
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 if (!layer_cache_.Lookup(tab_id)) {
103 JNIEnv* env = base::android::AttachCurrentThread();
104 Java_LayerTitleCache_buildUpdatedTitle(env, weak_java_title_cache_.get(env),
105 tab_id);
106 }
107
102 return layer_cache_.Lookup(tab_id); 108 return layer_cache_.Lookup(tab_id);
103 } 109 }
104 110
105 void LayerTitleCache::SetResourceManager( 111 void LayerTitleCache::SetResourceManager(
106 ui::ResourceManager* resource_manager) { 112 ui::ResourceManager* resource_manager) {
107 resource_manager_ = resource_manager; 113 resource_manager_ = resource_manager;
108 114
109 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_); 115 IDMap<DecorationTitle, IDMapOwnPointer>::iterator iter(&layer_cache_);
110 for (; !iter.IsAtEnd(); iter.Advance()) { 116 for (; !iter.IsAtEnd(); iter.Advance()) {
111 iter.GetCurrentValue()->SetResourceManager(resource_manager_); 117 iter.GetCurrentValue()->SetResourceManager(resource_manager_);
(...skipping 19 matching lines...) Expand all
131 jint spinner_resource_id, 137 jint spinner_resource_id,
132 jint spinner_incognito_resource_id) { 138 jint spinner_incognito_resource_id) {
133 LayerTitleCache* cache = new LayerTitleCache( 139 LayerTitleCache* cache = new LayerTitleCache(
134 env, obj, fade_width, favicon_start_padding, favicon_end_padding, 140 env, obj, fade_width, favicon_start_padding, favicon_end_padding,
135 spinner_resource_id, spinner_incognito_resource_id); 141 spinner_resource_id, spinner_incognito_resource_id);
136 return reinterpret_cast<intptr_t>(cache); 142 return reinterpret_cast<intptr_t>(cache);
137 } 143 }
138 144
139 } // namespace android 145 } // namespace android
140 } // namespace chrome 146 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerDocumentTabSwitcher.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698