Move the IconLoader to use the task scheduler.

This follows https://codereview.chromium.org/2953633002
This commit is contained in:
Yury Solovyov 2018-01-08 13:21:22 +03:00
parent b3743058c0
commit 49844b6e5b
5 changed files with 33 additions and 20 deletions

View file

@ -17,10 +17,11 @@ IconLoader::IconGroup IconLoader::GroupForFilepath(
}
// static
content::BrowserThread::ID IconLoader::ReadIconThreadID() {
scoped_refptr<base::TaskRunner> IconLoader::GetReadIconTaskRunner() {
// ReadIcon() calls into views::LinuxUI and GTK2 code, so it must be on the UI
// thread.
return content::BrowserThread::UI;
return content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI);
}
void IconLoader::ReadIcon() {
@ -50,6 +51,6 @@ void IconLoader::ReadIcon() {
}
target_task_runner_->PostTask(
FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
FROM_HERE, base::BindOnce(callback_, base::Passed(&image), group_));
delete this;
}