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

Issue 11567061: Throw exception when initialization failed. (Closed)

Created:
8 years ago by michaelbai
Modified:
7 years, 11 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, android-webview-reviews_chromium.org, jochen+watch_chromium.org
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=176975

Patch Set 1 #

Total comments: 2

Patch Set 2 : Changed to ProcessInitException #

Total comments: 22

Patch Set 3 : Addressed comments #

Total comments: 6

Patch Set 4 : Addressed comments #

Patch Set 5 : Remove process initialization in ContentViewCore constructor #

Total comments: 13

Patch Set 6 : Addressed Joth's comments. #

Patch Set 7 : Added the error message back. #

Total comments: 2

Patch Set 8 : sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -108 lines) Patch
M android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java View 1 2 3 4 5 6 2 chunks +8 lines, -3 lines 0 comments Download
M android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java View 1 2 3 4 5 6 7 2 chunks +7 lines, -2 lines 0 comments Download
M chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java View 1 2 3 4 5 6 2 chunks +7 lines, -3 lines 0 comments Download
M chrome/app/android/chrome_main_delegate_android.cc View 1 2 1 chunk +1 line, -6 lines 0 comments Download
M content/app/android/library_loader_hooks.cc View 1 2 3 4 5 6 3 chunks +11 lines, -10 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/app/LibraryLoader.java View 1 2 3 4 5 6 chunks +10 lines, -21 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/app/SandboxedProcessService.java View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/AndroidBrowserProcess.java View 1 2 5 chunks +8 lines, -4 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentView.java View 1 2 3 4 5 6 3 chunks +5 lines, -2 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java View 1 2 3 4 5 6 7 4 chunks +5 lines, -8 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/common/ProcessInitException.java View 1 2 3 1 chunk +37 lines, -0 lines 0 comments Download
M content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java View 1 2 3 4 5 6 7 2 chunks +6 lines, -1 line 0 comments Download
M content/public/common/result_codes.h View 1 2 3 1 chunk +6 lines, -1 line 0 comments Download
M content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java View 1 2 3 4 5 6 2 chunks +25 lines, -21 lines 0 comments Download
M testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java View 1 2 3 4 5 6 7 2 chunks +21 lines, -26 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
michaelbai
Hi all, This CL is not complete, there are somewhere need to catch the exception. ...
8 years ago (2012-12-21 20:02:27 UTC) #1
joth
I think an unchecked exception would be a better fit here, and more consistent with ...
8 years ago (2012-12-21 21:53:12 UTC) #2
michaelbai
Talked to Ted, we agreed to use Exception because Error is not required to be ...
7 years, 11 months ago (2013-01-04 23:38:31 UTC) #3
michaelbai
joi@ please help to review content/public/common/result_codes.h
7 years, 11 months ago (2013-01-04 23:40:53 UTC) #4
Jói
LGTM for content/public/common. On Fri, Jan 4, 2013 at 11:40 PM, <michaelbai@chromium.org> wrote: > joi@ ...
7 years, 11 months ago (2013-01-07 12:37:16 UTC) #5
Ted C
https://codereview.chromium.org/11567061/diff/5001/android_webview/java/src/org/chromium/android_webview/AwContents.java File android_webview/java/src/org/chromium/android_webview/AwContents.java (right): https://codereview.chromium.org/11567061/diff/5001/android_webview/java/src/org/chromium/android_webview/AwContents.java#newcode279 android_webview/java/src/org/chromium/android_webview/AwContents.java:279: I think this needs to be indented 8 more ...
7 years, 11 months ago (2013-01-07 18:38:45 UTC) #6
michaelbai
Hi Ted, PTAL https://codereview.chromium.org/11567061/diff/5001/android_webview/java/src/org/chromium/android_webview/AwContents.java File android_webview/java/src/org/chromium/android_webview/AwContents.java (right): https://codereview.chromium.org/11567061/diff/5001/android_webview/java/src/org/chromium/android_webview/AwContents.java#newcode279 android_webview/java/src/org/chromium/android_webview/AwContents.java:279: On 2013/01/07 18:38:46, Ted C wrote: ...
7 years, 11 months ago (2013-01-07 23:22:07 UTC) #7
Yaron
I'm with joth on this one. This seems like it should be an Error or ...
7 years, 11 months ago (2013-01-08 00:54:21 UTC) #8
michaelbai
This Exception is what we want to catch, to make it a checked Exception will ...
7 years, 11 months ago (2013-01-08 18:06:48 UTC) #9
michaelbai
Talked to Yaron, removed unnecessary process initialization in ContentViewCore's constructor as process should be initialized ...
7 years, 11 months ago (2013-01-08 20:19:03 UTC) #10
joth
https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java File android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java (right): https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java#newcode55 android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java:55: throw new Error("Cannot initialize WebView", e); Unfortunately ThreadUtils.runOnUiThreadBlocking does ...
7 years, 11 months ago (2013-01-08 21:20:45 UTC) #11
michaelbai
Hi Joth, Please see my comment for alternative way to handle this. https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java File android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java ...
7 years, 11 months ago (2013-01-09 00:14:00 UTC) #12
michaelbai
I meant the alternative way to handle the error code in LibraryLoadedOnMainThread.
7 years, 11 months ago (2013-01-09 00:15:05 UTC) #13
joth
lgtm https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java File android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java (right): https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java#newcode55 android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java:55: throw new Error("Cannot initialize WebView", e); On 2013/01/09 ...
7 years, 11 months ago (2013-01-09 02:51:24 UTC) #14
michaelbai
https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java File android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java (right): https://codereview.chromium.org/11567061/diff/28001/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java#newcode55 android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java:55: throw new Error("Cannot initialize WebView", e); I were thinking ...
7 years, 11 months ago (2013-01-09 21:04:42 UTC) #15
Ted C
lgtm
7 years, 11 months ago (2013-01-09 23:26:27 UTC) #16
Yaron
lgtm https://codereview.chromium.org/11567061/diff/29016/content/public/android/java/src/org/chromium/content/browser/ContentView.java File content/public/android/java/src/org/chromium/content/browser/ContentView.java (right): https://codereview.chromium.org/11567061/diff/29016/content/public/android/java/src/org/chromium/content/browser/ContentView.java#newcode75 content/public/android/java/src/org/chromium/content/browser/ContentView.java:75: public static boolean enableMultiProcess(Context context, int maxRendererProcesses) This ...
7 years, 11 months ago (2013-01-10 01:43:20 UTC) #17
joth
On 9 January 2013 17:43, <yfriedman@chromium.org> wrote: > lgtm > > > > > https://codereview.chromium.**org/11567061/diff/29016/** ...
7 years, 11 months ago (2013-01-10 03:12:45 UTC) #18
michaelbai
https://codereview.chromium.org/11567061/diff/29016/content/public/android/java/src/org/chromium/content/browser/ContentView.java File content/public/android/java/src/org/chromium/content/browser/ContentView.java (right): https://codereview.chromium.org/11567061/diff/29016/content/public/android/java/src/org/chromium/content/browser/ContentView.java#newcode75 content/public/android/java/src/org/chromium/content/browser/ContentView.java:75: public static boolean enableMultiProcess(Context context, int maxRendererProcesses) I will ...
7 years, 11 months ago (2013-01-10 17:46:04 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelbai@chromium.org/11567061/29016
7 years, 11 months ago (2013-01-10 17:46:32 UTC) #20
commit-bot: I haz the power
Presubmit check for 11567061-29016 failed and returned exit status 1. Running presubmit commit checks ...
7 years, 11 months ago (2013-01-10 17:46:48 UTC) #21
michaelbai
Hi cpu, please help to review the change of chrome/app/android/chrome_main_delegate_android.cc, the removed comments and code ...
7 years, 11 months ago (2013-01-10 17:55:07 UTC) #22
cpu_(ooo_6.6-7.5)
lgtm
7 years, 11 months ago (2013-01-11 19:15:32 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelbai@chromium.org/11567061/29016
7 years, 11 months ago (2013-01-11 19:27:03 UTC) #24
commit-bot: I haz the power
Retried try job too often on win7_aura for step(s) browser_tests
7 years, 11 months ago (2013-01-12 13:26:48 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelbai@chromium.org/11567061/55001
7 years, 11 months ago (2013-01-14 19:40:55 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelbai@chromium.org/11567061/55001
7 years, 11 months ago (2013-01-15 21:35:26 UTC) #27
commit-bot: I haz the power
7 years, 11 months ago (2013-01-15 21:43:21 UTC) #28
Message was sent while issue was closed.
Change committed as 176975

Powered by Google App Engine
This is Rietveld 408576698