void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) { if (handle == m_manifestHandle) { didFinishLoadingManifest(); return; } ASSERT(m_currentHandle == handle); ASSERT(m_pendingEntries.contains(handle->request().url())); m_pendingEntries.remove(handle->request().url()); ASSERT(m_cacheBeingUpdated); m_cacheBeingUpdated->addResource(m_currentResource.release()); m_currentHandle = 0; // Load the next file. if (!m_pendingEntries.isEmpty()) { startLoadingEntry(); return; } checkIfLoadIsComplete(); }
void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double finishTime) { InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, finishTime); if (handle == m_manifestHandle) { didFinishLoadingManifest(); 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 = nullptr; // 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? if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_cacheBeingUpdated->estimatedSizeInStorage()) { m_currentResource = nullptr; m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, ASCIILiteral("Application Cache update failed, because size quota was exceeded.")); cacheUpdateFailed(); return; } // Load the next resource, if any. startLoadingEntry(); }
void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) { #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) page->inspectorController()->didFinishLoading(m_currentResourceIdentifier); #endif if (handle == m_manifestHandle) { didFinishLoadingManifest(); return; } // After finishing the loading of any resource, we check if it will // fit in our last known quota limit. if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota()) { // Failed to determine what is left in the quota. Fallback to allowing anything. if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) m_availableSpaceInQuota = ApplicationCacheStorage::noQuota(); } // Check each resource, as it loads, to see if it would fit in our // idea of the available quota space. if (m_availableSpaceInQuota < m_loadedSize) { m_currentResource = 0; cacheUpdateFailedDueToOriginQuota(); 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(); }