summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Dixon <joth@google.com>2013-10-09 23:21:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-09 23:21:27 +0000
commita679c94584888adc39738c132940cdc6f0244618 (patch)
treed5e7be6f92a2527589b0ed7f13c24bf07f43b911
parent80f7472a95cdbbf85a62431bf061eeef29c9d697 (diff)
parent916f857e0af25e8b179f60f532065386607567d7 (diff)
downloadwebview-a679c94584888adc39738c132940cdc6f0244618.tar.gz
Merge "For apps targeting JB MR2+, bind to the first thread using WebView" into klp-dev
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewChromium.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java
index 9d71c62..efeabf9 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromium.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java
@@ -210,9 +210,14 @@ class WebViewChromium implements WebViewProvider,
}
}
- if (!mFactory.hasStarted()) {
- // We will defer real initialization until we know which thread to do it on, unless we
- // are on the main thread already.
+ // We will defer real initialization until we know which thread to do it on, unless:
+ // - we are on the main thread already (common case),
+ // - the app is targeting >= JB MR2, in which case checkThread enforces that all usage
+ // comes from a single thread. (Note in JB MR2 this exception was in WebView.java).
+ if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ mFactory.startYourEngines(false);
+ checkThread();
+ } else if (!mFactory.hasStarted()) {
if (Looper.myLooper() == Looper.getMainLooper()) {
mFactory.startYourEngines(true);
}