diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-06-12 16:02:03 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-06-19 15:03:08 +0100 |
commit | 03ce9b3e69f1eec85e7e7cbfd65bb9093e74cea8 (patch) | |
tree | 5ab5fa849c46fbb9fb773b303d9e136906fac8bc /core/java/android/webkit/WebViewClassic.java | |
parent | 4b77dbb2068b357a09db86102a391d27ffd84a19 (diff) | |
download | frameworks_base-03ce9b3e69f1eec85e7e7cbfd65bb9093e74cea8.zip frameworks_base-03ce9b3e69f1eec85e7e7cbfd65bb9093e74cea8.tar.gz frameworks_base-03ce9b3e69f1eec85e7e7cbfd65bb9093e74cea8.tar.bz2 |
Enable preloading of the appropriate WebView.
Allow the appropriate WebView to be preloaded in the zygote by
constructing the currently selected WebViewFactoryProvider when the
WebViewFactory is preloaded. At runtime, if the preloaded provider is
still the current selection, the preloaded instance is used, otherwise
the provider is loaded at that time.
This change also removes "graceful" fallback from the experimental
WebView to the classic implementation: if the option to use the
experimental WebView is selected and it could not be loaded
successfully at the time a WebView is created, an exception will be
thrown, rather than allowing execution to continue with the classic
implementation, as the fallback may mislead developers who do not
examine logcat output in detail.
Change-Id: I0cd01c784d7048abeac55ab5863ca16b8fd9ecf2
Diffstat (limited to 'core/java/android/webkit/WebViewClassic.java')
-rw-r--r-- | core/java/android/webkit/WebViewClassic.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index a324502..3afab09 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -66,6 +66,7 @@ import android.text.Editable; import android.text.InputType; import android.text.Selection; import android.text.TextUtils; +import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; @@ -1293,6 +1294,19 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc // WebViewProvider bindings static class Factory implements WebViewFactoryProvider, WebViewFactoryProvider.Statics { + Factory() { + // Touch JniUtil and WebViewCore in case this is being called from + // WebViewFactory.Preloader, to ensure that the JNI libraries that they use are + // preloaded in the zygote. + try { + Class.forName("android.webkit.JniUtil"); + Class.forName("android.webkit.WebViewCore"); + } catch (ClassNotFoundException e) { + Log.e(LOGTAG, "failed to load JNI libraries"); + throw new AndroidRuntimeException(e); + } + } + @Override public String findAddress(String addr) { return WebViewClassic.findAddress(addr); |