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

Unified Diff: Source/core/fetch/MemoryCache.cpp

Issue 202243003: Fix crashes in MemoryCache related to successful revalidation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « no previous file | Source/core/fetch/MemoryCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/MemoryCache.cpp
diff --git a/Source/core/fetch/MemoryCache.cpp b/Source/core/fetch/MemoryCache.cpp
index e6d24c93f54cd8d4da18a79b4657f2b1c4f322da..208ade0cfca0f96f8504c0522baee41ae5ecab34 100644
--- a/Source/core/fetch/MemoryCache.cpp
+++ b/Source/core/fetch/MemoryCache.cpp
@@ -327,13 +327,14 @@ MemoryCache::LRUList* MemoryCache::lruListFor(MemoryCacheEntry* entry)
void MemoryCache::removeFromLRUList(Resource* resource)
{
- // If we've never been accessed, then we're brand new and not in any list.
- if (!resource->accessCount())
- return;
-
MemoryCacheEntry* entry = m_resources.get(resource->url());
ASSERT(entry->m_resource == resource);
+
LRUList* list = lruListFor(entry);
+ MemoryCacheEntry* next = entry->m_nextInAllResourcesList;
+ MemoryCacheEntry* previous = entry->m_previousInAllResourcesList;
+ if (!next && !previous && list->m_head != entry)
+ return;
#if !ASSERT_DISABLED
// Verify that we are in fact in this list.
@@ -347,9 +348,6 @@ void MemoryCache::removeFromLRUList(Resource* resource)
ASSERT(found);
#endif
- MemoryCacheEntry* next = entry->m_nextInAllResourcesList;
- MemoryCacheEntry* previous = entry->m_previousInAllResourcesList;
-
entry->m_nextInAllResourcesList = 0;
entry->m_previousInAllResourcesList = 0;
@@ -372,7 +370,6 @@ void MemoryCache::insertInLRUList(Resource* resource)
// Make sure we aren't in some list already.
ASSERT(!entry->m_nextInAllResourcesList && !entry->m_previousInAllResourcesList);
ASSERT(resource->inCache());
- ASSERT(resource->accessCount() > 0);
LRUList* list = lruListFor(entry);
« no previous file with comments | « no previous file | Source/core/fetch/MemoryCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698