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

Unified Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 201363002: DevTools: defer styles delta calculation to until the end of the task. (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/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorCSSAgent.cpp
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index 206709bafc0d5e58f282302be7ca215fa21da5d1..b1ebd8d036fecfc652ef6f11e7e0e6f37ab772c8 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -436,6 +436,7 @@ void InspectorCSSAgent::reset()
m_idToInspectorStyleSheet.clear();
m_cssStyleSheetToInspectorStyleSheet.clear();
m_documentToCSSStyleSheets.clear();
+ m_invalidatedDocuments.clear();
m_nodeToInspectorStyleSheet.clear();
m_documentToViaInspectorStyleSheet.clear();
resetNonPersistentData();
@@ -519,8 +520,8 @@ void InspectorCSSAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader)
void InspectorCSSAgent::mediaQueryResultChanged()
{
- if (m_frontend)
- m_frontend->mediaQueryResultChanged();
+ validateFrontendStylesheets();
+ m_frontend->mediaQueryResultChanged();
}
void InspectorCSSAgent::willMutateRules()
@@ -557,11 +558,18 @@ void InspectorCSSAgent::didMutateStyle(CSSStyleDeclaration* style, bool isInline
}
}
+void InspectorCSSAgent::didProcessTask()
+{
+ validateFrontendStylesheets();
+}
+
void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document)
{
if (styleSheetEditInProgress())
return;
- updateActiveStyleSheets(document, ExistingFrontendRefresh);
+ m_invalidatedDocuments.add(document);
+ if (m_creatingViaInspectorStyleSheet)
+ validateFrontendStylesheets();
}
void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsUpdateType styleSheetsUpdateType)
@@ -626,8 +634,19 @@ void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
m_documentToCSSStyleSheets.remove(document);
}
+void InspectorCSSAgent::validateFrontendStylesheets()
+{
+ if (!m_invalidatedDocuments.size())
+ return;
+ HashSet<Document*> invalidatedDocuments;
+ m_invalidatedDocuments.swap(&invalidatedDocuments);
+ for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != invalidatedDocuments.end(); ++it)
+ updateActiveStyleSheets(*it, ExistingFrontendRefresh);
+}
+
void InspectorCSSAgent::documentDisposed(Document* document)
{
+ m_invalidatedDocuments.remove(document);
setActiveStyleSheets(document, Vector<CSSStyleSheet*>(), ExistingFrontendRefresh);
}
@@ -896,6 +915,8 @@ void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String&
return;
}
+ updateActiveStyleSheets(document, ExistingFrontendRefresh);
vsevik 2014/03/17 12:49:28 remove
+
*outStyleSheetId = inspectorStyleSheet->id();
}
@@ -1316,8 +1337,8 @@ void InspectorCSSAgent::didModifyDOMAttr(Element* element)
void InspectorCSSAgent::styleSheetChanged(InspectorStyleSheet* styleSheet)
{
- if (m_frontend)
- m_frontend->styleSheetChanged(styleSheet->id());
+ validateFrontendStylesheets();
+ m_frontend->styleSheetChanged(styleSheet->id());
}
void InspectorCSSAgent::willReparseStyleSheet()
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698