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

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

Issue 1941733002: Don't cache parsed stylesheet if it wasn't added to the memory cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp ('k') | 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/CSSStyleSheetResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
index 78ebcd9928613cb4efdb798cef7753d0910e510b..c69e1882e0ad1b48cf7d93349660de1fde03ec3c 100644
--- a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
@@ -185,14 +185,17 @@ void CSSStyleSheetResource::saveParsedStyleSheet(StyleSheetContents* sheet)
if (m_parsedStyleSheetCache)
m_parsedStyleSheetCache->removedFromMemoryCache();
+
+ if (!memoryCache()->contains(this)) {
+ // This stylesheet resource did conflict with another resource and was
+ // not added to the cache.
+ m_parsedStyleSheetCache = nullptr;
+ return;
+ }
m_parsedStyleSheetCache = sheet;
+ m_parsedStyleSheetCache->addedToMemoryCache();
setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
-
- // Check if this stylesheet resource didn't conflict with
- // another resource and has indeed been added to the cache.
- if (memoryCache()->contains(this))
- m_parsedStyleSheetCache->addedToMemoryCache();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698