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

Commit cc9baea9 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 4621

* changes:
  Update WebStorage methods used by DumpRenderTree to complete synchronously if they are called on the webcore thread.
parents 061c3b50 5647bb3c
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -200,10 +200,15 @@ public final class WebStorage {
     */
    public void setQuotaForOrigin(String origin, long quota) {
        if (origin != null) {
            if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
                nativeSetQuotaForOrigin(origin, quota);
                syncValues();
            } else {
                postMessage(Message.obtain(null, SET_QUOTA_ORIGIN,
                    new Origin(origin, quota)));
            }
        }
    }

    /**
     * @hide
@@ -211,18 +216,28 @@ public final class WebStorage {
     */
    public void deleteOrigin(String origin) {
        if (origin != null) {
            if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
                nativeDeleteOrigin(origin);
                syncValues();
            } else {
                postMessage(Message.obtain(null, DELETE_ORIGIN,
                    new Origin(origin)));
            }
        }
    }

    /**
     * @hide
     * Delete all databases
     */
    public void deleteAllDatabases() {
        if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
            nativeDeleteAllDatabases();
            syncValues();
        } else {
            postMessage(Message.obtain(null, DELETE_ALL));
        }
    }

    /**
     * Utility function to send a message to our handler
@@ -250,8 +265,12 @@ public final class WebStorage {
     * Post a Sync request
     */
    public void update() {
        if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
            syncValues();
        } else {
            postMessage(Message.obtain(null, UPDATE));
        }
    }

    /**
     * Run on the webcore thread