Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,16 @@ public void run() {

/**
* Finish a JS task. Doesn't actually stop the task on the JS side, only removes it from the list
* of active tasks and notifies listeners. A task can only be finished once.
* of active tasks and notifies listeners.
*
* @param taskId the unique id returned by {@link #startTask}.
*/
public synchronized void finishTask(final int taskId) {
Assertions.assertCondition(
mActiveTasks.remove(taskId), "Tried to finish non-existent task with id " + taskId + ".");
Assertions.assertCondition(
mActiveTaskConfigs.remove(taskId) != null,
"Tried to remove non-existent task config with id " + taskId + ".");
boolean removed = mActiveTasks.remove(taskId);
mActiveTaskConfigs.remove(taskId);
removeTimeout(taskId);
UiThreadUtil.runOnUiThread(
if (removed) {
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
Expand All @@ -189,6 +187,7 @@ public void run() {
}
}
});
}
}

private void removeTimeout(int taskId) {
Expand Down