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

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: Address comments. 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 928a451382cf0afffc0afdd210f30bbe9b1eb6dd..d9f73c8f26764e1a654b3aa6a224d5d86310c998 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -416,16 +416,29 @@ 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)
+ return;
+
+ 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