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

Unified Diff: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.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
Index: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
index 9e37370edd02c25b59d3d1bcc49abc211b91f9e2..e24835b8efd464ca607c79146964f76a26cf2d05 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -18,7 +18,7 @@ import org.chromium.base.MemoryPressureListener;
import org.chromium.content.app.LibraryLoader;
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;
@@ -92,26 +92,45 @@ public class ContentShellActivity extends ChromiumActivity {
if (!TextUtils.isEmpty(startupUrl)) {
mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
}
+
+ BrowserStartupConfig.setAsync(new BrowserStartupConfig.StartupCallback() {
+
+ @Override
+ public void run(int startupResult) {
+ if (startupResult > 0) {
+ // TODO: Show error message.
+ Log.e(TAG, "ContentView initialization failed.");
+ finish();
+ } else {
+ finishInitialization();
+ }
+ }
+ });
+
if (!AndroidBrowserProcess.init(this, AndroidBrowserProcess.MAX_RENDERERS_LIMIT)) {
String shellUrl = ShellManager.DEFAULT_SHELL_URL;
if (savedInstanceState != null
- && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
+ && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
}
mShellManager.launchShell(shellUrl);
+ finishInitialization();
}
- getActiveContentView().setContentViewClient(new ContentViewClient() {
- @Override
- public ContentVideoViewClient getContentVideoViewClient() {
- return new ActivityContentVideoViewClient(ContentShellActivity.this);
- }
- });
} catch (ProcessInitException e) {
Log.e(TAG, "ContentView initialization failed.", e);
finish();
}
}
+ private void finishInitialization() {
+ getActiveContentView().setContentViewClient(new ContentViewClient() {
+ @Override
+ public ContentVideoViewClient getContentVideoViewClient() {
+ return new ActivityContentVideoViewClient(ContentShellActivity.this);
+ }
+ });
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);

Powered by Google App Engine
This is Rietveld 408576698