Bug 842374 - Use GeckoAsyncTask instead of AsyncTask when removing bookmarks r=kats

This commit is contained in:
Mark Finkle 2013-02-19 16:14:35 -05:00
parent 9201ca1d15
commit 9d9a2b65fa
2 changed files with 13 additions and 7 deletions

View File

@ -19,7 +19,6 @@ import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
@ -613,7 +612,7 @@ public class AwesomeBar extends GeckoActivity {
break;
}
case R.id.remove_bookmark: {
(new AsyncTask<Void, Void, Void>() {
(new GeckoAsyncTask<Void, Void, Void>(GeckoApp.mAppContext, GeckoAppShell.getHandler()) {
private boolean mInReadingList;
@Override

View File

@ -41,11 +41,17 @@ public abstract class GeckoAsyncTask<Params, Progress, Result> {
}
public final void execute(final Params... params) {
BackgroundTaskRunnable runnable = new BackgroundTaskRunnable(params);
if (mPriority == Priority.HIGH)
mBackgroundThreadHandler.postAtFrontOfQueue(runnable);
else
mBackgroundThreadHandler.post(runnable);
mActivity.runOnUiThread(new Runnable() {
public void run() {
onPreExecute();
BackgroundTaskRunnable runnable = new BackgroundTaskRunnable(params);
if (mPriority == Priority.HIGH)
mBackgroundThreadHandler.postAtFrontOfQueue(runnable);
else
mBackgroundThreadHandler.post(runnable);
}
});
}
public final GeckoAsyncTask<Params, Progress, Result> setPriority(Priority priority) {
@ -54,6 +60,7 @@ public abstract class GeckoAsyncTask<Params, Progress, Result> {
}
/* Empty stub method. Implementors can optionally override this if they need it */
protected void onPreExecute() { }
protected void onPostExecute(Result result) { }
protected abstract Result doInBackground(Params... params);