Chromium Code Reviews| Index: chrome/browser/icon_loader.h |
| diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h |
| index 837be967356c45ed26169a6b9091a2185073bee2..5a838e5118ad1dbd73a26b22579b6740f7ef286e 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> ReadIconTaskRunner(); |
|
sky
2017/06/22 21:20:49
Mild preference for GetReadIconTaskRunner() as rea
Avi (use Gerrit)
2017/06/22 21:46:34
Done.
|
| 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_; |