void ApplicationCacheHost::dispose() { // FIXME: Oilpan: remove the dispose step when the owning DocumentLoader // becomes a garbage collected object. Until that time, have the // DocumentLoader dispose and disable this ApplicationCacheHost when // it is finalized. Releasing the WebApplicationCacheHost is needed // to prevent further embedder notifications, which risk accessing an // invalid DocumentLoader. setApplicationCache(0); m_host.clear(); m_documentLoader = nullptr; }
bool ApplicationCacheHost::swapCache() { ApplicationCache* cache = applicationCache(); if (!cache) return false; // If the group of application caches to which cache belongs has the lifecycle status obsolete, unassociate document from cache. if (cache->group()->isObsolete()) { cache->group()->disassociateDocumentLoader(m_documentLoader); return true; } // If there is no newer cache, raise an INVALID_STATE_ERR exception. ApplicationCache* newestCache = cache->group()->newestCache(); if (cache == newestCache) return false; ASSERT(cache->group() == newestCache->group()); setApplicationCache(newestCache); InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader->frame()); return true; }