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

Unified Diff: chrome/browser/icon_loader.cc

Issue 2953633002: Move the IconLoader to use the task scheduler. (Closed)
Patch Set: sky Created 3 years, 6 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 d679bd3598331ad1bda2c5228218a4bef291b110..a4934f00ca3df3945f0716db33d63161215e256a 100644
--- a/chrome/browser/icon_loader.cc
+++ b/chrome/browser/icon_loader.cc
@@ -4,7 +4,11 @@
#include "chrome/browser/icon_loader.h"
+#include <utility>
+
#include "base/bind.h"
+#include "base/task_scheduler/post_task.h"
+#include "base/task_scheduler/task_traits.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
@@ -20,10 +24,9 @@ IconLoader* IconLoader::Create(const base::FilePath& file_path,
void IconLoader::Start() {
target_task_runner_ = base::ThreadTaskRunnerHandle::Get();
- BrowserThread::PostTaskAndReply(
- BrowserThread::FILE, FROM_HERE,
- base::BindOnce(&IconLoader::ReadGroup, base::Unretained(this)),
- base::BindOnce(&IconLoader::OnReadGroup, base::Unretained(this)));
+ base::PostTaskWithTraits(
+ FROM_HERE, traits(),
+ base::BindOnce(&IconLoader::ReadGroup, base::Unretained(this)));
}
IconLoader::IconLoader(const base::FilePath& file_path,
@@ -35,10 +38,7 @@ IconLoader::~IconLoader() {}
void IconLoader::ReadGroup() {
group_ = GroupForFilepath(file_path_);
-}
-void IconLoader::OnReadGroup() {
- BrowserThread::PostTask(
- ReadIconThreadID(), FROM_HERE,
- base::BindOnce(&IconLoader::ReadIcon, base::Unretained(this)));
+ GetReadIconTaskRunner()->PostTask(
+ FROM_HERE, base::BindOnce(&IconLoader::ReadIcon, base::Unretained(this)));
}
« 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