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

Unified Diff: third_party/WebKit/Source/core/css/CSSStyleSheet.cpp

Issue 2205843003: Use weak members to cache StyleSheetContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Might be in cache without being used before garbage collection Created 4 years, 4 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/css/CSSStyleSheet.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
index b02b81df3a76c6daa27eb9c8061d20bc6d2201b3..56a7481a7f7acc29ba2df185e4530fccc393e140 100644
--- a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
+++ b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
@@ -147,10 +147,8 @@ static bool isStyleElement(const Node* node)
void CSSStyleSheet::willMutateRules()
{
// If we are the only client it is safe to mutate.
- if (m_contents->clientSize() <= 1 && !m_contents->isReferencedFromResource()) {
+ if (!m_contents->isUsedFromTextCache() && !m_contents->isReferencedFromResource()) {
m_contents->clearRuleSet();
- if (Document* document = ownerDocument())
- m_contents->removeSheetFromCache(document);
m_contents->setMutable();
return;
}

Powered by Google App Engine
This is Rietveld 408576698