Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: Source/WebCore/loader/cache/CachedResource.cpp

Issue 9283038: Merge 105226 - Ensure we don't cancel revalidation of a CachedResource (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/loader/cache/CachedResource.h ('k') | Source/WebCore/loader/cache/MemoryCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/cache/CachedResource.cpp
===================================================================
--- Source/WebCore/loader/cache/CachedResource.cpp (revision 105796)
+++ Source/WebCore/loader/cache/CachedResource.cpp (working copy)
@@ -139,6 +139,7 @@
, m_requestedFromNetworkingLayer(false)
, m_inCache(false)
, m_loading(false)
+ , m_switchingClientsToRevalidatedResource(false)
, m_type(type)
, m_status(Pending)
#ifndef NDEBUG
@@ -520,6 +521,9 @@
void CachedResource::clearResourceToRevalidate()
{
ASSERT(m_resourceToRevalidate);
+ if (m_switchingClientsToRevalidatedResource)
+ return;
+
// A resource may start revalidation before this method has been called, so check that this resource is still the proxy resource before clearing it out.
if (m_resourceToRevalidate->m_proxyResource == this) {
m_resourceToRevalidate->m_proxyResource = 0;
@@ -538,6 +542,7 @@
LOG(ResourceLoading, "CachedResource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate);
+ m_switchingClientsToRevalidatedResource = true;
HashSet<CachedResourceHandleBase*>::iterator end = m_handlesToRevalidate.end();
for (HashSet<CachedResourceHandleBase*>::iterator it = m_handlesToRevalidate.begin(); it != end; ++it) {
CachedResourceHandleBase* handle = *it;
@@ -565,10 +570,14 @@
for (unsigned n = 0; n < moveCount; ++n)
m_resourceToRevalidate->addClientToSet(clientsToMove[n]);
for (unsigned n = 0; n < moveCount; ++n) {
+ // Calling didAddClient may do anything, including trying to cancel revalidation.
+ // Assert that it didn't succeed.
+ ASSERT(m_resourceToRevalidate);
// Calling didAddClient for a client may end up removing another client. In that case it won't be in the set anymore.
if (m_resourceToRevalidate->m_clients.contains(clientsToMove[n]))
m_resourceToRevalidate->didAddClient(clientsToMove[n]);
}
+ m_switchingClientsToRevalidatedResource = false;
}
void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& validatingResponse)
« no previous file with comments | « Source/WebCore/loader/cache/CachedResource.h ('k') | Source/WebCore/loader/cache/MemoryCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698