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

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: 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/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorController.h » ('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 aac36c83eeb18e2e19584974cab36c9086ac7dfc..a04f07aa031f40bc9c8320c481d7073e7d7455b5 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -431,11 +431,22 @@ void InspectorCSSAgent::restore()
wasEnabled(nullptr);
}
+void InspectorCSSAgent::flushPendingFrontendMessages()
+{
+ 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::reset()
{
m_idToInspectorStyleSheet.clear();
m_cssStyleSheetToInspectorStyleSheet.clear();
m_documentToCSSStyleSheets.clear();
+ m_invalidatedDocuments.clear();
m_nodeToInspectorStyleSheet.clear();
m_documentToViaInspectorStyleSheet.clear();
resetNonPersistentData();
@@ -519,8 +530,8 @@ void InspectorCSSAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader)
void InspectorCSSAgent::mediaQueryResultChanged()
{
- if (m_frontend)
- m_frontend->mediaQueryResultChanged();
+ flushPendingFrontendMessages();
+ m_frontend->mediaQueryResultChanged();
}
void InspectorCSSAgent::willMutateRules()
@@ -561,7 +572,9 @@ void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document)
{
if (styleSheetEditInProgress())
return;
- updateActiveStyleSheets(document, ExistingFrontendRefresh);
+ m_invalidatedDocuments.add(document);
+ if (m_creatingViaInspectorStyleSheet)
+ flushPendingFrontendMessages();
}
void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsUpdateType styleSheetsUpdateType)
@@ -628,6 +641,7 @@ void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
void InspectorCSSAgent::documentDisposed(Document* document)
{
+ m_invalidatedDocuments.remove(document);
setActiveStyleSheets(document, Vector<CSSStyleSheet*>(), ExistingFrontendRefresh);
}
@@ -896,6 +910,8 @@ void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String&
return;
}
+ updateActiveStyleSheets(document, ExistingFrontendRefresh);
+
*outStyleSheetId = inspectorStyleSheet->id();
}
@@ -1316,8 +1332,8 @@ void InspectorCSSAgent::didModifyDOMAttr(Element* element)
void InspectorCSSAgent::styleSheetChanged(InspectorStyleSheet* styleSheet)
{
- if (m_frontend)
- m_frontend->styleSheetChanged(styleSheet->id());
+ flushPendingFrontendMessages();
+ m_frontend->styleSheetChanged(styleSheet->id());
}
void InspectorCSSAgent::willReparseStyleSheet()
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698