Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6c318df authored by Grace Kloba's avatar Grace Kloba Committed by The Android Open Source Project
Browse files

AI 143999: am: CL 143998 Fix #1750489. Call WebKit's setNetworkOnLine from...

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
parent 8126ac66
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+11 −1
Original line number Diff line number Diff line
@@ -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) {