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

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

Issue 196653006: Optimize StyleSheetContents::checkLoaded by keeping track of completed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 6fda90bfab319e8fcf684a2291da58ab170e16ef..63bdd1ec1df573baba018b70709214516dbe47c9 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -404,16 +404,27 @@ void CSSStyleSheet::clearChildRuleCSSOMWrappers()
bool CSSStyleSheet::sheetLoaded()
{
ASSERT(m_ownerNode);
- m_loadCompleted = m_ownerNode->sheetLoaded();
+ setLoadCompleted(m_ownerNode->sheetLoaded());
return m_loadCompleted;
}
void CSSStyleSheet::startLoadingDynamicSheet()
{
- m_loadCompleted = false;
+ setLoadCompleted(false);
m_ownerNode->startLoadingDynamicSheet();
}
+void CSSStyleSheet::setLoadCompleted(bool completed)
+{
+ if (completed != m_loadCompleted) {
tasak 2014/03/13 01:29:31 Nit: I think, blink loves early return.
Mads Ager (chromium) 2014/03/13 09:08:23 Done.
+ m_loadCompleted = completed;
+ if (completed)
+ m_contents->clientLoadCompleted(this);
+ else
+ m_contents->clientLoadStarted(this);
+ }
+}
+
void CSSStyleSheet::trace(Visitor* visitor)
{
visitor->trace(m_contents);
« 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