Bug 1243307 - Post: convert AsyncTask to ThreadUtils.postToBackgroundThread r=liuche
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 01 Feb 2016 15:38:35 -0800
changeset 319180 38af002bb7340fc73b1d2d2c7e261cbf610a3bf7
parent 319179 4260f9f8a7181f212170275acd5286dd6c4c0282
child 319181 a81960ce939edd6bff30d85fa07350e780901dac
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1243307
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1243307 - Post: convert AsyncTask to ThreadUtils.postToBackgroundThread r=liuche
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1301,23 +1301,23 @@ public class BrowserApp extends GeckoApp
             }
 
             final String url = tab.getURL();
             final String title = tab.getDisplayTitle();
             if (url == null || title == null) {
                 return true;
             }
 
-            new AsyncTask<Void, Void, Void>() {
+            ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
-                protected Void doInBackground(Void... voids) {
+                public void run() {
                     GeckoAppShell.createShortcut(title, url);
-                    return null;
+
                 }
-            }.execute();
+            });
 
             Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU,
                 getResources().getResourceEntryName(itemId));
             return true;
         }
 
         return false;
     }
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
@@ -216,23 +216,24 @@ public abstract class HomeFragment exten
         if (itemId == R.id.home_add_to_launcher) {
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't add to home screen because URL is null");
                 return false;
             }
 
             // Fetch an icon big enough for use as a home screen icon.
             final String displayTitle = info.getDisplayTitle();
-            new AsyncTask<Void, Void, Void>() {
+            ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
-                protected Void doInBackground(Void... voids) {
+                public void run() {
                     GeckoAppShell.createShortcut(displayTitle, info.url);
-                    return null;
+
                 }
-            }.execute();
+            });
+
             return true;
         }
 
         if (itemId == R.id.home_open_private_tab || itemId == R.id.home_open_new_tab) {
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't open in new tab because URL is null");
                 return false;
             }