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

Unified Diff: Source/devtools/front_end/CSSStyleModel.js

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/InspectorDebuggerAgent.cpp ('k') | Source/web/WebDevToolsAgentImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/CSSStyleModel.js
diff --git a/Source/devtools/front_end/CSSStyleModel.js b/Source/devtools/front_end/CSSStyleModel.js
index 3d54bf465c4fafdb90d2f6f36fefc29dae0a33dc..b3f63df89360467eecbe12bb429133c19f47dc4a 100644
--- a/Source/devtools/front_end/CSSStyleModel.js
+++ b/Source/devtools/front_end/CSSStyleModel.js
@@ -169,7 +169,23 @@ WebInspector.CSSStyleModel.prototype = {
*/
allStyleSheets: function()
{
- return Object.values(this._styleSheetIdToHeader);
+ var values = Object.values(this._styleSheetIdToHeader);
+ /**
+ * @param {!WebInspector.CSSStyleSheetHeader} a
+ * @param {!WebInspector.CSSStyleSheetHeader} b
+ * @return {number}
+ */
+ function styleSheetComparator(a, b)
+ {
+ if (a.sourceURL < b.sourceURL)
+ return -1;
+ else if (a.sourceURL > b.sourceURL)
+ return 1;
+ return a.startLine - b.startLine || a.startColumn - b.startColumn;
+ }
+ values.sort(styleSheetComparator);
+
+ return values;
},
/**
@@ -345,7 +361,6 @@ WebInspector.CSSStyleModel.prototype = {
mediaQueryResultChanged: function()
{
- this._styleLoader.reset();
this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);
},
@@ -383,7 +398,6 @@ WebInspector.CSSStyleModel.prototype = {
*/
_fireStyleSheetChanged: function(styleSheetId)
{
- this._styleLoader.reset();
if (!this._pendingCommandsMajorState.length)
return;
@@ -413,7 +427,6 @@ WebInspector.CSSStyleModel.prototype = {
frameIdToStyleSheetIds[styleSheetHeader.frameId] = styleSheetIds;
}
styleSheetIds.push(styleSheetHeader.id);
- this._styleLoader.reset();
this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetAdded, styleSheetHeader);
},
@@ -433,7 +446,6 @@ WebInspector.CSSStyleModel.prototype = {
if (!Object.keys(this._styleSheetIdsForURL[url]).length)
delete this._styleSheetIdsForURL[url];
}
- this._styleLoader.reset();
this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, header);
},
@@ -1523,16 +1535,6 @@ WebInspector.CSSStyleModel.ComputedStyleLoader = function(cssModel)
}
WebInspector.CSSStyleModel.ComputedStyleLoader.prototype = {
- reset: function()
- {
- for (var nodeId in this._nodeIdToCallbackData) {
- var callbacks = this._nodeIdToCallbackData[nodeId];
- for (var i = 0; i < callbacks.length; ++i)
- callbacks[i](null);
- }
- this._nodeIdToCallbackData = {};
- },
-
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.cpp ('k') | Source/web/WebDevToolsAgentImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698