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

Side by Side Diff: chrome/browser/icon_loader_chromeos.cc

Issue 2707753004: Switch IconLoader::ReadIconThreadID from FILE to UI (Closed)
Patch Set: rebase Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/icon_loader.h" 5 #include "chrome/browser/icon_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } // namespace 185 } // namespace
186 186
187 // static 187 // static
188 IconLoader::IconGroup IconLoader::GroupForFilepath( 188 IconLoader::IconGroup IconLoader::GroupForFilepath(
189 const base::FilePath& file_path) { 189 const base::FilePath& file_path) {
190 return base::ToLowerASCII(file_path.Extension()); 190 return base::ToLowerASCII(file_path.Extension());
191 } 191 }
192 192
193 // static 193 // static
194 content::BrowserThread::ID IconLoader::ReadIconThreadID() { 194 content::BrowserThread::ID IconLoader::ReadIconThreadID() {
195 return content::BrowserThread::FILE; 195 return content::BrowserThread::UI;
sky 2017/02/22 17:12:02 Please add a comment. It isn't readily obvious why
tzik 2017/02/22 22:02:56 Done.
196 } 196 }
197 197
198 void IconLoader::ReadIcon() { 198 void IconLoader::ReadIcon() {
199 static base::LazyInstance<IconMapper>::Leaky icon_mapper = 199 static base::LazyInstance<IconMapper>::Leaky icon_mapper =
200 LAZY_INSTANCE_INITIALIZER; 200 LAZY_INSTANCE_INITIALIZER;
201 int idr = icon_mapper.Get().Lookup(group_, icon_size_); 201 int idr = icon_mapper.Get().Lookup(group_, icon_size_);
202 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 202 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
203 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), 203 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(),
204 IconSizeToDIPSize(icon_size_))); 204 IconSizeToDIPSize(icon_size_)));
205 image_skia.MakeThreadSafe(); 205 image_skia.MakeThreadSafe();
206 std::unique_ptr<gfx::Image> image = base::MakeUnique<gfx::Image>(image_skia); 206 std::unique_ptr<gfx::Image> image = base::MakeUnique<gfx::Image>(image_skia);
207 target_task_runner_->PostTask( 207 target_task_runner_->PostTask(
208 FROM_HERE, base::Bind(callback_, base::Passed(&image), group_)); 208 FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
209 delete this; 209 delete this;
210 } 210 }
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