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

Unified Diff: third_party/WebKit/Source/core/css/StyleSheetContents.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/StyleSheetContents.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
index a3a7b8ff31a319af23ec78c0e0546a2d33e254b9..9ad890082c3cc4b20fc52366b5317ba5fd16ad06 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -65,6 +65,7 @@ StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String&
, m_hasFontFaceRule(false)
, m_hasMediaQueries(false)
, m_hasSingleOwnerDocument(true)
+ , m_isUsedFromTextCache(false)
, m_parserContext(context)
{
}
@@ -83,6 +84,7 @@ StyleSheetContents::StyleSheetContents(const StyleSheetContents& o)
, m_hasFontFaceRule(o.m_hasFontFaceRule)
, m_hasMediaQueries(o.m_hasMediaQueries)
, m_hasSingleOwnerDocument(true)
+ , m_isUsedFromTextCache(false)
, m_parserContext(o.m_parserContext)
{
// FIXME: Copy import rules.
@@ -98,10 +100,6 @@ StyleSheetContents::~StyleSheetContents()
void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss)
{
- if (!isValidCss) {
- if (Document* document = clientSingleOwnerDocument())
- removeSheetFromCache(document);
haraken 2016/08/03 01:01:18 For example, don't you need to explicitly remove t
rune 2016/08/03 09:20:05 I think that removeSheetFromCache here never remov
- }
m_hasSyntacticallyValidCSSHeader = isValidCss;
}
@@ -546,8 +544,6 @@ void StyleSheetContents::unregisterClient(CSSStyleSheet* sheet)
if (!sheet->ownerDocument() || !m_loadingClients.isEmpty() || !m_completedClients.isEmpty())
return;
- if (m_hasSingleOwnerDocument)
- removeSheetFromCache(sheet->ownerDocument());
m_hasSingleOwnerDocument = true;
}
@@ -570,12 +566,6 @@ void StyleSheetContents::clientLoadStarted(CSSStyleSheet* sheet)
m_loadingClients.add(sheet);
}
-void StyleSheetContents::removeSheetFromCache(Document* document)
-{
- ASSERT(document);
- document->styleEngine().removeSheet(this);
-}
-
void StyleSheetContents::setReferencedFromResource(CSSStyleSheetResource* resource)
{
DCHECK(resource);
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/dom/StyleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698