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

Side by Side Diff: chrome/browser/android/shortcut_helper.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: Merge branch 'master' into webapk_builder_impl2_thread0 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/shortcut_helper.h" 5 #include "chrome/browser/android/shortcut_helper.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ScopedJavaLocalRef<jobject> java_splash_image = 229 ScopedJavaLocalRef<jobject> java_splash_image =
230 gfx::ConvertToJavaBitmap(&splash_image); 230 gfx::ConvertToJavaBitmap(&splash_image);
231 231
232 Java_ShortcutHelper_storeWebappSplashImage( 232 Java_ShortcutHelper_storeWebappSplashImage(
233 env, 233 env,
234 java_webapp_id.obj(), 234 java_webapp_id.obj(),
235 java_splash_image.obj()); 235 java_splash_image.obj());
236 } 236 }
237 237
238 // static 238 // static
239 SkBitmap ShortcutHelper::FinalizeLauncherIcon(const SkBitmap& bitmap, 239 SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground(
240 const GURL& url, 240 const SkBitmap& bitmap,
241 bool* is_generated) { 241 const GURL& url,
242 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 242 bool* is_generated) {
243 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
243 244
244 JNIEnv* env = base::android::AttachCurrentThread(); 245 JNIEnv* env = base::android::AttachCurrentThread();
245 ScopedJavaLocalRef<jobject> result; 246 ScopedJavaLocalRef<jobject> result;
246 *is_generated = false; 247 *is_generated = false;
247 248
248 if (!bitmap.isNull()) { 249 if (!bitmap.isNull()) {
249 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(), 250 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(),
250 bitmap.height())) { 251 bitmap.height())) {
251 ScopedJavaLocalRef<jobject> java_bitmap = 252 ScopedJavaLocalRef<jobject> java_bitmap =
252 gfx::ConvertToJavaBitmap(&bitmap); 253 gfx::ConvertToJavaBitmap(&bitmap);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DCHECK(jsplash_image_callback); 306 DCHECK(jsplash_image_callback);
306 base::Closure* splash_image_callback = 307 base::Closure* splash_image_callback =
307 reinterpret_cast<base::Closure*>(jsplash_image_callback); 308 reinterpret_cast<base::Closure*>(jsplash_image_callback);
308 splash_image_callback->Run(); 309 splash_image_callback->Run();
309 delete splash_image_callback; 310 delete splash_image_callback;
310 } 311 }
311 312
312 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { 313 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) {
313 return RegisterNativesImpl(env); 314 return RegisterNativesImpl(env);
314 } 315 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_helper.h ('k') | chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698