Commit b17eddd6 authored by Sam Maier's avatar Sam Maier Committed by Commit Bot

Android: Webapp register and get splash screen AsyncTasks to thread pool

Currently, AsyncTask.execute() defaults to the SERIAL_EXECUTOR. This
exector is good for preventing concurrency errors since it guarantees
serial execution, but bad for performance since the entire app shares
this single queue.

It looks like these callsites can use the THREAD_POOL_EXECUTOR instead,
since these usages don't appear to rely on the concurrency guarantees
that SERIAL_EXECUTOR provides.

Bug: 869907
Change-Id: Iaf227dc516d1b2c850b9b17ce5d43302ab6532b2
Reviewed-on: https://chromium-review.googlesource.com/1161968Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Sam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580780}
parent 632667b1
......@@ -13,6 +13,7 @@ import org.robolectric.shadows.ShadowApplication;
import org.chromium.base.AsyncTask;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -44,6 +45,12 @@ public class BackgroundShadowAsyncTask<Result> extends ShadowAsyncTask<Result> {
}
}
@Override
@Implementation
public final AsyncTask<Result> executeOnExecutor(Executor e) {
return execute();
}
@Override
@Implementation
public final Result get() {
......
......@@ -183,7 +183,7 @@ public class WebappDataStorage {
callback.onDataRetrieved(result);
}
}
.execute();
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
/**
......
......@@ -136,7 +136,7 @@ public class WebappRegistry {
if (callback != null) callback.onWebappDataStorageRetrieved(storage);
}
}
.execute();
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment