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

Unified Diff: chrome/browser/icon_loader.cc

Issue 2586003002: patch from issue 2577273002 at patchset 20001 (http://crrev.com/2577273002#ps20001)
Patch Set: Convert to OnceCallback, and make it compile at least on Linux. Created 4 years 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_auralinux.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 262bc54a12e8aea0c863edebbf6809fb332df9e4..976320e0a3d4b7bfc552bb2be8643e9e4a9a378e 100644
--- a/chrome/browser/icon_loader.cc
+++ b/chrome/browser/icon_loader.cc
@@ -12,10 +12,8 @@ using content::BrowserThread;
IconLoader::IconLoader(const base::FilePath& file_path,
IconSize size,
- Delegate* delegate)
- : file_path_(file_path),
- icon_size_(size),
- delegate_(delegate) {}
+ IconLoadedCallback callback)
+ : file_path_(file_path), icon_size_(size), callback_(std::move(callback)) {}
IconLoader::~IconLoader() {
}
@@ -23,9 +21,10 @@ IconLoader::~IconLoader() {
void IconLoader::Start() {
target_task_runner_ = base::ThreadTaskRunnerHandle::Get();
- BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE,
- base::Bind(&IconLoader::ReadGroup, this),
- base::Bind(&IconLoader::OnReadGroup, this));
+ BrowserThread::PostTaskAndReply(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&IconLoader::ReadGroup, base::Unretained(this)),
+ base::Bind(&IconLoader::OnReadGroup, base::Unretained(this)));
}
void IconLoader::ReadGroup() {
@@ -33,10 +32,7 @@ void IconLoader::ReadGroup() {
}
void IconLoader::OnReadGroup() {
- BrowserThread::PostTask(ReadIconThreadID(), FROM_HERE,
- base::Bind(&IconLoader::ReadIcon, this));
-}
-
-void IconLoader::NotifyDelegate() {
- delegate_->OnImageLoaded(this, std::move(image_), group_);
+ BrowserThread::PostTask(
+ ReadIconThreadID(), FROM_HERE,
+ base::Bind(&IconLoader::ReadIcon, base::Unretained(this)));
}
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698