Changeset 90948 in webkit


Ignore:
Timestamp:
Jul 13, 2011 2:40:54 PM (13 years ago)
Author:
Joseph Pecoraro
Message:

Improve names of some ApplicationCacheStorage accessor methods
https://bugs.webkit.org/show_bug.cgi?id=64433

Reviewed by Alexey Proskuryakov.

2011-07-13 Joseph Pecoraro <Joseph Pecoraro>

Some methods returned a bool for success/failure and
actually returned a value as an out parameter so their
name was confusing. Rename these methods to make them
more clear.

(WebCore::ApplicationCache::diskUsageForOrigin):

  • loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
  • loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): (WebCore::ApplicationCacheStorage::calculateUsageForOrigin): (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): (WebCore::ApplicationCacheStorage::checkOriginQuota):
  • loader/appcache/ApplicationCacheStorage.h:
  • loader/appcache/ApplicationCache.cpp: Rename the methods.
  • WebCore.exp.in: Replaced old versions. Also, calculateRemaining wasn't needed outside WebCore, so no longer export it.
Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90947 r90948  
     12011-07-13  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Improve names of some ApplicationCacheStorage accessor methods
     4        https://bugs.webkit.org/show_bug.cgi?id=64433
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Some methods returned a bool for success/failure and
     9        actually returned a value as an out parameter so their
     10        name was confusing. Rename these methods to make them
     11        more clear.
     12
     13        (WebCore::ApplicationCache::diskUsageForOrigin):
     14        * loader/appcache/ApplicationCacheGroup.cpp:
     15        (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
     16        * loader/appcache/ApplicationCacheStorage.cpp:
     17        (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
     18        (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
     19        (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
     20        (WebCore::ApplicationCacheStorage::checkOriginQuota):
     21        * loader/appcache/ApplicationCacheStorage.h:
     22        * loader/appcache/ApplicationCache.cpp:
     23        Rename the methods.
     24
     25        * WebCore.exp.in:
     26        Replaced old versions. Also, calculateRemaining wasn't needed
     27        outside WebCore, so no longer export it.
     28
    1292011-07-13  Joseph Pecoraro  <joepeck@webkit.org>
    230
  • trunk/Source/WebCore/WebCore.exp.in

    r90734 r90948  
    18691869__ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
    18701870__ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
    1871 __ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx
    18721871__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
    1873 __ZN7WebCore23ApplicationCacheStorage14usageForOriginEPKNS_14SecurityOriginERx
    18741872__ZN7WebCore23ApplicationCacheStorage16deleteAllEntriesEv
    18751873__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKN3WTF6StringEPNS_20ApplicationCacheHostE
     
    18781876__ZN7WebCore23ApplicationCacheStorage19getOriginsWithCacheERN3WTF7HashSetINS1_6RefPtrINS_14SecurityOriginEEENS_18SecurityOriginHashENS1_10HashTraitsIS5_EEEE
    18791877__ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx
     1878__ZN7WebCore23ApplicationCacheStorage23calculateQuotaForOriginEPKNS_14SecurityOriginERx
     1879__ZN7WebCore23ApplicationCacheStorage23calculateUsageForOriginEPKNS_14SecurityOriginERx
    18801880__ZN7WebCore23ApplicationCacheStorage26storeUpdatedQuotaForOriginEPKNS_14SecurityOriginEx
    1881 __ZN7WebCore23ApplicationCacheStorage36remainingSizeForOriginExcludingCacheEPKNS_14SecurityOriginEPNS_16ApplicationCacheERx
    18821881__ZN7WebCore23ApplicationCacheStorage5emptyEv
    18831882__ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp

    r86204 r90948  
    211211{
    212212    int64_t usage = 0;
    213     cacheStorage().usageForOrigin(origin, usage);
     213    cacheStorage().calculateUsageForOrigin(origin, usage);
    214214    return usage;
    215215}
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r90947 r90948  
    810810void ApplicationCacheGroup::recalculateAvailableSpaceInQuota()
    811811{
    812     if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
     812    if (!cacheStorage().calculateRemainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
    813813        // Failed to determine what is left in the quota. Fallback to allowing anything.
    814814        m_availableSpaceInQuota = ApplicationCacheStorage::noQuota();
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp

    r90856 r90948  
    434434}
    435435
    436 bool ApplicationCacheStorage::quotaForOrigin(const SecurityOrigin* origin, int64_t& quota)
     436bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* origin, int64_t& quota)
    437437{
    438438    // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0.
     
    457457}
    458458
    459 bool ApplicationCacheStorage::usageForOrigin(const SecurityOrigin* origin, int64_t& usage)
     459bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* origin, int64_t& usage)
    460460{
    461461    // If an Origins record doesn't exist, then the SUM will be null,
     
    481481}
    482482
    483 bool ApplicationCacheStorage::remainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
     483bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
    484484{
    485485    openDatabase(false);
     
    520520        int64_t numberOfCaches = statement.getColumnInt64(0);
    521521        if (numberOfCaches == 0)
    522             quotaForOrigin(origin, remainingSize);
     522            calculateQuotaForOrigin(origin, remainingSize);
    523523        else
    524524            remainingSize = statement.getColumnInt64(1);
     
    961961    int64_t remainingSpaceInOrigin;
    962962    const SecurityOrigin* origin = group->origin();
    963     if (remainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
     963    if (calculateRemainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
    964964        if (remainingSpaceInOrigin < newCache->estimatedSizeInStorage()) {
    965965            int64_t quota;
    966             if (quotaForOrigin(origin, quota)) {
     966            if (calculateQuotaForOrigin(origin, quota)) {
    967967                totalSpaceNeeded = quota - remainingSpaceInOrigin + newCache->estimatedSizeInStorage();
    968968                return false;
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h

    r90856 r90948  
    6666    int64_t defaultOriginQuota() const { return m_defaultOriginQuota; }
    6767    void setDefaultOriginQuota(int64_t quota);
    68     bool usageForOrigin(const SecurityOrigin*, int64_t& usage);
    69     bool quotaForOrigin(const SecurityOrigin*, int64_t& quota);
    70     bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
     68    bool calculateUsageForOrigin(const SecurityOrigin*, int64_t& usage);
     69    bool calculateQuotaForOrigin(const SecurityOrigin*, int64_t& quota);
     70    bool calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
    7171    bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota);
    7272    bool checkOriginQuota(ApplicationCacheGroup*, ApplicationCache* oldCache, ApplicationCache* newCache, int64_t& totalSpaceNeeded);
  • trunk/Source/WebKit/mac/ChangeLog

    r90856 r90948  
     12011-07-13  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Improve names of some ApplicationCacheStorage accessor methods
     4        https://bugs.webkit.org/show_bug.cgi?id=64433
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/WebApplicationCacheQuotaManager.mm:
     9        (-[WebApplicationCacheQuotaManager usage]):
     10        (-[WebApplicationCacheQuotaManager quota]):
     11        Renamed methods.
     12
    1132011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
    214
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm

    r64612 r90948  
    5252#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    5353    long long usage;
    54     if (cacheStorage().usageForOrigin([_origin _core], usage))
     54    if (cacheStorage().calculateUsageForOrigin([_origin _core], usage))
    5555        return usage;
    5656    return 0;
     
    6464#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    6565    long long quota;
    66     if (cacheStorage().quotaForOrigin([_origin _core], quota))
     66    if (cacheStorage().calculateQuotaForOrigin([_origin _core], quota))
    6767        return quota;
    6868    return 0;
  • trunk/Source/WebKit/qt/ChangeLog

    r90856 r90948  
     12011-07-13  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Improve names of some ApplicationCacheStorage accessor methods
     4        https://bugs.webkit.org/show_bug.cgi?id=64433
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/ChromeClientQt.cpp:
     9        (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota):
     10        Renamed method.
     11
    1122011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
    213
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r90856 r90948  
    564564    QWebSecurityOrigin* securityOrigin = new QWebSecurityOrigin(priv);
    565565
    566     if (!WebCore::cacheStorage().quotaForOrigin(origin, quota))
     566    if (!WebCore::cacheStorage().calculateQuotaForOrigin(origin, quota))
    567567       WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
    568568
Note: See TracChangeset for help on using the changeset viewer.