Changeset 86204 in webkit


Ignore:
Timestamp:
May 10, 2011 6:47:03 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-10 Anton D'Auria <adauria@apple.com>

Reviewed by Alexey Proskuryakov.

Add ApplicationCache API to get disk usage per origin
https://bugs.webkit.org/show_bug.cgi?id=57127

  • http/tests/appcache/origin-usage-expected.txt: Added.
  • http/tests/appcache/origin-usage.html: Added.
  • http/tests/appcache/resources/origin-usage-iframe-1.html: Added.
  • http/tests/appcache/resources/origin-usage-iframe-1.manifest: Added.
  • http/tests/appcache/resources/origin-usage-iframe-2.html: Added.
  • http/tests/appcache/resources/origin-usage-iframe-2.manifest: Added.
  • platform/chromium/test_expectations.txt:
  • platform/gtk/Skipped:
  • platform/mac-wk2/Skipped:
  • platform/qt/Skipped:

2011-05-10 Anton D'Auria <adauria@apple.com>

Reviewed by Alexey Proskuryakov.

Add ApplicationCache API to get disk usage per origin
https://bugs.webkit.org/show_bug.cgi?id=57127

ApplicationCacheStorage already provides an API to get per-origin
disk usage. This should be exposed through WebCore::ApplicationCache
to not be dependent on storage implementation.

Test: http/tests/appcache/origin-usage.html

  • WebCore.exp.in:
  • loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::diskUsageForOrigin):
  • loader/appcache/ApplicationCache.h:

2011-05-10 Anton D'Auria <adauria@apple.com>

Reviewed by Alexey Proskuryakov.

Add ApplicationCache API to get disk usage per origin
https://bugs.webkit.org/show_bug.cgi?id=57127

Added Mac port API.

  • WebCoreSupport/WebApplicationCache.h:
  • WebCoreSupport/WebApplicationCache.mm: (+[WebApplicationCache diskUsageForOrigin:]):

2011-05-10 Anton D'Auria <adauria@apple.com>

Reviewed by Alexey Proskuryakov.

Add ApplicationCache API to get disk usage per origin
https://bugs.webkit.org/show_bug.cgi?id=57127

Added test that loads two frames with ~15Kb image, checks usage,
deletes app cache, verifies usage is 0.

  • DumpRenderTree/LayoutTestController.cpp: (applicationCacheDiskUsageForOriginCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/chromium/LayoutTestController.cpp: Added stub. (LayoutTestController::LayoutTestController): (LayoutTestController::applicationCacheDiskUsageForOrigin):
  • DumpRenderTree/chromium/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: Added stub. (LayoutTestController::applicationCacheDiskUsageForOrigin):
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::applicationCacheDiskUsageForOrigin):
  • DumpRenderTree/qt/LayoutTestControllerQt.cpp: Added stub. (LayoutTestController::applicationCacheDiskUsageForOrigin):
  • DumpRenderTree/qt/LayoutTestControllerQt.h:
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: Added stub. (LayoutTestController::applicationCacheDiskUsageForOrigin):
Location:
trunk
Files:
6 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86192 r86204  
     12011-05-10  Anton D'Auria  <adauria@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Add ApplicationCache API to get disk usage per origin
     6        https://bugs.webkit.org/show_bug.cgi?id=57127
     7
     8        * http/tests/appcache/origin-usage-expected.txt: Added.
     9        * http/tests/appcache/origin-usage.html: Added.
     10        * http/tests/appcache/resources/origin-usage-iframe-1.html: Added.
     11        * http/tests/appcache/resources/origin-usage-iframe-1.manifest: Added.
     12        * http/tests/appcache/resources/origin-usage-iframe-2.html: Added.
     13        * http/tests/appcache/resources/origin-usage-iframe-2.manifest: Added.
     14        * platform/chromium/test_expectations.txt:
     15        * platform/gtk/Skipped:
     16        * platform/mac-wk2/Skipped:
     17        * platform/qt/Skipped:
     18
    1192011-05-10  Adam Klein  <adamk@chromium.org>
    220
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r86171 r86204  
    18041804// LayoutTestController::getOriginsWithApplicationCache isn't implemented
    18051805BUGWK SKIP : http/tests/appcache/origins-with-appcache.html = FAIL
     1806// LayoutTestController::applicationCacheDiskUsageForOrigin isn't implemented - https://bugs.webkit.org/show_bug.cgi?id=57127
     1807BUGWK SKIP : http/tests/appcache/origin-usage.html = FAIL
    18061808
    18071809// New failures from WebKit r51577
  • trunk/LayoutTests/platform/gtk/Skipped

    r86086 r86204  
    511511http/tests/appcache/origin-delete.html
    512512http/tests/appcache/origins-with-appcache.html
     513# LayoutTestController::applicationCacheDiskUsageForOrigin isn't implemented - https://bugs.webkit.org/show_bug.cgi?id=57127
     514http/tests/appcache/origin-usage.html
    513515http/tests/cookies/double-quoted-value-with-semi-colon.html
    514516http/tests/loading/bad-scheme-subframe.html
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r86146 r86204  
    957957fast/text/zero-font-size.html
    958958http/tests/appcache/disabled.html
     959# LayoutTestController::applicationCacheDiskUsageForOrigin isn't implemented - https://bugs.webkit.org/show_bug.cgi?id=57127
     960http/tests/appcache/origin-usage.html
    959961http/tests/canvas/webgl/origin-clean-conformance.html
    960962http/tests/inspector/network/ping.html
  • trunk/LayoutTests/platform/qt/Skipped

    r86143 r86204  
    23662366# LayoutTestController::getOriginsWithApplicationCache is not implemented
    23672367http/tests/appcache/origins-with-appcache.html
     2368# LayoutTestController::applicationCacheDiskUsageForOrigin isn't implemented - https://bugs.webkit.org/show_bug.cgi?id=57127
     2369http/tests/appcache/origin-usage.html
    23682370
    23692371# Needs rebaseline
  • trunk/Source/WebCore/ChangeLog

    r86200 r86204  
     12011-05-10  Anton D'Auria  <adauria@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Add ApplicationCache API to get disk usage per origin
     6        https://bugs.webkit.org/show_bug.cgi?id=57127
     7
     8        ApplicationCacheStorage already provides an API to get per-origin
     9        disk usage. This should be exposed through WebCore::ApplicationCache
     10        to not be dependent on storage implementation.
     11
     12        Test: http/tests/appcache/origin-usage.html
     13
     14        * WebCore.exp.in:
     15        * loader/appcache/ApplicationCache.cpp:
     16        (WebCore::ApplicationCache::diskUsageForOrigin):
     17        * loader/appcache/ApplicationCache.h:
     18
    1192011-05-10  Pratik Solanki  <psolanki@apple.com>
    220
  • trunk/Source/WebCore/WebCore.exp.in

    r86184 r86204  
    18321832
    18331833#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     1834__ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
    18341835__ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
    18351836__ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp

    r81557 r86204  
    207207    }
    208208}
    209    
     209
     210int64_t ApplicationCache::diskUsageForOrigin(SecurityOrigin* origin)
     211{
     212    int64_t usage = 0;
     213    cacheStorage().usageForOrigin(origin, usage);
     214    return usage;
     215}
     216
    210217#ifndef NDEBUG
    211218void ApplicationCache::dump()
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.h

    r81557 r86204  
    9393    static bool requestIsHTTPOrHTTPSGet(const ResourceRequest&);
    9494
     95    static int64_t diskUsageForOrigin(SecurityOrigin*);
     96   
    9597    int64_t estimatedSizeInStorage() const { return m_estimatedSizeInStorage; }
    9698
  • trunk/Source/WebKit/mac/ChangeLog

    r86184 r86204  
     12011-05-10  Anton D'Auria  <adauria@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Add ApplicationCache API to get disk usage per origin
     6        https://bugs.webkit.org/show_bug.cgi?id=57127
     7
     8        Added Mac port API.
     9
     10        * WebCoreSupport/WebApplicationCache.h:
     11        * WebCoreSupport/WebApplicationCache.mm:
     12        (+[WebApplicationCache diskUsageForOrigin:]):
     13
    1142011-05-10  Beth Dakin  <bdakin@apple.com>
    215
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h

    r81733 r86204  
    3636+ (void)setDefaultOriginQuota:(long long)size;
    3737
     38+ (long long)diskUsageForOrigin:(WebSecurityOrigin *)origin;
     39
    3840+ (void)deleteAllApplicationCaches;
    3941+ (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm

    r81733 r86204  
    5959}
    6060
     61+ (long long)diskUsageForOrigin:(WebSecurityOrigin *)origin
     62{
     63    return ApplicationCache::diskUsageForOrigin([origin _core]);
     64}
     65
    6166+ (void)deleteAllApplicationCaches
    6267{
  • trunk/Tools/ChangeLog

    r86203 r86204  
     12011-05-10  Anton D'Auria  <adauria@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Add ApplicationCache API to get disk usage per origin
     6        https://bugs.webkit.org/show_bug.cgi?id=57127
     7
     8        Added test that loads two frames with ~15Kb image, checks usage,
     9        deletes app cache, verifies usage is 0.
     10
     11        * DumpRenderTree/LayoutTestController.cpp:
     12        (applicationCacheDiskUsageForOriginCallback):
     13        (LayoutTestController::staticFunctions):
     14        * DumpRenderTree/LayoutTestController.h:
     15        * DumpRenderTree/chromium/LayoutTestController.cpp: Added stub.
     16        (LayoutTestController::LayoutTestController):
     17        (LayoutTestController::applicationCacheDiskUsageForOrigin):
     18        * DumpRenderTree/chromium/LayoutTestController.h:
     19        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: Added stub.
     20        (LayoutTestController::applicationCacheDiskUsageForOrigin):
     21        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     22        (LayoutTestController::applicationCacheDiskUsageForOrigin):
     23        * DumpRenderTree/qt/LayoutTestControllerQt.cpp: Added stub.
     24        (LayoutTestController::applicationCacheDiskUsageForOrigin):
     25        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     26        * DumpRenderTree/win/LayoutTestControllerWin.cpp: Added stub.
     27        (LayoutTestController::applicationCacheDiskUsageForOrigin):
     28
    1292011-05-10  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
    230
  • trunk/Tools/DumpRenderTree/LayoutTestController.cpp

    r86047 r86204  
    421421}
    422422
     423static JSValueRef applicationCacheDiskUsageForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     424{
     425    if (argumentCount < 1)
     426        return JSValueMakeUndefined(context);
     427
     428    JSRetainPtr<JSStringRef> originURL(Adopt, JSValueToStringCopy(context, arguments[0], exception));
     429    ASSERT(!*exception);
     430   
     431    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     432
     433    return JSValueMakeNumber(context, controller->applicationCacheDiskUsageForOrigin(originURL.get()));
     434}
     435
    423436static JSValueRef originsWithApplicationCacheCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    424437{
     
    22222235        { "apiTestNewWindowDataLoadBaseURL", apiTestNewWindowDataLoadBaseURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22232236        { "apiTestGoToCurrentBackForwardItem", apiTestGoToCurrentBackForwardItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2237        { "applicationCacheDiskUsageForOrigin", applicationCacheDiskUsageForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22242238        { "callShouldCloseOnWebView", callShouldCloseOnWebViewCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22252239        { "clearAllApplicationCaches", clearAllApplicationCachesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/LayoutTestController.h

    r86047 r86204  
    6565    bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray);
    6666    JSValueRef originsWithApplicationCache(JSContextRef);
     67    long long applicationCacheDiskUsageForOrigin(JSStringRef name);
    6768    bool isCommandEnabled(JSStringRef name);
    6869    void keepWebHistory();
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp

    r86201 r86204  
    194194    bindMethod("accessStoredWebScriptObject", &LayoutTestController::accessStoredWebScriptObject);
    195195    bindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL);
     196    bindMethod("applicationCacheDiskUsageForOrigin", &LayoutTestController::applicationCacheDiskUsageForOrigin);
    196197    bindMethod("callShouldCloseOnWebView", &LayoutTestController::callShouldCloseOnWebView);
    197198    bindMethod("clearAllApplicationCaches", &LayoutTestController::clearAllApplicationCaches);
     
    839840{
    840841    // FIXME: Implement to support getting origins that have application caches.
     842    result->setNull();
     843}
     844
     845void LayoutTestController::applicationCacheDiskUsageForOrigin(const CppArgumentList&, CppVariant* result)
     846{
     847    // FIXME: Implement to support getting disk usage by all application cache for an origin.
    841848    result->setNull();
    842849}
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h

    r86201 r86204  
    298298    // Sets the application cache quota for the localhost origin.
    299299    void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
     300    // Returns disk usage by all application caches for an origin.
     301    void applicationCacheDiskUsageForOrigin(const CppArgumentList&, CppVariant*);
    300302
    301303    // Clears all databases.
  • trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r85925 r86204  
    667667}
    668668
     669long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef name)
     670{
     671    // FIXME: implement
     672    return 0;
     673}
     674
    669675void LayoutTestController::clearAllDatabases()
    670676{
  • trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r85925 r86204  
    136136}
    137137
     138long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef url)
     139{
     140    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
     141    WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
     142    return [WebApplicationCache diskUsageForOrigin:origin];
     143}
     144
    138145void LayoutTestController::syncLocalStorage()
    139146{
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r86049 r86204  
    572572}
    573573
     574long long LayoutTestController::applicationCacheDiskUsageForOrigin(const QString& origin)
     575{
     576    // FIXME: Implement to support getting disk usage by all application caches for an origin.
     577    return 0;
     578}
     579
    574580QStringList LayoutTestController::originsWithApplicationCache()
    575581{
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r85925 r86204  
    194194    void setApplicationCacheOriginQuota(unsigned long long quota);
    195195    QStringList originsWithApplicationCache();
     196    long long applicationCacheDiskUsageForOrigin(const QString&);
    196197
    197198    void setDatabaseQuota(int size);
  • trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r85925 r86204  
    996996}
    997997
     998long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef name)
     999{
     1000    // FIXME: Implement to get disk usage by all application caches for an origin.
     1001    return 0;
     1002}
     1003
    9981004void LayoutTestController::clearAllDatabases()
    9991005{
Note: See TracChangeset for help on using the changeset viewer.