OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.PathUtils; | 9 import org.chromium.base.PathUtils; |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
11 import org.chromium.content.app.LibraryLoader; | 11 import org.chromium.content.app.LibraryLoader; |
12 import org.chromium.content.browser.AndroidBrowserProcess; | 12 import org.chromium.content.browser.AndroidBrowserProcess; |
13 import org.chromium.content.browser.AndroidBrowserProcessInitException; | |
13 import org.chromium.content.browser.ResourceExtractor; | 14 import org.chromium.content.browser.ResourceExtractor; |
14 | 15 |
15 /** | 16 /** |
16 * Wrapper for the steps needed to initialize the java and native sides of webvi ew chromium. | 17 * Wrapper for the steps needed to initialize the java and native sides of webvi ew chromium. |
17 */ | 18 */ |
18 public abstract class AwBrowserProcess { | 19 public abstract class AwBrowserProcess { |
19 /** | 20 /** |
20 * The name of the library to load. | 21 * The name of the library to load. |
21 */ | 22 */ |
22 private static final String NATIVE_LIBRARY = "webviewchromium"; | 23 private static final String NATIVE_LIBRARY = "webviewchromium"; |
(...skipping 16 matching lines...) Expand all Loading... | |
39 * and performs other per-app resource allocations; must not be called from zygote. | 40 * and performs other per-app resource allocations; must not be called from zygote. |
40 * Note: it is up to the caller to ensure this is only called once. | 41 * Note: it is up to the caller to ensure this is only called once. |
41 */ | 42 */ |
42 public static void start(final Context context) { | 43 public static void start(final Context context) { |
43 // We must post to the UI thread to cover the case that the user | 44 // We must post to the UI thread to cover the case that the user |
44 // has invoked Chromium startup by using the (thread-safe) | 45 // has invoked Chromium startup by using the (thread-safe) |
45 // CookieManager rather than creating a WebView. | 46 // CookieManager rather than creating a WebView. |
46 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 47 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
47 @Override | 48 @Override |
48 public void run() { | 49 public void run() { |
49 AndroidBrowserProcess.initContentViewProcess(context, | 50 try { |
50 AndroidBrowserProcess.MAX_RENDERERS_SINGLE_PROCESS); | 51 AndroidBrowserProcess.initContentViewProcess(context, |
52 AndroidBrowserProcess.MAX_RENDERERS_SINGLE_PROCESS); | |
53 } catch (AndroidBrowserProcessInitException e) { | |
54 // TODO: How do we handle the exception here? | |
joth
2012/12/21 21:53:13
throw new Error("Cannot initialize WebView", e);
| |
55 } | |
51 } | 56 } |
52 }); | 57 }); |
53 } | 58 } |
54 } | 59 } |
OLD | NEW |