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

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

Issue 1813673002: Add guard for crash in MemoryCache::pruneDeadResources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO note Created 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8aa8ab83ad78f9b6479caa3a5a9abe94431b33cd..dba7e46400ef1abdaddab1d3078d641cbffcd9ad 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -299,7 +299,10 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
ASSERT(previous->m_resource);
ASSERT(contains(previous->m_resource.get()));
}
- if (!current->m_resource->hasClients() && !current->m_resource->isPreloaded() && current->m_resource->isLoaded()) {
+ // TODO(leon.han@intel.com): We shouldn't be hitting the case
+ // that current->m_resource is null here, would turn the case into
+ // ASSERT(current->m_resource) after crbug.com/594644 got resolved.
+ if (current->m_resource && !current->m_resource->hasClients() && !current->m_resource->isPreloaded() && current->m_resource->isLoaded()) {
// Destroy our decoded data. This will remove us from
// m_liveDecodedResources, and possibly move us to a different
// LRU list in m_allResources.
@@ -323,7 +326,10 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
ASSERT(previous->m_resource);
ASSERT(contains(previous->m_resource.get()));
}
- if (!current->m_resource->hasClients() && !current->m_resource->isPreloaded()) {
+ // TODO(leon.han@intel.com): We shouldn't be hitting the case
+ // that current->m_resource is null here, would turn the case into
+ // ASSERT(current->m_resource) after crbug.com/594644 got resolved.
+ if (current->m_resource && !current->m_resource->hasClients() && !current->m_resource->isPreloaded()) {
evict(current);
if (targetSize && m_deadSize <= targetSize)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698