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

Unified Diff: sky/engine/core/dom/StyleEngine.cpp

Issue 786933008: Simplify StyleEngine clean up. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/StyleEngine.cpp
diff --git a/sky/engine/core/dom/StyleEngine.cpp b/sky/engine/core/dom/StyleEngine.cpp
index b94faa25e5df80d6dea57391e25155ce46851194..ef36e93e71269d23e0f788adc0e8749bf49cb5eb 100644
--- a/sky/engine/core/dom/StyleEngine.cpp
+++ b/sky/engine/core/dom/StyleEngine.cpp
@@ -47,32 +47,15 @@ namespace blink {
StyleEngine::StyleEngine(Document& document)
: m_document(&document)
, m_ignorePendingStylesheets(false)
- // We don't need to create CSSFontSelector for imported document or
- // HTMLTemplateElement's document, because those documents have no frame.
- , m_fontSelector(document.frame() ? CSSFontSelector::create(&document) : nullptr)
+ , m_fontSelector(CSSFontSelector::create(&document))
{
- if (m_fontSelector)
- m_fontSelector->registerForInvalidationCallbacks(this);
+ m_fontSelector->registerForInvalidationCallbacks(this);
}
StyleEngine::~StyleEngine()
{
-}
-
-void StyleEngine::detachFromDocument()
-{
- // Cleanup is performed eagerly when the StyleEngine is removed from the
- // document. The StyleEngine is unreachable after this, since only the
- // document has a reference to it.
-
- if (m_fontSelector) {
- m_fontSelector->clearDocument();
- m_fontSelector->unregisterForInvalidationCallbacks(this);
- }
-
- // Decrement reference counts for things we could be keeping alive.
- m_fontSelector.clear();
- m_resolver.clear();
+ m_fontSelector->clearDocument();
+ m_fontSelector->unregisterForInvalidationCallbacks(this);
}
void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser)
@@ -158,11 +141,6 @@ unsigned StyleEngine::resolverAccessCount() const
return m_resolver ? m_resolver->accessCount() : 0;
}
-void StyleEngine::didDetach()
-{
- clearResolver();
-}
-
void StyleEngine::resolverChanged()
{
// Don't bother updating, since we haven't loaded all our style info yet
@@ -177,8 +155,7 @@ void StyleEngine::resolverChanged()
void StyleEngine::clearFontCache()
{
- if (m_fontSelector)
- m_fontSelector->fontFaceCache()->clearCSSConnected();
+ m_fontSelector->fontFaceCache()->clearCSSConnected();
if (m_resolver)
m_resolver->invalidateMatchedPropertiesCache();
}
@@ -189,9 +166,6 @@ void StyleEngine::updateGenericFontFamilySettings()
// document is inactive.
ASSERT(m_document->isActive());
- if (!m_fontSelector)
- return;
-
m_fontSelector->updateGenericFontFamilySettings(*m_document);
if (m_resolver)
m_resolver->invalidateMatchedPropertiesCache();
@@ -199,9 +173,6 @@ void StyleEngine::updateGenericFontFamilySettings()
void StyleEngine::removeFontFaceRules(const Vector<RawPtr<const StyleRuleFontFace> >& fontFaceRules)
{
- if (!m_fontSelector)
- return;
-
FontFaceCache* cache = m_fontSelector->fontFaceCache();
for (unsigned i = 0; i < fontFaceRules.size(); ++i)
cache->remove(fontFaceRules[i]);
« no previous file with comments | « sky/engine/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698