Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1065)

Unified Diff: chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java

Issue 19957002: Run the later parts of startup as UI thread tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run the later parts of startup as UI thread tasks - Jam's nits Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
index 98df0c1afbd1f5a8ad9cabae2110ee65ec2c5f0f..b53c80d876715eb312d7e7d862802d76358dc5b7 100644
--- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
+++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
@@ -16,7 +16,7 @@ import org.chromium.base.MemoryPressureListener;
import org.chromium.chrome.browser.DevToolsServer;
import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.AndroidBrowserProcess;
-import org.chromium.content.browser.ContentVideoView;
+import org.chromium.content.browser.BrowserStartupConfig;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewClient;
@@ -51,19 +51,39 @@ public class ChromiumTestShellActivity extends ChromiumActivity {
private DevToolsServer mDevToolsServer;
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_FILE);
waitForDebuggerIfNeeded();
DeviceUtils.addDeviceSpecificUserAgentSwitch(this);
+
+ BrowserStartupConfig.setAsync(new BrowserStartupConfig.StartupCallback() {
+ @Override
+ public void run(int startupResult) {
+ if (startupResult > 0) {
+ // TODO: Show error message.
+ Log.e(TAG, "Chromium browser process initialization failed");
+ finish();
+ } else {
+ finishInitialization(savedInstanceState);
+ }
+ }
+ });
+
try {
- AndroidBrowserProcess.init(this, AndroidBrowserProcess.MAX_RENDERERS_LIMIT);
+ if (!AndroidBrowserProcess.init(this, AndroidBrowserProcess.MAX_RENDERERS_LIMIT)) {
+ // Process was already running, finish initialization now.
+ finishInitialization(savedInstanceState);
+ }
} catch (ProcessInitException e) {
Log.e(TAG, "Chromium browser process initialization failed", e);
finish();
}
+ }
+
+ private void finishInitialization(final Bundle savedInstanceState) {
setContentView(R.layout.testshell_activity);
mTabManager = (TabManager) findViewById(R.id.tab_manager);
String startupUrl = getUrlFromIntent(getIntent());
@@ -161,6 +181,7 @@ public class ChromiumTestShellActivity extends ChromiumActivity {
/**
* Creates a {@link TestShellTab} with a URL specified by {@code url}.
+ *
* @param url The URL the new {@link TestShellTab} should start with.
*/
public void createTab(String url) {
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698