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

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

Issue 1576113006: Fix null dereference on MemoryCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 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
Index: third_party/WebKit/Source/core/fetch/MemoryCache.cpp
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
index c609a0ed06545b483c4f22cac70d5e2febe69b98..0aad6d242b1ed8e5bb127511a4c0bb39f1e9fc7c 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -354,7 +354,7 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
}
// Decoded data may reference other resources. Stop iterating if 'previous' somehow got
// kicked out of cache during destroyDecodedData().
- if (previous && !contains(previous->m_resource.get()))
+ if (!previous || !previous->m_resource || !contains(previous->m_resource.get()))
break;
current = previous;
}
@@ -374,7 +374,7 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
if (targetSize && m_deadSize <= targetSize)
return;
}
- if (previous && !contains(previous->m_resource.get()))
+ if (!previous || !previous->m_resource || !contains(previous->m_resource.get()))
break;
current = previous;
}
@@ -793,6 +793,15 @@ void MemoryCache::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProc
}
}
+bool MemoryCache::isInSameLRUListForTest(const Resource* x, const Resource* y)
+{
+ MemoryCacheEntry* ex = getEntryForResource(x);
+ MemoryCacheEntry* ey = getEntryForResource(y);
+ ASSERT(ex);
+ ASSERT(ey);
+ return lruListFor(ex->m_accessCount, x->size()) == lruListFor(ey->m_accessCount, y->size());
+}
+
void MemoryCache::registerLiveResource(Resource& resource)
{
#if ENABLE(OILPAN)
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.h ('k') | third_party/WebKit/Source/core/fetch/StyleSheetResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698