Title: [90948] trunk/Source
Revision
90948
Author
[email protected]
Date
2011-07-13 14:40:54 -0700 (Wed, 13 Jul 2011)

Log 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  <[email protected]>

        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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90947 => 90948)


--- trunk/Source/WebCore/ChangeLog	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/ChangeLog	2011-07-13 21:40:54 UTC (rev 90948)
@@ -1,5 +1,33 @@
 2011-07-13  Joseph Pecoraro  <[email protected]>
 
+        Improve names of some ApplicationCacheStorage accessor methods
+        https://bugs.webkit.org/show_bug.cgi?id=64433
+
+        Reviewed by Alexey Proskuryakov.
+
+        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.
+
+2011-07-13  Joseph Pecoraro  <[email protected]>
+
         Some ApplicationCache Origin Cleanup
         https://bugs.webkit.org/show_bug.cgi?id=64431
 

Modified: trunk/Source/WebCore/WebCore.exp.in (90947 => 90948)


--- trunk/Source/WebCore/WebCore.exp.in	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-07-13 21:40:54 UTC (rev 90948)
@@ -1868,17 +1868,16 @@
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 __ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
-__ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
-__ZN7WebCore23ApplicationCacheStorage14usageForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage16deleteAllEntriesEv
 __ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKN3WTF6StringEPNS_20ApplicationCacheHostE
 __ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKN3WTF6StringE
 __ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv
 __ZN7WebCore23ApplicationCacheStorage19getOriginsWithCacheERN3WTF7HashSetINS1_6RefPtrINS_14SecurityOriginEEENS_18SecurityOriginHashENS1_10HashTraitsIS5_EEEE
 __ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx
+__ZN7WebCore23ApplicationCacheStorage23calculateQuotaForOriginEPKNS_14SecurityOriginERx
+__ZN7WebCore23ApplicationCacheStorage23calculateUsageForOriginEPKNS_14SecurityOriginERx
 __ZN7WebCore23ApplicationCacheStorage26storeUpdatedQuotaForOriginEPKNS_14SecurityOriginEx
-__ZN7WebCore23ApplicationCacheStorage36remainingSizeForOriginExcludingCacheEPKNS_14SecurityOriginEPNS_16ApplicationCacheERx
 __ZN7WebCore23ApplicationCacheStorage5emptyEv
 __ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv
 #endif

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp (90947 => 90948)


--- trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2011-07-13 21:40:54 UTC (rev 90948)
@@ -210,7 +210,7 @@
 int64_t ApplicationCache::diskUsageForOrigin(SecurityOrigin* origin)
 {
     int64_t usage = 0;
-    cacheStorage().usageForOrigin(origin, usage);
+    cacheStorage().calculateUsageForOrigin(origin, usage);
     return usage;
 }
 

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (90947 => 90948)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2011-07-13 21:40:54 UTC (rev 90948)
@@ -809,7 +809,7 @@
 
 void ApplicationCacheGroup::recalculateAvailableSpaceInQuota()
 {
-    if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
+    if (!cacheStorage().calculateRemainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
         // Failed to determine what is left in the quota. Fallback to allowing anything.
         m_availableSpaceInQuota = ApplicationCacheStorage::noQuota();
     }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (90947 => 90948)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2011-07-13 21:40:54 UTC (rev 90948)
@@ -433,7 +433,7 @@
     m_defaultOriginQuota = quota;
 }
 
-bool ApplicationCacheStorage::quotaForOrigin(const SecurityOrigin* origin, int64_t& quota)
+bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* origin, int64_t& quota)
 {
     // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0.
     // Using the count to determine if a record existed or not is a safe way to determine
@@ -456,7 +456,7 @@
     return false;
 }
 
-bool ApplicationCacheStorage::usageForOrigin(const SecurityOrigin* origin, int64_t& usage)
+bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* origin, int64_t& usage)
 {
     // If an Origins record doesn't exist, then the SUM will be null,
     // which will become 0, as expected, when converting to a number.
@@ -480,7 +480,7 @@
     return false;
 }
 
-bool ApplicationCacheStorage::remainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
+bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
 {
     openDatabase(false);
     if (!m_database.isOpen())
@@ -519,7 +519,7 @@
     if (result == SQLResultRow) {
         int64_t numberOfCaches = statement.getColumnInt64(0);
         if (numberOfCaches == 0)
-            quotaForOrigin(origin, remainingSize);
+            calculateQuotaForOrigin(origin, remainingSize);
         else
             remainingSize = statement.getColumnInt64(1);
         return true;
@@ -960,10 +960,10 @@
     // Check if the oldCache with the newCache would reach the per-origin quota.
     int64_t remainingSpaceInOrigin;
     const SecurityOrigin* origin = group->origin();
-    if (remainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
+    if (calculateRemainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
         if (remainingSpaceInOrigin < newCache->estimatedSizeInStorage()) {
             int64_t quota;
-            if (quotaForOrigin(origin, quota)) {
+            if (calculateQuotaForOrigin(origin, quota)) {
                 totalSpaceNeeded = quota - remainingSpaceInOrigin + newCache->estimatedSizeInStorage();
                 return false;
             }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h (90947 => 90948)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2011-07-13 21:40:54 UTC (rev 90948)
@@ -65,9 +65,9 @@
 
     int64_t defaultOriginQuota() const { return m_defaultOriginQuota; }
     void setDefaultOriginQuota(int64_t quota);
-    bool usageForOrigin(const SecurityOrigin*, int64_t& usage);
-    bool quotaForOrigin(const SecurityOrigin*, int64_t& quota);
-    bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
+    bool calculateUsageForOrigin(const SecurityOrigin*, int64_t& usage);
+    bool calculateQuotaForOrigin(const SecurityOrigin*, int64_t& quota);
+    bool calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
     bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota);
     bool checkOriginQuota(ApplicationCacheGroup*, ApplicationCache* oldCache, ApplicationCache* newCache, int64_t& totalSpaceNeeded);
 

Modified: trunk/Source/WebKit/mac/ChangeLog (90947 => 90948)


--- trunk/Source/WebKit/mac/ChangeLog	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-07-13 21:40:54 UTC (rev 90948)
@@ -1,3 +1,15 @@
+2011-07-13  Joseph Pecoraro  <[email protected]>
+
+        Improve names of some ApplicationCacheStorage accessor methods
+        https://bugs.webkit.org/show_bug.cgi?id=64433
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebCoreSupport/WebApplicationCacheQuotaManager.mm:
+        (-[WebApplicationCacheQuotaManager usage]):
+        (-[WebApplicationCacheQuotaManager quota]):
+        Renamed methods.
+
 2011-07-12  Joseph Pecoraro  <[email protected]>
 
         ApplicationCache update should not immediately fail when reaching per-origin quota

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm (90947 => 90948)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm	2011-07-13 21:40:54 UTC (rev 90948)
@@ -51,7 +51,7 @@
 {
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     long long usage;
-    if (cacheStorage().usageForOrigin([_origin _core], usage))
+    if (cacheStorage().calculateUsageForOrigin([_origin _core], usage))
         return usage;
     return 0;
 #else
@@ -63,7 +63,7 @@
 {
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     long long quota;
-    if (cacheStorage().quotaForOrigin([_origin _core], quota))
+    if (cacheStorage().calculateQuotaForOrigin([_origin _core], quota))
         return quota;
     return 0;
 #else

Modified: trunk/Source/WebKit/qt/ChangeLog (90947 => 90948)


--- trunk/Source/WebKit/qt/ChangeLog	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-07-13 21:40:54 UTC (rev 90948)
@@ -1,3 +1,14 @@
+2011-07-13  Joseph Pecoraro  <[email protected]>
+
+        Improve names of some ApplicationCacheStorage accessor methods
+        https://bugs.webkit.org/show_bug.cgi?id=64433
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::reachedApplicationCacheOriginQuota):
+        Renamed method.
+
 2011-07-12  Joseph Pecoraro  <[email protected]>
 
         ApplicationCache update should not immediately fail when reaching per-origin quota

Modified: trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp (90947 => 90948)


--- trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2011-07-13 21:40:40 UTC (rev 90947)
+++ trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2011-07-13 21:40:54 UTC (rev 90948)
@@ -563,7 +563,7 @@
     QWebSecurityOriginPrivate* priv = new QWebSecurityOriginPrivate(origin);
     QWebSecurityOrigin* securityOrigin = new QWebSecurityOrigin(priv);
 
-    if (!WebCore::cacheStorage().quotaForOrigin(origin, quota))
+    if (!WebCore::cacheStorage().calculateQuotaForOrigin(origin, quota))
        WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
 
     emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to