diff options
author | Jonathan Dixon <joth@google.com> | 2013-10-08 13:34:08 -0700 |
---|---|---|
committer | Jonathan Dixon <joth@google.com> | 2013-10-09 12:02:50 -0700 |
commit | 916f857e0af25e8b179f60f532065386607567d7 (patch) | |
tree | d5e7be6f92a2527589b0ed7f13c24bf07f43b911 | |
parent | 91472035f666e633d4c299617ae1b20ccd3b6e0c (diff) | |
download | webview-916f857e0af25e8b179f60f532065386607567d7.tar.gz |
For apps targeting JB MR2+, bind to the first thread using WebView
Bug 10937207
This reflects base change to bind to the first thread that instantiates
a WebView.
Change-Id: I2994db6e72b80ff24b93df3fbbd6c57ea9267657
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromium.java | 11 |
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); } |