Title: [90947] trunk/Source/WebCore
- Revision
- 90947
- Author
- [email protected]
- Date
- 2011-07-13 14:40:40 -0700 (Wed, 13 Jul 2011)
Log Message
Some ApplicationCache Origin Cleanup
https://bugs.webkit.org/show_bug.cgi?id=64431
Reviewed by Alexey Proskuryakov.
2011-07-13 Joseph Pecoraro <[email protected]>
- m_loadedSize is inaccurate. This just replaces it with
calls to ApplicationCache::estimatedSizeInStorage.
- m_availableSpaceInQuota can get out of date, so we just
recalculate it at the start of appcache downloads.
* loader/appcache/ApplicationCacheGroup.h:
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
(WebCore::ApplicationCacheGroup::didReceiveData):
Remove references to m_loadedSize.
(WebCore::ApplicationCacheGroup::didFinishLoading):
Replace m_loadedSize with estimatedSizeInStorage after we
add the new cached resource to the cache. The calculation
already happened so this check is fast.
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
When we start the Downloading phase, recalculate the quota
so that we have an up to date quota value so that we can
break early if needed.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (90946 => 90947)
--- trunk/Source/WebCore/ChangeLog 2011-07-13 21:40:27 UTC (rev 90946)
+++ trunk/Source/WebCore/ChangeLog 2011-07-13 21:40:40 UTC (rev 90947)
@@ -1,3 +1,32 @@
+2011-07-13 Joseph Pecoraro <[email protected]>
+
+ Some ApplicationCache Origin Cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=64431
+
+ Reviewed by Alexey Proskuryakov.
+
+ - m_loadedSize is inaccurate. This just replaces it with
+ calls to ApplicationCache::estimatedSizeInStorage.
+
+ - m_availableSpaceInQuota can get out of date, so we just
+ recalculate it at the start of appcache downloads.
+
+ * loader/appcache/ApplicationCacheGroup.h:
+ * loader/appcache/ApplicationCacheGroup.cpp:
+ (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
+ (WebCore::ApplicationCacheGroup::didReceiveData):
+ Remove references to m_loadedSize.
+
+ (WebCore::ApplicationCacheGroup::didFinishLoading):
+ Replace m_loadedSize with estimatedSizeInStorage after we
+ add the new cached resource to the cache. The calculation
+ already happened so this check is fast.
+
+ (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
+ When we start the Downloading phase, recalculate the quota
+ so that we have an up to date quota value so that we can
+ break early if needed.
+
2011-07-12 Brent Fulgham <[email protected]>
Standardize WinCairo conditionalized code under PLATFORM macro.
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (90946 => 90947)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2011-07-13 21:40:27 UTC (rev 90946)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2011-07-13 21:40:40 UTC (rev 90947)
@@ -70,7 +70,6 @@
, m_completionType(None)
, m_isCopy(isCopy)
, m_calledReachedMaxAppCacheSize(false)
- , m_loadedSize(0)
, m_availableSpaceInQuota(ApplicationCacheStorage::unknownQuota())
, m_originQuotaExceededPreviously(false)
{
@@ -583,8 +582,6 @@
ASSERT(m_currentResource);
m_currentResource->data()->append(data, length);
-
- m_loadedSize += length;
}
void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double finishTime)
@@ -598,35 +595,28 @@
return;
}
- // After finishing the loading of any resource, we check if it will
- // fit in our last known quota limit.
- // FIXME: The quota could be changed by another appcache in the same origin.
- if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota())
- recalculateAvailableSpaceInQuota();
+ ASSERT(m_currentHandle == handle);
+ ASSERT(m_pendingEntries.contains(handle->firstRequest().url()));
+
+ m_pendingEntries.remove(handle->firstRequest().url());
+
+ ASSERT(m_cacheBeingUpdated);
+ m_cacheBeingUpdated->addResource(m_currentResource.release());
+ m_currentHandle = 0;
+
// While downloading check to see if we have exceeded the available quota.
// We can stop immediately if we have already previously failed
// due to an earlier quota restriction. The client was already notified
// of the quota being reached and decided not to increase it then.
// FIXME: Should we break earlier and prevent redownloading on later page loads?
- // We could then also get rid of m_loadedSize.
- if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_loadedSize) {
+ if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_cacheBeingUpdated->estimatedSizeInStorage()) {
m_currentResource = 0;
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.", 0, String());
cacheUpdateFailed();
return;
}
-
- ASSERT(m_currentHandle == handle);
- ASSERT(m_pendingEntries.contains(handle->firstRequest().url()));
- m_pendingEntries.remove(handle->firstRequest().url());
-
- ASSERT(m_cacheBeingUpdated);
-
- m_cacheBeingUpdated->addResource(m_currentResource.release());
- m_currentHandle = 0;
-
// Load the next resource, if any.
startLoadingEntry();
}
@@ -786,6 +776,8 @@
m_progressTotal = m_pendingEntries.size();
m_progressDone = 0;
+ recalculateAvailableSpaceInQuota();
+
startLoadingEntry();
}
@@ -983,7 +975,6 @@
m_completionType = None;
setUpdateStatus(Idle);
m_frame = 0;
- m_loadedSize = 0;
m_availableSpaceInQuota = ApplicationCacheStorage::unknownQuota();
m_calledReachedMaxAppCacheSize = false;
}
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h (90946 => 90947)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h 2011-07-13 21:40:27 UTC (rev 90946)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h 2011-07-13 21:40:40 UTC (rev 90947)
@@ -199,7 +199,6 @@
RefPtr<ApplicationCacheResource> m_manifestResource;
RefPtr<ResourceHandle> m_manifestHandle;
- int64_t m_loadedSize;
int64_t m_availableSpaceInQuota;
bool m_originQuotaExceededPreviously;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes