AI 144000: am: CL 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/...
  Original author: android-build
  Merged from: //branches/donutburger/...

Automated import of CL 144000
This commit is contained in:
Grace Kloba
2009-04-02 08:50:17 -07:00
committed by The Android Open Source Project
parent f0bc7ecebf
commit a72cc098e2
2 changed files with 13 additions and 2 deletions

View File

@@ -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);
}
/**

View File

@@ -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) {