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

Commit 99f39771 authored by Iain Merrick's avatar Iain Merrick
Browse files

Call flushCookieStore() from CookieSyncManager.

I previously tried to make this a new public API, but I realised
it should actually hang off the existing code in CookieSyncManager.

Change-Id: Ic44334008266bad5ba1245cf674350a4c10712ce
parent a6738744
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -621,14 +621,11 @@ public final class CookieManager {
    }

    /**
     * Tell the cookie store that this is a good time to flush cookies to flash.
     *
     * This should be called when the app is paused. Note that this method only
     * acts as a hint, and may not have any effect. Flushing is asynchronous.
     * Package level api, called from CookieSyncManager
     *
     * @hide pending API council approval.
     * Flush all cookies managed by the Chrome HTTP stack to flash.
     */
    public void flushCookieStore() {
    void flushCookieStore() {
        if (useChromiumHttpStack()) {
            nativeFlushCookieStore();
        }
+7 −5
Original line number Diff line number Diff line
@@ -172,17 +172,19 @@ public final class CookieSyncManager extends WebSyncManager {
            Log.v(LOGTAG, "CookieSyncManager::syncFromRamToFlash STARTS");
        }

        if (!CookieManager.getInstance().acceptCookie()) {
        CookieManager manager = CookieManager.getInstance();

        if (!manager.acceptCookie()) {
            return;
        }

        ArrayList<Cookie> cookieList = CookieManager.getInstance()
                .getUpdatedCookiesSince(mLastUpdate);
        manager.flushCookieStore();

        ArrayList<Cookie> cookieList = manager.getUpdatedCookiesSince(mLastUpdate);
        mLastUpdate = System.currentTimeMillis();
        syncFromRamToFlash(cookieList);

        ArrayList<Cookie> lruList =
                CookieManager.getInstance().deleteLRUDomain();
        ArrayList<Cookie> lruList = manager.deleteLRUDomain();
        syncFromRamToFlash(lruList);

        if (DebugFlags.COOKIE_SYNC_MANAGER) {