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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 2218413002: Calls ShortcutHelper::FinalizeLauncherIcon() on worker thread instead of on IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
index 0ffe0adf17e0b10b6f999a73923cb72753a5f130..a629d3df976cd2899a8965eb1eb21d7fd2e53307 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
@@ -211,19 +211,17 @@ void AddToHomescreenDataFetcher::OnFaviconFetched(
if (!web_contents() || !weak_observer_ || is_icon_saved_)
return;
- content::BrowserThread::PostTask(
- content::BrowserThread::IO,
+ content::BrowserThread::PostBlockingPoolTask(
dominickn 2016/08/08 03:13:42 I'm not sure if creating a launcher icon should bl
gone 2016/08/08 17:14:11 If you're thinking about shutdown on Android, we d
FROM_HERE,
- base::Bind(&AddToHomescreenDataFetcher::CreateLauncherIcon,
- this,
- bitmap_result));
+ base::Bind(&AddToHomescreenDataFetcher::CreateLauncherIconInBackground,
+ this, bitmap_result));
}
-void AddToHomescreenDataFetcher::CreateLauncherIcon(
+void AddToHomescreenDataFetcher::CreateLauncherIconInBackground(
const favicon_base::FaviconRawBitmapResult& bitmap_result) {
if (!web_contents() || !weak_observer_) return;
- DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
SkBitmap icon_bitmap;
if (bitmap_result.is_valid()) {
gfx::PNGCodec::Decode(bitmap_result.bitmap_data->front(),
@@ -233,9 +231,8 @@ void AddToHomescreenDataFetcher::CreateLauncherIcon(
bool is_generated = false;
if (weak_observer_) {
- icon_bitmap = weak_observer_->FinalizeLauncherIcon(icon_bitmap,
- shortcut_info_.url,
- &is_generated);
+ icon_bitmap = weak_observer_->FinalizeLauncherIconInBackground(
+ icon_bitmap, shortcut_info_.url, &is_generated);
}
shortcut_info_.icon_url = is_generated ? GURL() : bitmap_result.icon_url;

Powered by Google App Engine
This is Rietveld 408576698