summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGrace Kloba <>2009-04-01 09:44:18 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-01 09:44:18 -0700
commitc6c318dffbb411c2cb04740a8dcc18d21c14f361 (patch)
tree572fff4b1aa43c05329cf4f059b33bd2c2024cfb /core
parent8126ac66b631dc635d8fab8a240840989cbd2a05 (diff)
downloadframeworks_base-c6c318dffbb411c2cb04740a8dcc18d21c14f361.zip
frameworks_base-c6c318dffbb411c2cb04740a8dcc18d21c14f361.tar.gz
frameworks_base-c6c318dffbb411c2cb04740a8dcc18d21c14f361.tar.bz2
AI 143999: am: CL 143998 Fix #1750489. Call WebKit's setNetworkOnLine from WebCore thread instead of UI thread as WebKit is not thread safe.
Using the same code pattern as the rest of the file: . throw IllegalStateException if BrowserFrame.sJavaBridge is null in pauseTimers/resumeTimers. . use (msg.arg1 == 1) to pass the boolean from WebView to WebViewCore as in CLEAR_CACHE Original author: klobag Merged from: //branches/cupcake/... Automated import of CL 143999
Diffstat (limited to 'core')
-rw-r--r--core/java/android/webkit/WebView.java3
-rw-r--r--core/java/android/webkit/WebViewCore.java12
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 3205820..1822ba4 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -913,7 +913,8 @@ public class WebView extends AbsoluteLayout
* @hide pending API Council approval
*/
public void setNetworkAvailable(boolean networkUp) {
- BrowserFrame.sJavaBridge.setNetworkOnLine(networkUp);
+ mWebViewCore.sendMessage(EventHub.SET_NETWORK_STATE,
+ networkUp ? 1 : 0, 0);
}
/**
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 3e4daf7..72b30f6 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -521,7 +521,7 @@ final class WebViewCore {
"SET_GLOBAL_BOUNDS", // = 116;
"UPDATE_CACHE_AND_TEXT_ENTRY", // = 117;
"CLICK", // = 118;
- "119",
+ "SET_NETWORK_STATE", // = 119;
"DOC_HAS_IMAGES", // = 120;
"SET_SNAP_ANCHOR", // = 121;
"DELETE_SELECTION", // = 122;
@@ -567,6 +567,7 @@ final class WebViewCore {
static final int SET_GLOBAL_BOUNDS = 116;
static final int UPDATE_CACHE_AND_TEXT_ENTRY = 117;
static final int CLICK = 118;
+ static final int SET_NETWORK_STATE = 119;
static final int DOC_HAS_IMAGES = 120;
static final int SET_SNAP_ANCHOR = 121;
static final int DELETE_SELECTION = 122;
@@ -781,6 +782,15 @@ final class WebViewCore {
}
break;
+ case SET_NETWORK_STATE:
+ if (BrowserFrame.sJavaBridge == null) {
+ throw new IllegalStateException("No WebView " +
+ "has been created in this process!");
+ }
+ BrowserFrame.sJavaBridge
+ .setNetworkOnLine(msg.arg1 == 1);
+ break;
+
case CLEAR_CACHE:
mBrowserFrame.clearCache();
if (msg.arg1 == 1) {