Web Inspector: replace uses of `Array.prototype.concat` with `Array.prototype.push`
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Aug 2019 23:56:12 +0000 (23:56 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Aug 2019 23:56:12 +0000 (23:56 +0000)
commitf0f62a06bdd093b17e99c984432d597ad3e7691a
tree3cd0896184589903650cf3c8efd2f3aedbbd5c84
parent7e13d94b1bfc07def893196df16c2e2e19f7b348
Web Inspector: replace uses of `Array.prototype.concat` with `Array.prototype.push`
https://bugs.webkit.org/show_bug.cgi?id=201082

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

`x = x.concat(y)` is very slow, as `x` has to be fully copied in order to add `y` to it.
Introduce `Array.prototype.pushIterable`, which iterates the given `iterable` and adds each
item to the `this` array.

* UserInterface/Controllers/DOMDebuggerManager.js:
(WI.DOMDebuggerManager.prototype.get domBreakpoints):
(WI.DOMDebuggerManager.prototype.domBreakpointsInSubtree):
* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
(WI.JavaScriptRuntimeCompletionProvider.completionControllerCompletionsNeeded.receivedPropertyNames):
* UserInterface/Models/CSSCompletions.js:
(WI.CSSCompletions):
* UserInterface/Models/CSSKeywordCompletions.js:
(WI.CSSKeywordCompletions.forProperty):
(WI.CSSKeywordCompletions.forProperty.addKeywordsForName):
(WI.CSSKeywordCompletions.forFunction):
* UserInterface/Models/Canvas.js:
(WI.Canvas.prototype.recordingProgress):
* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype._updateStyleCascade):
(WI.DOMNodeStyles.prototype._collectStylesInCascadeOrder):
* UserInterface/Models/TimelineRecording.js:
(WI.TimelineRecording.prototype.get sourceCodeTimelines):
(WI.TimelineRecording.prototype.initializeCallingContextTrees):
* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype._getPropertyDescriptorsResolver):
* UserInterface/Views/ConsoleMessageView.js:
(WI.ConsoleMessageView.prototype._appendMessageTextAndArguments):
* UserInterface/Views/ContentBrowser.js:
(WI.ContentBrowser.prototype.get currentRepresentedObjects):
* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype._visibleChildren):
* UserInterface/Views/DataGridNode.js:
(WI.DataGridNode.prototype.get filterableData):
* UserInterface/Views/HeapAllocationsTimelineView.js:
(WI.HeapAllocationsTimelineView.prototype.get selectionPathComponents):
* UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
(WI.IndexedDatabaseObjectStoreContentView.prototype._fetchMoreData.processEntries):
* UserInterface/Views/NavigationItem.js:
(WI.NavigationItem.prototype.get _classNames):
* UserInterface/Views/ObjectTreeView.js:
(WI.ObjectTreeView.prototype._updateProperties):
* UserInterface/Views/OpenResourceDialog.js:
(WI.OpenResourceDialog.prototype._addResourcesForFrame):
* UserInterface/Views/OverviewTimelineView.js:
(WI.OverviewTimelineView.prototype._loadExistingRecords):
* UserInterface/Views/ResourceCollectionContentView.js:
(WI.ResourceCollectionContentView.prototype.get navigationItems):
* UserInterface/Views/ResourceHeadersContentView.js:
(WI.ResourceHeadersContentView.prototype._perfomSearchOnKeyValuePairs):
* UserInterface/Views/ResourceSecurityContentView.js:
(WI.ResourceSecurityContentView.prototype._perfomSearchOnKeyValuePairs):
* UserInterface/Views/ScriptClusterTimelineView.js:
(WI.ScriptClusterTimelineView.prototype.get selectionPathComponents):
* UserInterface/Views/ScrubberNavigationItem.js:
(WI.ScrubberNavigationItem.prototype.get additionalClassNames):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._addGradientTokens):
(WI.SpreadsheetStyleProperty.prototype._addColorTokens.pushPossibleColorToken):
(WI.SpreadsheetStyleProperty.prototype._addTimingFunctionTokens):
(WI.SpreadsheetStyleProperty.prototype._addVariableTokens):
* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selfOrDescendant):
* UserInterface/Views/View.js:
(WI.View._visitViewTreeForLayout):

LayoutTests:

* inspector/unit-tests/array-utilities.html:
* inspector/unit-tests/array-utilities-expected.txt:
Add tests for added utility `Array.prototype.pushIterable`.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/unit-tests/array-utilities-expected.txt
LayoutTests/inspector/unit-tests/array-utilities.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Utilities.js
Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
Source/WebInspectorUI/UserInterface/Models/Canvas.js
Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DataGridNode.js
Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js
Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js
Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js
Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
Source/WebInspectorUI/UserInterface/Views/View.js