X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=WebCore%2Floader%2Fappcache%2FApplicationCacheHost.cpp;h=d5707cf790bf60a2ba629d8a1a6b9db7c8d81af6;hb=e14391e94c850b8bd03680c23b38978db68687a8;hp=f63de553aa29b414785f304a2d5cc8229e25b9a9;hpb=e458d70a0d18538346f41b503114c9ebe6b2ce12;p=android-x86%2Fexternal-webkit.git diff --git a/WebCore/loader/appcache/ApplicationCacheHost.cpp b/WebCore/loader/appcache/ApplicationCacheHost.cpp index f63de553a..d5707cf79 100644 --- a/WebCore/loader/appcache/ApplicationCacheHost.cpp +++ b/WebCore/loader/appcache/ApplicationCacheHost.cpp @@ -55,6 +55,8 @@ ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader) ApplicationCacheHost::~ApplicationCacheHost() { + ASSERT(!m_applicationCache || !m_candidateApplicationCacheGroup || m_applicationCache->group() == m_candidateApplicationCacheGroup); + if (m_applicationCache) m_applicationCache->group()->disassociateDocumentLoader(m_documentLoader); else if (m_candidateApplicationCacheGroup) @@ -89,6 +91,12 @@ void ApplicationCacheHost::maybeLoadMainResource(ResourceRequest& request, Subst } } +void ApplicationCacheHost::maybeLoadMainResourceForRedirect(ResourceRequest& request, SubstituteData& substituteData) +{ + ASSERT(status() == UNCACHED); + maybeLoadMainResource(request, substituteData); +} + bool ApplicationCacheHost::maybeLoadFallbackForMainResponse(const ResourceRequest& request, const ResourceResponse& r) { if (r.httpStatusCode() / 100 == 4 || r.httpStatusCode() / 100 == 5) { @@ -126,7 +134,10 @@ void ApplicationCacheHost::failedLoadingMainResource() { ApplicationCacheGroup* group = m_candidateApplicationCacheGroup; if (!group && m_applicationCache) { - ASSERT(!mainResourceApplicationCache()); // If the main resource were loaded from a cache, it wouldn't fail. + if (mainResourceApplicationCache()) { + // Even when the main resource is being loaded from an application cache, loading can fail if aborted. + return; + } group = m_applicationCache->group(); } @@ -239,6 +250,16 @@ void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int dispatchDOMEvent(id, total, done); } +void ApplicationCacheHost::stopLoadingInFrame(Frame* frame) +{ + ASSERT(!m_applicationCache || !m_candidateApplicationCacheGroup || m_applicationCache->group() == m_candidateApplicationCacheGroup); + + if (m_candidateApplicationCacheGroup) + m_candidateApplicationCacheGroup->stopLoadingInFrame(frame); + else if (m_applicationCache) + m_applicationCache->group()->stopLoadingInFrame(frame); +} + void ApplicationCacheHost::stopDeferringEvents() { RefPtr protect(documentLoader()); @@ -250,6 +271,37 @@ void ApplicationCacheHost::stopDeferringEvents() m_defersEvents = false; } +#if ENABLE(INSPECTOR) +void ApplicationCacheHost::fillResourceList(ResourceInfoList* resources) +{ + ApplicationCache* cache = applicationCache(); + if (!cache || !cache->isComplete()) + return; + + ApplicationCache::ResourceMap::const_iterator end = cache->end(); + for (ApplicationCache::ResourceMap::const_iterator it = cache->begin(); it != end; ++it) { + RefPtr resource = it->second; + unsigned type = resource->type(); + bool isMaster = type & ApplicationCacheResource::Master; + bool isManifest = type & ApplicationCacheResource::Manifest; + bool isExplicit = type & ApplicationCacheResource::Explicit; + bool isForeign = type & ApplicationCacheResource::Foreign; + bool isFallback = type & ApplicationCacheResource::Fallback; + resources->append(ResourceInfo(resource->url(), isMaster, isManifest, isFallback, isForeign, isExplicit, resource->estimatedSizeInStorage())); + } +} + +ApplicationCacheHost::CacheInfo ApplicationCacheHost::applicationCacheInfo() +{ + ApplicationCache* cache = applicationCache(); + if (!cache || !cache->isComplete()) + return CacheInfo(KURL(), 0, 0, 0); + + // FIXME: Add "Creation Time" and "Update Time" to Application Caches. + return CacheInfo(cache->manifestResource()->url(), 0, 0, cache->estimatedSizeInStorage()); +} +#endif + void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) { if (m_domApplicationCache) {