summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authoraberent@chromium.org <aberent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 14:28:52 +0000
committeraberent@chromium.org <aberent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 14:28:52 +0000
commite161710d52ed947f419f077c919cf7f05283da1d (patch)
tree36828a407172030163296b74cc4d2e796d945ef9 /content/shell
parentac30ee4d7a5b91c07f18ab36eb8b1783f32f8045 (diff)
downloadchromium_src-e161710d52ed947f419f077c919cf7f05283da1d.zip
chromium_src-e161710d52ed947f419f077c919cf7f05283da1d.tar.gz
chromium_src-e161710d52ed947f419f077c919cf7f05283da1d.tar.bz2
Check library version and handle library load errors
This CL modifies the build to incorporate the expected C++ library version in the Java code. This is then checked when the library is loaded, to make sure that the C++ and Java builds match. This CL also implements error handling when library loads fail or the loaded version doesn't match the expected version. BUG=311644 Review URL: https://codereview.chromium.org/59533009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java1
-rw-r--r--content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java46
2 files changed, 29 insertions, 18 deletions
diff --git a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
index ef8f048..bab7240 100644
--- a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
+++ b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
@@ -34,6 +34,7 @@ public class ContentBrowserTestsActivity extends Activity {
LibraryLoader.ensureInitialized();
} catch (ProcessInitException e) {
Log.i(TAG, "Cannot load content_browsertests:" + e);
+ System.exit(-1);
}
BrowserStartupController.get(getApplicationContext()).initChromiumBrowserProcessForTests();
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 dc3e9b0..4166623 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
@@ -62,7 +62,9 @@ public class ContentShellActivity extends Activity {
LibraryLoader.ensureInitialized();
} catch (ProcessInitException e) {
Log.e(TAG, "ContentView initialization failed.", e);
- finish();
+ // Since the library failed to initialize nothing in the application
+ // can work, so kill the whole application not just the activity
+ System.exit(-1);
return;
}
@@ -78,25 +80,33 @@ public class ContentShellActivity extends Activity {
}
if (CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) {
- if(BrowserStartupController.get(this).startBrowserProcessesSync(
- BrowserStartupController.MAX_RENDERERS_LIMIT)) {
- finishInitialization(savedInstanceState);
- } else {
- initializationFailed();
+ try {
+ BrowserStartupController.get(this).startBrowserProcessesSync(
+ BrowserStartupController.MAX_RENDERERS_LIMIT);
+ }
+ catch (ProcessInitException e) {
+ Log.e(TAG, "Failed to load native library.", e);
+ System.exit(-1);
}
} else {
- BrowserStartupController.get(this).startBrowserProcessesAsync(
- new BrowserStartupController.StartupCallback() {
- @Override
- public void onSuccess(boolean alreadyStarted) {
- finishInitialization(savedInstanceState);
- }
-
- @Override
- public void onFailure() {
- initializationFailed();
- }
- });
+ try {
+ BrowserStartupController.get(this).startBrowserProcessesAsync(
+ new BrowserStartupController.StartupCallback() {
+ @Override
+ public void onSuccess(boolean alreadyStarted) {
+ finishInitialization(savedInstanceState);
+ }
+
+ @Override
+ public void onFailure() {
+ initializationFailed();
+ }
+ });
+ }
+ catch (ProcessInitException e) {
+ Log.e(TAG, "Unable to load native library.", e);
+ System.exit(-1);
+ }
}
}