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

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

Issue 179873014: Move StyleSheetContents cache to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 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 | « Source/core/css/CSSStyleSheet.h ('k') | Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSStyleSheet.cpp
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index d9f73c8f26764e1a654b3aa6a224d5d86310c998..88978e577c5efac65bc15463d1e6f05fbf83f6ef 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -158,11 +158,11 @@ CSSStyleSheet::~CSSStyleSheet()
void CSSStyleSheet::willMutateRules()
{
InspectorInstrumentation::willMutateRules(this);
+
// If we are the only client it is safe to mutate.
- if (m_contents->hasOneClient() && !m_contents->isInMemoryCache()) {
+ if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) {
m_contents->clearRuleSet();
- if (m_contents->maybeCacheable())
- StyleEngine::removeSheet(m_contents.get());
+ m_contents->removeSheetFromCache(ownerDocument());
m_contents->setMutable();
return;
}
@@ -183,7 +183,7 @@ void CSSStyleSheet::willMutateRules()
void CSSStyleSheet::didMutateRules()
{
ASSERT(m_contents->isMutable());
- ASSERT(m_contents->hasOneClient());
+ ASSERT(m_contents->clientSize() <= 1);
InspectorInstrumentation::didMutateRules(this);
didMutate(PartialRuleUpdate);
@@ -255,6 +255,14 @@ CSSRule* CSSStyleSheet::item(unsigned index)
return cssRule.get();
}
+void CSSStyleSheet::clearOwnerNode()
+{
+ didMutate(EntireStyleSheetUpdate);
+ if (m_ownerNode)
+ m_contents->unregisterClient(this);
+ m_ownerNode = 0;
+}
+
bool CSSStyleSheet::canAccessRules() const
{
if (m_isInlineStylesheet)
« no previous file with comments | « Source/core/css/CSSStyleSheet.h ('k') | Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698