diff options
author | simonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 20:50:59 +0000 |
---|---|---|
committer | simonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 20:50:59 +0000 |
commit | bc0147b7ef914e76ed68cdb764a5f291f74d4200 (patch) | |
tree | a3e6c180b5275ccff612977cfedb9dc23735acc9 /chrome/browser/icon_loader.cc | |
parent | 8500eb923cea4d658e2f8e99a24d4c6667cd0ee1 (diff) | |
download | chromium_src-bc0147b7ef914e76ed68cdb764a5f291f74d4200.zip chromium_src-bc0147b7ef914e76ed68cdb764a5f291f74d4200.tar.gz chromium_src-bc0147b7ef914e76ed68cdb764a5f291f74d4200.tar.bz2 |
Removing base::ThreadRestrictions::ScopedAllowIO from icon_manager_linux.cc
Changed cache to map file paths to icons rather than by group id. Renamed
GetGroupIDFromFilepath to reflect that it can potentially do file io.
BUG=72740
TEST=Bring up downloads ui on linux and file icons still show up.
R=rdsmith@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12211049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_loader.cc')
-rw-r--r-- | chrome/browser/icon_loader.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc index d6dd947..6e16d0c 100644 --- a/chrome/browser/icon_loader.cc +++ b/chrome/browser/icon_loader.cc @@ -10,10 +10,10 @@ using content::BrowserThread; -IconLoader::IconLoader(const IconGroupID& group, IconSize size, +IconLoader::IconLoader(const base::FilePath& file_path, IconSize size, Delegate* delegate) : target_message_loop_(NULL), - group_(group), + file_path_(file_path), icon_size_(size), image_(NULL), delegate_(delegate) { @@ -25,13 +25,25 @@ IconLoader::~IconLoader() { void IconLoader::Start() { target_message_loop_ = base::MessageLoopProxy::current(); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::Bind(&IconLoader::ReadIcon, this)); + BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, + base::Bind(&IconLoader::ReadGroup, this), + base::Bind(&IconLoader::OnReadGroup, this)); +} + +void IconLoader::ReadGroup() { + group_ = ReadGroupIDFromFilepath(file_path_); +} + +void IconLoader::OnReadGroup() { + if (!delegate_->OnGroupLoaded(this, group_)) { + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, + base::Bind(&IconLoader::ReadIcon, this)); + } } void IconLoader::NotifyDelegate() { // If the delegate takes ownership of the Image, release it from the scoped // pointer. - if (delegate_->OnImageLoaded(this, image_.get())) + if (delegate_->OnImageLoaded(this, image_.get(), group_)) ignore_result(image_.release()); // Can't ignore return value. } |