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

Commit 3b2fb7b2 authored by Selim Gurun's avatar Selim Gurun Committed by Android (Google) Code Review
Browse files

Merge "Fix onReachedMaxAppCacheSize callback"

parents b632adfa c86bec97
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -245,8 +245,8 @@ public class WebChromeClient {
    }

   /**
    * Tell the client that the quota has been reached for the Application Cache
    * API and request a new quota. The client must respond by invoking the
    * Notify the host application that the Application Cache has reached the
    * maximum size. The client must respond by invoking the
    * {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)}
    * method of the supplied {@link WebStorage.QuotaUpdater} instance. The
    * minimum value that can be set for the new quota is the current quota. The
@@ -255,7 +255,7 @@ public class WebChromeClient {
    * @param requiredStorage The amount of storage required by the Application
    *                        Cache operation that triggered this notification,
    *                        in bytes.
    * @param quota The quota, in bytes
    * @param quota the current maximum Application Cache size, in bytes
    * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which
    *                     must be used to inform the WebView of the new quota.
    */
+9 −6
Original line number Diff line number Diff line
@@ -443,7 +443,7 @@ public final class WebViewCore {
    }

    /**
     * Notify the browser that the origin has exceeded it's database quota.
     * Notify the embedding application that the origin has exceeded it's database quota.
     * @param url The URL that caused the overflow.
     * @param databaseIdentifier The identifier of the database.
     * @param quota The current quota for the origin.
@@ -468,12 +468,15 @@ public final class WebViewCore {
    }

    /**
     * Notify the browser that the appcache has exceeded its max size.
     * Notify the embedding application that the appcache has reached or exceeded its maximum
     * allowed storage size.
     *
     * @param requiredStorage is the amount of storage, in bytes, that would be
     * needed in order for the last appcache operation to succeed.
     * @param maxSize maximum allowed Application Cache database size, in bytes.
     */
    protected void reachedMaxAppCacheSize(long requiredStorage) {
        mCallbackProxy.onReachedMaxAppCacheSize(requiredStorage, getUsedQuota(),
    protected void reachedMaxAppCacheSize(long requiredStorage, long maxSize) {
        mCallbackProxy.onReachedMaxAppCacheSize(requiredStorage, maxSize,
                new WebStorage.QuotaUpdater() {
                    @Override
                    public void updateQuota(long newQuota) {
@@ -2117,8 +2120,8 @@ public final class WebViewCore {
        return width;
    }

    // Utility method for exceededDatabaseQuota and reachedMaxAppCacheSize
    // callbacks. Computes the sum of database quota for all origins.
    // Utility method for exceededDatabaseQuota callback. Computes the sum
    // of WebSQL database quota for all origins.
    private long getUsedQuota() {
        WebStorageClassic webStorage = WebStorageClassic.getInstance();
        Collection<WebStorage.Origin> origins = webStorage.getOriginsSync();