Make GeckoAsyncTask's dependency on Activity optional

RESOLVED INVALID

Status

()

P3
normal
RESOLVED INVALID
6 years ago
5 years ago

People

(Reporter: cpeterson, Assigned: sriram)

Tracking

Trunk
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
In bug 778468 comment 21, Sriram suggests:


Untangling a bit more..

 mActivity.runOnUiThread(new Runnable() { ... }); in GeckoAsyncTask

Ideally GeckoAsyncTask doesn't need to know about the activity, if its used only for a small background task. So, this can have a null check for mActivity, there by, I can do a small background task with the GeckoAsyncTask.

This will be helpful in Tab.java (and others). So,

updateBookmark() {
  ...
  (new GeckoAsyncTask(null, ...) {
     doInBackground() {
       ...
     }
   }).execute();
}


If it really wants a notification after completion, then GeckoAsyncTask will be like..

GeckoAsyncTask(args-list) {
  setUIHandler() {
    mUIHandler = GeckoAsyncTask.UIHandler;
  }

  doInBackground() { ... }

  run() {
    if (mUIHandler) { mUIHandler.notifyProcessDone(); }
}

and GeckoAsyncTask.UIHandler is just an interface.


This will help anything -- that's not an activity -- to make use of GeckoAsyncTask. Say, a BrowserToolbar wants to use GeckoAsyncTask,

  (new GeckoAsyncTask(args) {
    doInBackground() { ... }
  }).setUIHandler(new GeckoAsyncTask.UIHandler() {
     notifyProcessDone() { .. browser-toolbar's-ui-tasks }
  }).execute();

... aaahh.. that's finally Javascript! :(
(Assignee)

Updated

6 years ago
Assignee: nobody → sriram
UiAsyncTask no longer has any dependency on Activity, so closing.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.