diff options
author | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 21:43:18 +0000 |
---|---|---|
committer | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 21:43:18 +0000 |
commit | 86ebc8f3731a84fea14e8688da4eb55aba87008a (patch) | |
tree | 2639dccb20377423690fa69468c1df9a0e6de31d /content/shell/android | |
parent | f5411e2e50d20ad0c54336fd552a86f36f2b9e63 (diff) | |
download | chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.zip chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.tar.gz chromium_src-86ebc8f3731a84fea14e8688da4eb55aba87008a.tar.bz2 |
Throw exception when initialization failed.
Previously the initialization return code was ignored, it will lead us
crash later. We need a way to exit and maybe show error message if something
wrong during initialization.
Using exception might better than returning the result code since the
initialization code could be called from constructor and initialization
error is an exception at most of time.
In activity, the exception is caught, then call finish() to exit.
In tests, the exception is wrapped with Error and threw out.
BUG=b/7705055
Review URL: https://chromiumcodereview.appspot.com/11567061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/android')
-rw-r--r-- | content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java index a0d1682..cd3e546 100644 --- a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java +++ b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java @@ -22,6 +22,7 @@ import org.chromium.content.browser.ContentView; import org.chromium.content.browser.DeviceUtils; import org.chromium.content.browser.TracingIntentHandler; import org.chromium.content.common.CommandLine; +import org.chromium.content.common.ProcessInitException; import org.chromium.ui.gfx.ActivityNativeWindow; /** @@ -59,29 +60,32 @@ public class ContentShellActivity extends ChromiumActivity { waitForDebuggerIfNeeded(); DeviceUtils.addDeviceSpecificUserAgentSwitch(this); - - LibraryLoader.ensureInitialized(); - - setContentView(R.layout.content_shell_activity); - mShellManager = (ShellManager) findViewById(R.id.shell_container); - mActivityNativeWindow = new ActivityNativeWindow(this); - mActivityNativeWindow.restoreInstanceState(savedInstanceState); - mShellManager.setWindow(mActivityNativeWindow); - ContentVideoView.registerContentVideoViewContextDelegate( - new ActivityContentVideoViewDelegate(this)); - - String startupUrl = getUrlFromIntent(getIntent()); - if (!TextUtils.isEmpty(startupUrl)) { - mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); - } - - if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC)) { - String shellUrl = DEFAULT_SHELL_URL; - if (savedInstanceState != null + try { + LibraryLoader.ensureInitialized(); + + setContentView(R.layout.content_shell_activity); + mShellManager = (ShellManager) findViewById(R.id.shell_container); + mActivityNativeWindow = new ActivityNativeWindow(this); + mActivityNativeWindow.restoreInstanceState(savedInstanceState); + mShellManager.setWindow(mActivityNativeWindow); + ContentVideoView.registerContentVideoViewContextDelegate( + new ActivityContentVideoViewDelegate(this)); + + String startupUrl = getUrlFromIntent(getIntent()); + if (!TextUtils.isEmpty(startupUrl)) { + mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); + } + if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC)) { + String shellUrl = DEFAULT_SHELL_URL; + if (savedInstanceState != null && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { - shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); + shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); + } + mShellManager.launchShell(shellUrl); } - mShellManager.launchShell(shellUrl); + } catch (ProcessInitException e) { + Log.e(TAG, "ContentView initialization failed.", e); + finish(); } } |