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

Unified Diff: chrome/browser/icon_loader.cc

Issue 12211049: Removing base::ThreadRestrictions::ScopedAllowIO from icon_manager_linux.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader.cc
diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc
index d6dd947a1b784b9d9958b56829a5eed42ee9aec8..6e16d0cdfc0b91ad5a51037a34c03eb502ee409c 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.
}
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698