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

Commit 5647bb3c authored by Ben Murdoch's avatar Ben Murdoch Committed by Ben Murdoch
Browse files

Update WebStorage methods used by DumpRenderTree to complete synchronously if...

Update WebStorage methods used by DumpRenderTree to complete synchronously if they are called on the webcore thread.
parent 9f655a4a
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