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

Unified Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 2838263002: [DevTools] Throttle node decorations update in UI (Closed)
Patch Set: null check Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
index 25853dbed1a8e951a9e22ec033cf3114cc5f6d58..51268fdc6ff9eda688fd0e6c54cf2511a4ca9e1f 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -53,6 +53,7 @@ Elements.ElementsTreeElement = class extends UI.TreeElement {
this._canAddAttributes = true;
this._searchQuery = null;
this._expandedChildrenLimit = Elements.ElementsTreeElement.InitialChildrenLimit;
+ this._decorationsThrottler = new Common.Throttler(100);
}
/**
@@ -1086,10 +1087,21 @@ Elements.ElementsTreeElement = class extends UI.TreeElement {
if (this.isClosingTag())
return;
- var node = this._node;
- if (node.nodeType() !== Node.ELEMENT_NODE)
+ if (this._node.nodeType() !== Node.ELEMENT_NODE)
return;
+ this._decorationsThrottler.schedule(this._updateDecorationsInternal.bind(this));
+ }
+
+ /**
+ * @return {!Promise}
+ */
+ _updateDecorationsInternal() {
+ if (!this.treeOutline)
+ return Promise.resolve();
+
+ var node = this._node;
+
if (!this.treeOutline._decoratorExtensions)
/** @type {!Array.<!Runtime.Extension>} */
this.treeOutline._decoratorExtensions = runtime.extensions(Components.DOMPresentationUtils.MarkerDecorator);
@@ -1127,7 +1139,7 @@ Elements.ElementsTreeElement = class extends UI.TreeElement {
(n === node ? decorations : descendantDecorations).push(decoration);
}
- Promise.all(promises).then(updateDecorationsUI.bind(this));
+ return Promise.all(promises).then(updateDecorationsUI.bind(this));
/**
* @this {Elements.ElementsTreeElement}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698