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

Unified Diff: chrome/browser/icon_loader.h

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 | « no previous file | chrome/browser/icon_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader.h
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h
index 837be967356c45ed26169a6b9091a2185073bee2..fc91909d86dfc3dd1b28203360d0f6f0c3fdd752 100644
--- a/chrome/browser/icon_loader.h
+++ b/chrome/browser/icon_loader.h
@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/task_traits.h"
#include "build/build_config.h"
#include "content/public/browser/browser_thread.h"
#include "ui/gfx/image/image.h"
@@ -66,13 +67,19 @@ class IconLoader {
// Given a file path, get the group for the given file.
static IconGroup GroupForFilepath(const base::FilePath& file_path);
- // The thread ReadIcon() should be called on.
- static content::BrowserThread::ID ReadIconThreadID();
+ // The TaskRunner that ReadIcon() must be called on.
+ static scoped_refptr<base::TaskRunner> GetReadIconTaskRunner();
void ReadGroup();
- void OnReadGroup();
void ReadIcon();
+ // The traits of the tasks posted by this class. These operations may block,
+ // because they are fetching icons from the disk, yet the result will be seen
+ // by the user so they should be prioritized accordingly.
+ static constexpr base::TaskTraits traits() {
+ return {base::MayBlock(), base::TaskPriority::USER_VISIBLE};
+ }
+
// The task runner object of the thread in which we notify the delegate.
scoped_refptr<base::SingleThreadTaskRunner> target_task_runner_;
« no previous file with comments | « no previous file | chrome/browser/icon_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698