chrome-devtools-frontend 1.0.951410 → 1.0.952713
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +3 -0
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +203 -203
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
- package/front_end/entrypoints/main/MainImpl.ts +49 -49
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
- package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/FileUtils.ts +0 -3
- package/front_end/models/extensions/ExtensionAPI.ts +2 -1
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +61 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -6
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/event_listeners/EventListenersUtils.ts +2 -1
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +92 -37
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/sources/NavigatorView.ts +3 -9
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +7 -1
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
/* eslint-disable rulesdir/use_private_class_members */
|
|
32
|
+
|
|
31
33
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
32
34
|
import * as Platform from '../../core/platform/platform.js';
|
|
33
35
|
import * as HeapSnapshotModel from '../../models/heap_snapshot_model/heap_snapshot_model.js';
|
|
@@ -123,51 +125,51 @@ export interface HeapSnapshotItemIndexProvider {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
export class HeapSnapshotNodeIndexProvider implements HeapSnapshotItemIndexProvider {
|
|
126
|
-
|
|
128
|
+
#node: HeapSnapshotNode;
|
|
127
129
|
constructor(snapshot: HeapSnapshot) {
|
|
128
|
-
this
|
|
130
|
+
this.#node = snapshot.createNode();
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
itemForIndex(index: number): HeapSnapshotNode {
|
|
132
|
-
this
|
|
133
|
-
return this
|
|
134
|
+
this.#node.nodeIndex = index;
|
|
135
|
+
return this.#node;
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
export class HeapSnapshotEdgeIndexProvider implements HeapSnapshotItemIndexProvider {
|
|
138
|
-
|
|
140
|
+
#edge: JSHeapSnapshotEdge;
|
|
139
141
|
constructor(snapshot: HeapSnapshot) {
|
|
140
|
-
this
|
|
142
|
+
this.#edge = snapshot.createEdge(0);
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
itemForIndex(index: number): HeapSnapshotEdge {
|
|
144
|
-
this
|
|
145
|
-
return this
|
|
146
|
+
this.#edge.edgeIndex = index;
|
|
147
|
+
return this.#edge;
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
export class HeapSnapshotRetainerEdgeIndexProvider implements HeapSnapshotItemIndexProvider {
|
|
150
|
-
|
|
152
|
+
readonly #retainerEdge: JSHeapSnapshotRetainerEdge;
|
|
151
153
|
constructor(snapshot: HeapSnapshot) {
|
|
152
|
-
this
|
|
154
|
+
this.#retainerEdge = snapshot.createRetainingEdge(0);
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
itemForIndex(index: number): HeapSnapshotRetainerEdge {
|
|
156
|
-
this
|
|
157
|
-
return this
|
|
158
|
+
this.#retainerEdge.setRetainerIndex(index);
|
|
159
|
+
return this.#retainerEdge;
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
export class HeapSnapshotEdgeIterator implements HeapSnapshotItemIterator {
|
|
162
|
-
|
|
164
|
+
readonly #sourceNode: HeapSnapshotNode;
|
|
163
165
|
edge: JSHeapSnapshotEdge;
|
|
164
166
|
constructor(node: HeapSnapshotNode) {
|
|
165
|
-
this
|
|
167
|
+
this.#sourceNode = node;
|
|
166
168
|
this.edge = node.snapshot.createEdge(node.edgeIndexesStart());
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
hasNext(): boolean {
|
|
170
|
-
return this.edge.edgeIndex < this
|
|
172
|
+
return this.edge.edgeIndex < this.#sourceNode.edgeIndexesEnd();
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
item(): HeapSnapshotEdge {
|
|
@@ -184,11 +186,11 @@ export class HeapSnapshotEdgeIterator implements HeapSnapshotItemIterator {
|
|
|
184
186
|
|
|
185
187
|
export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
186
188
|
protected snapshot: HeapSnapshot;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
#retainerIndexInternal!: number;
|
|
190
|
+
#globalEdgeIndex!: number;
|
|
191
|
+
#retainingNodeIndex?: number;
|
|
192
|
+
#edgeInstance?: JSHeapSnapshotEdge|null;
|
|
193
|
+
#nodeInstance?: HeapSnapshotNode|null;
|
|
192
194
|
constructor(snapshot: HeapSnapshot, retainerIndex: number) {
|
|
193
195
|
this.snapshot = snapshot;
|
|
194
196
|
this.setRetainerIndex(retainerIndex);
|
|
@@ -211,19 +213,19 @@ export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
nodeIndex(): number {
|
|
214
|
-
if (typeof this
|
|
216
|
+
if (typeof this.#retainingNodeIndex === 'undefined') {
|
|
215
217
|
throw new Error('retainingNodeIndex is undefined');
|
|
216
218
|
}
|
|
217
219
|
|
|
218
|
-
return this
|
|
220
|
+
return this.#retainingNodeIndex;
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
retainerIndex(): number {
|
|
222
|
-
return this
|
|
224
|
+
return this.#retainerIndexInternal;
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
setRetainerIndex(retainerIndex: number): void {
|
|
226
|
-
if (retainerIndex === this
|
|
228
|
+
if (retainerIndex === this.#retainerIndexInternal) {
|
|
227
229
|
return;
|
|
228
230
|
}
|
|
229
231
|
|
|
@@ -231,11 +233,11 @@ export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
|
231
233
|
throw new Error('Snapshot does not contain retaining edges or retaining nodes');
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
this
|
|
235
|
-
this
|
|
236
|
-
this
|
|
237
|
-
this
|
|
238
|
-
this
|
|
236
|
+
this.#retainerIndexInternal = retainerIndex;
|
|
237
|
+
this.#globalEdgeIndex = this.snapshot.retainingEdges[retainerIndex];
|
|
238
|
+
this.#retainingNodeIndex = this.snapshot.retainingNodes[retainerIndex];
|
|
239
|
+
this.#edgeInstance = null;
|
|
240
|
+
this.#nodeInstance = null;
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
set edgeIndex(edgeIndex: number) {
|
|
@@ -243,17 +245,17 @@ export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
|
243
245
|
}
|
|
244
246
|
|
|
245
247
|
private nodeInternal(): HeapSnapshotNode {
|
|
246
|
-
if (!this
|
|
247
|
-
this
|
|
248
|
+
if (!this.#nodeInstance) {
|
|
249
|
+
this.#nodeInstance = this.snapshot.createNode(this.#retainingNodeIndex);
|
|
248
250
|
}
|
|
249
|
-
return this
|
|
251
|
+
return this.#nodeInstance;
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
protected edge(): JSHeapSnapshotEdge {
|
|
253
|
-
if (!this
|
|
254
|
-
this
|
|
255
|
+
if (!this.#edgeInstance) {
|
|
256
|
+
this.#edgeInstance = this.snapshot.createEdge(this.#globalEdgeIndex);
|
|
255
257
|
}
|
|
256
|
-
return this
|
|
258
|
+
return this.#edgeInstance;
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
toString(): string {
|
|
@@ -261,12 +263,12 @@ export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
itemIndex(): number {
|
|
264
|
-
return this
|
|
266
|
+
return this.#retainerIndexInternal;
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
serialize(): HeapSnapshotModel.HeapSnapshotModel.Edge {
|
|
268
270
|
return new HeapSnapshotModel.HeapSnapshotModel.Edge(
|
|
269
|
-
this.name(), this.node().serialize(), this.type(), this
|
|
271
|
+
this.name(), this.node().serialize(), this.type(), this.#globalEdgeIndex);
|
|
270
272
|
}
|
|
271
273
|
|
|
272
274
|
type(): string {
|
|
@@ -275,7 +277,7 @@ export class HeapSnapshotRetainerEdge implements HeapSnapshotItem {
|
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
export class HeapSnapshotRetainerEdgeIterator implements HeapSnapshotItemIterator {
|
|
278
|
-
|
|
280
|
+
readonly #retainersEnd: number;
|
|
279
281
|
retainer: JSHeapSnapshotRetainerEdge;
|
|
280
282
|
constructor(retainedNode: HeapSnapshotNode) {
|
|
281
283
|
const snapshot = retainedNode.snapshot;
|
|
@@ -284,12 +286,12 @@ export class HeapSnapshotRetainerEdgeIterator implements HeapSnapshotItemIterato
|
|
|
284
286
|
throw new Error('Snapshot does not contain firstRetainerIndex');
|
|
285
287
|
}
|
|
286
288
|
const retainerIndex = snapshot.firstRetainerIndex[retainedNodeOrdinal];
|
|
287
|
-
this
|
|
289
|
+
this.#retainersEnd = snapshot.firstRetainerIndex[retainedNodeOrdinal + 1];
|
|
288
290
|
this.retainer = snapshot.createRetainingEdge(retainerIndex);
|
|
289
291
|
}
|
|
290
292
|
|
|
291
293
|
hasNext(): boolean {
|
|
292
|
-
return this.retainer.retainerIndex() < this
|
|
294
|
+
return this.retainer.retainerIndex() < this.#retainersEnd;
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
item(): HeapSnapshotRetainerEdge {
|
|
@@ -432,14 +434,14 @@ export class HeapSnapshotNode implements HeapSnapshotItem {
|
|
|
432
434
|
|
|
433
435
|
export class HeapSnapshotNodeIterator implements HeapSnapshotItemIterator {
|
|
434
436
|
node: HeapSnapshotNode;
|
|
435
|
-
|
|
437
|
+
readonly #nodesLength: number;
|
|
436
438
|
constructor(node: HeapSnapshotNode) {
|
|
437
439
|
this.node = node;
|
|
438
|
-
this
|
|
440
|
+
this.#nodesLength = node.snapshot.nodes.length;
|
|
439
441
|
}
|
|
440
442
|
|
|
441
443
|
hasNext(): boolean {
|
|
442
|
-
return this.node.nodeIndex < this
|
|
444
|
+
return this.node.nodeIndex < this.#nodesLength;
|
|
443
445
|
}
|
|
444
446
|
|
|
445
447
|
item(): HeapSnapshotNode {
|
|
@@ -452,62 +454,62 @@ export class HeapSnapshotNodeIterator implements HeapSnapshotItemIterator {
|
|
|
452
454
|
}
|
|
453
455
|
|
|
454
456
|
export class HeapSnapshotIndexRangeIterator implements HeapSnapshotItemIterator {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
readonly #itemProvider: HeapSnapshotItemIndexProvider;
|
|
458
|
+
readonly #indexes: number[]|Uint32Array;
|
|
459
|
+
#position: number;
|
|
458
460
|
constructor(itemProvider: HeapSnapshotItemIndexProvider, indexes: number[]|Uint32Array) {
|
|
459
|
-
this
|
|
460
|
-
this
|
|
461
|
-
this
|
|
461
|
+
this.#itemProvider = itemProvider;
|
|
462
|
+
this.#indexes = indexes;
|
|
463
|
+
this.#position = 0;
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
hasNext(): boolean {
|
|
465
|
-
return this
|
|
467
|
+
return this.#position < this.#indexes.length;
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
item(): HeapSnapshotItem {
|
|
469
|
-
const index = this
|
|
470
|
-
return this
|
|
471
|
+
const index = this.#indexes[this.#position];
|
|
472
|
+
return this.#itemProvider.itemForIndex(index);
|
|
471
473
|
}
|
|
472
474
|
|
|
473
475
|
next(): void {
|
|
474
|
-
++this
|
|
476
|
+
++this.#position;
|
|
475
477
|
}
|
|
476
478
|
}
|
|
477
479
|
|
|
478
480
|
export class HeapSnapshotFilteredIterator implements HeapSnapshotItemIterator {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
+
#iterator: HeapSnapshotItemIterator;
|
|
482
|
+
#filter: ((arg0: HeapSnapshotItem) => boolean)|undefined;
|
|
481
483
|
constructor(iterator: HeapSnapshotItemIterator, filter?: ((arg0: HeapSnapshotItem) => boolean)) {
|
|
482
|
-
this
|
|
483
|
-
this
|
|
484
|
+
this.#iterator = iterator;
|
|
485
|
+
this.#filter = filter;
|
|
484
486
|
this.skipFilteredItems();
|
|
485
487
|
}
|
|
486
488
|
|
|
487
489
|
hasNext(): boolean {
|
|
488
|
-
return this
|
|
490
|
+
return this.#iterator.hasNext();
|
|
489
491
|
}
|
|
490
492
|
|
|
491
493
|
item(): HeapSnapshotItem {
|
|
492
|
-
return this
|
|
494
|
+
return this.#iterator.item();
|
|
493
495
|
}
|
|
494
496
|
|
|
495
497
|
next(): void {
|
|
496
|
-
this
|
|
498
|
+
this.#iterator.next();
|
|
497
499
|
this.skipFilteredItems();
|
|
498
500
|
}
|
|
499
501
|
|
|
500
502
|
private skipFilteredItems(): void {
|
|
501
|
-
while (this
|
|
502
|
-
this
|
|
503
|
+
while (this.#iterator.hasNext() && this.#filter && !this.#filter(this.#iterator.item())) {
|
|
504
|
+
this.#iterator.next();
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
507
|
}
|
|
506
508
|
|
|
507
509
|
export class HeapSnapshotProgress {
|
|
508
|
-
|
|
510
|
+
readonly #dispatcher: HeapSnapshotWorkerDispatcher|undefined;
|
|
509
511
|
constructor(dispatcher?: HeapSnapshotWorkerDispatcher) {
|
|
510
|
-
this
|
|
512
|
+
this.#dispatcher = dispatcher;
|
|
511
513
|
}
|
|
512
514
|
|
|
513
515
|
updateStatus(status: string): void {
|
|
@@ -521,34 +523,34 @@ export class HeapSnapshotProgress {
|
|
|
521
523
|
|
|
522
524
|
reportProblem(error: string): void {
|
|
523
525
|
// May be undefined in tests.
|
|
524
|
-
if (this
|
|
525
|
-
this
|
|
526
|
+
if (this.#dispatcher) {
|
|
527
|
+
this.#dispatcher.sendEvent(HeapSnapshotModel.HeapSnapshotModel.HeapSnapshotProgressEvent.BrokenSnapshot, error);
|
|
526
528
|
}
|
|
527
529
|
}
|
|
528
530
|
|
|
529
531
|
private sendUpdateEvent(serializedText: string): void {
|
|
530
532
|
// May be undefined in tests.
|
|
531
|
-
if (this
|
|
532
|
-
this
|
|
533
|
+
if (this.#dispatcher) {
|
|
534
|
+
this.#dispatcher.sendEvent(HeapSnapshotModel.HeapSnapshotModel.HeapSnapshotProgressEvent.Update, serializedText);
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
537
|
}
|
|
536
538
|
|
|
537
539
|
export class HeapSnapshotProblemReport {
|
|
538
|
-
|
|
540
|
+
readonly #errors: string[];
|
|
539
541
|
constructor(title: string) {
|
|
540
|
-
this
|
|
542
|
+
this.#errors = [title];
|
|
541
543
|
}
|
|
542
544
|
|
|
543
545
|
addError(error: string): void {
|
|
544
|
-
if (this
|
|
546
|
+
if (this.#errors.length > 100) {
|
|
545
547
|
return;
|
|
546
548
|
}
|
|
547
|
-
this
|
|
549
|
+
this.#errors.push(error);
|
|
548
550
|
}
|
|
549
551
|
|
|
550
552
|
toString(): string {
|
|
551
|
-
return this
|
|
553
|
+
return this.#errors.join('\n ');
|
|
552
554
|
}
|
|
553
555
|
}
|
|
554
556
|
export interface Profile {
|
|
@@ -578,36 +580,36 @@ const enum DOMLinkState {
|
|
|
578
580
|
export abstract class HeapSnapshot {
|
|
579
581
|
nodes: Uint32Array;
|
|
580
582
|
containmentEdges: Uint32Array;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
583
|
+
readonly #metaNode: HeapSnapshotMetainfo;
|
|
584
|
+
readonly #rawSamples: number[];
|
|
585
|
+
#samples: HeapSnapshotModel.HeapSnapshotModel.Samples|null;
|
|
584
586
|
strings: string[];
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
587
|
+
readonly #locations: number[];
|
|
588
|
+
readonly #progress: HeapSnapshotProgress;
|
|
589
|
+
readonly #noDistance: number;
|
|
588
590
|
rootNodeIndexInternal: number;
|
|
589
|
-
|
|
591
|
+
#snapshotDiffs: {
|
|
590
592
|
[x: string]: {
|
|
591
593
|
[x: string]: HeapSnapshotModel.HeapSnapshotModel.Diff,
|
|
592
594
|
},
|
|
593
595
|
};
|
|
594
|
-
|
|
596
|
+
#aggregatesForDiffInternal!: {
|
|
595
597
|
[x: string]: HeapSnapshotModel.HeapSnapshotModel.AggregateForDiff,
|
|
596
598
|
};
|
|
597
|
-
|
|
599
|
+
#aggregates: {
|
|
598
600
|
[x: string]: {
|
|
599
601
|
[x: string]: AggregatedInfo,
|
|
600
602
|
},
|
|
601
603
|
};
|
|
602
|
-
|
|
604
|
+
#aggregatesSortedFlags: {
|
|
603
605
|
[x: string]: boolean,
|
|
604
606
|
};
|
|
605
|
-
|
|
607
|
+
#profile: Profile;
|
|
606
608
|
nodeTypeOffset!: number;
|
|
607
609
|
nodeNameOffset!: number;
|
|
608
610
|
nodeIdOffset!: number;
|
|
609
611
|
nodeSelfSizeOffset!: number;
|
|
610
|
-
|
|
612
|
+
#nodeEdgeCountOffset!: number;
|
|
611
613
|
nodeTraceNodeIdOffset!: number;
|
|
612
614
|
nodeFieldCount!: number;
|
|
613
615
|
nodeTypes!: string[];
|
|
@@ -630,25 +632,25 @@ export abstract class HeapSnapshot {
|
|
|
630
632
|
edgeShortcutType!: number;
|
|
631
633
|
edgeWeakType!: number;
|
|
632
634
|
edgeInvisibleType!: number;
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
635
|
+
#locationIndexOffset!: number;
|
|
636
|
+
#locationScriptIdOffset!: number;
|
|
637
|
+
#locationLineOffset!: number;
|
|
638
|
+
#locationColumnOffset!: number;
|
|
639
|
+
#locationFieldCount!: number;
|
|
638
640
|
nodeCount!: number;
|
|
639
|
-
|
|
641
|
+
#edgeCount!: number;
|
|
640
642
|
retainedSizes!: Float64Array;
|
|
641
643
|
firstEdgeIndexes!: Uint32Array;
|
|
642
644
|
retainingNodes!: Uint32Array;
|
|
643
645
|
retainingEdges!: Uint32Array;
|
|
644
646
|
firstRetainerIndex!: Uint32Array;
|
|
645
647
|
nodeDistances!: Int32Array;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
+
firstDominatedNodeIndex!: Uint32Array;
|
|
649
|
+
dominatedNodes!: Uint32Array;
|
|
648
650
|
dominatorsTree!: Uint32Array;
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
651
|
+
#allocationProfile!: AllocationProfile;
|
|
652
|
+
#nodeDetachednessOffset!: number;
|
|
653
|
+
#locationMap!: Map<number, HeapSnapshotModel.HeapSnapshotModel.Location>;
|
|
652
654
|
lazyStringCache!: {
|
|
653
655
|
[x: string]: string,
|
|
654
656
|
};
|
|
@@ -656,37 +658,37 @@ export abstract class HeapSnapshot {
|
|
|
656
658
|
constructor(profile: Profile, progress: HeapSnapshotProgress) {
|
|
657
659
|
this.nodes = profile.nodes;
|
|
658
660
|
this.containmentEdges = profile.edges;
|
|
659
|
-
this
|
|
660
|
-
this
|
|
661
|
-
this
|
|
661
|
+
this.#metaNode = profile.snapshot.meta;
|
|
662
|
+
this.#rawSamples = profile.samples;
|
|
663
|
+
this.#samples = null;
|
|
662
664
|
this.strings = profile.strings;
|
|
663
|
-
this
|
|
664
|
-
this
|
|
665
|
+
this.#locations = profile.locations;
|
|
666
|
+
this.#progress = progress;
|
|
665
667
|
|
|
666
|
-
this
|
|
668
|
+
this.#noDistance = -5;
|
|
667
669
|
this.rootNodeIndexInternal = 0;
|
|
668
670
|
if (profile.snapshot.root_index) {
|
|
669
671
|
this.rootNodeIndexInternal = profile.snapshot.root_index;
|
|
670
672
|
}
|
|
671
673
|
|
|
672
|
-
this
|
|
674
|
+
this.#snapshotDiffs = {};
|
|
673
675
|
|
|
674
|
-
this
|
|
676
|
+
this.#aggregates = {};
|
|
675
677
|
|
|
676
|
-
this
|
|
677
|
-
this
|
|
678
|
+
this.#aggregatesSortedFlags = {};
|
|
679
|
+
this.#profile = profile;
|
|
678
680
|
}
|
|
679
681
|
|
|
680
682
|
initialize(): void {
|
|
681
|
-
const meta = this
|
|
683
|
+
const meta = this.#metaNode;
|
|
682
684
|
|
|
683
685
|
this.nodeTypeOffset = meta.node_fields.indexOf('type');
|
|
684
686
|
this.nodeNameOffset = meta.node_fields.indexOf('name');
|
|
685
687
|
this.nodeIdOffset = meta.node_fields.indexOf('id');
|
|
686
688
|
this.nodeSelfSizeOffset = meta.node_fields.indexOf('self_size');
|
|
687
|
-
this
|
|
689
|
+
this.#nodeEdgeCountOffset = meta.node_fields.indexOf('edge_count');
|
|
688
690
|
this.nodeTraceNodeIdOffset = meta.node_fields.indexOf('trace_node_id');
|
|
689
|
-
this
|
|
691
|
+
this.#nodeDetachednessOffset = meta.node_fields.indexOf('detachedness');
|
|
690
692
|
this.nodeFieldCount = meta.node_fields.length;
|
|
691
693
|
|
|
692
694
|
this.nodeTypes = meta.node_types[this.nodeTypeOffset];
|
|
@@ -715,53 +717,53 @@ export abstract class HeapSnapshot {
|
|
|
715
717
|
|
|
716
718
|
const locationFields = meta.location_fields || [];
|
|
717
719
|
|
|
718
|
-
this
|
|
719
|
-
this
|
|
720
|
-
this
|
|
721
|
-
this
|
|
722
|
-
this
|
|
720
|
+
this.#locationIndexOffset = locationFields.indexOf('object_index');
|
|
721
|
+
this.#locationScriptIdOffset = locationFields.indexOf('script_id');
|
|
722
|
+
this.#locationLineOffset = locationFields.indexOf('line');
|
|
723
|
+
this.#locationColumnOffset = locationFields.indexOf('column');
|
|
724
|
+
this.#locationFieldCount = locationFields.length;
|
|
723
725
|
|
|
724
726
|
this.nodeCount = this.nodes.length / this.nodeFieldCount;
|
|
725
|
-
this
|
|
727
|
+
this.#edgeCount = this.containmentEdges.length / this.edgeFieldsCount;
|
|
726
728
|
|
|
727
729
|
this.retainedSizes = new Float64Array(this.nodeCount);
|
|
728
730
|
this.firstEdgeIndexes = new Uint32Array(this.nodeCount + 1);
|
|
729
|
-
this.retainingNodes = new Uint32Array(this
|
|
730
|
-
this.retainingEdges = new Uint32Array(this
|
|
731
|
+
this.retainingNodes = new Uint32Array(this.#edgeCount);
|
|
732
|
+
this.retainingEdges = new Uint32Array(this.#edgeCount);
|
|
731
733
|
this.firstRetainerIndex = new Uint32Array(this.nodeCount + 1);
|
|
732
734
|
this.nodeDistances = new Int32Array(this.nodeCount);
|
|
733
735
|
this.firstDominatedNodeIndex = new Uint32Array(this.nodeCount + 1);
|
|
734
736
|
this.dominatedNodes = new Uint32Array(this.nodeCount - 1);
|
|
735
737
|
|
|
736
|
-
this
|
|
738
|
+
this.#progress.updateStatus('Building edge indexes…');
|
|
737
739
|
this.buildEdgeIndexes();
|
|
738
|
-
this
|
|
740
|
+
this.#progress.updateStatus('Building retainers…');
|
|
739
741
|
this.buildRetainers();
|
|
740
|
-
this
|
|
742
|
+
this.#progress.updateStatus('Propagating DOM state…');
|
|
741
743
|
this.propagateDOMState();
|
|
742
|
-
this
|
|
744
|
+
this.#progress.updateStatus('Calculating node flags…');
|
|
743
745
|
this.calculateFlags();
|
|
744
|
-
this
|
|
746
|
+
this.#progress.updateStatus('Calculating distances…');
|
|
745
747
|
this.calculateDistances();
|
|
746
|
-
this
|
|
748
|
+
this.#progress.updateStatus('Building postorder index…');
|
|
747
749
|
const result = this.buildPostOrderIndex();
|
|
748
750
|
// Actually it is array that maps node ordinal number to dominator node ordinal number.
|
|
749
|
-
this
|
|
751
|
+
this.#progress.updateStatus('Building dominator tree…');
|
|
750
752
|
this.dominatorsTree = this.buildDominatorTree(result.postOrderIndex2NodeOrdinal, result.nodeOrdinal2PostOrderIndex);
|
|
751
|
-
this
|
|
753
|
+
this.#progress.updateStatus('Calculating retained sizes…');
|
|
752
754
|
this.calculateRetainedSizes(result.postOrderIndex2NodeOrdinal);
|
|
753
|
-
this
|
|
755
|
+
this.#progress.updateStatus('Building dominated nodes…');
|
|
754
756
|
this.buildDominatedNodes();
|
|
755
|
-
this
|
|
757
|
+
this.#progress.updateStatus('Calculating statistics…');
|
|
756
758
|
this.calculateStatistics();
|
|
757
|
-
this
|
|
759
|
+
this.#progress.updateStatus('Calculating samples…');
|
|
758
760
|
this.buildSamples();
|
|
759
|
-
this
|
|
761
|
+
this.#progress.updateStatus('Building locations…');
|
|
760
762
|
this.buildLocationMap();
|
|
761
|
-
this
|
|
763
|
+
this.#progress.updateStatus('Finished processing.');
|
|
762
764
|
|
|
763
|
-
if (this
|
|
764
|
-
this
|
|
765
|
+
if (this.#profile.snapshot.trace_function_count) {
|
|
766
|
+
this.#progress.updateStatus('Building allocation statistics…');
|
|
765
767
|
const nodes = this.nodes;
|
|
766
768
|
const nodesLength = nodes.length;
|
|
767
769
|
const nodeFieldCount = this.nodeFieldCount;
|
|
@@ -782,8 +784,8 @@ export abstract class HeapSnapshot {
|
|
|
782
784
|
stats.size += node.selfSize();
|
|
783
785
|
stats.ids.push(node.id());
|
|
784
786
|
}
|
|
785
|
-
this
|
|
786
|
-
this
|
|
787
|
+
this.#allocationProfile = new AllocationProfile(this.#profile, liveObjects);
|
|
788
|
+
this.#progress.updateStatus('done');
|
|
787
789
|
}
|
|
788
790
|
}
|
|
789
791
|
|
|
@@ -793,7 +795,7 @@ export abstract class HeapSnapshot {
|
|
|
793
795
|
const firstEdgeIndexes = this.firstEdgeIndexes;
|
|
794
796
|
const nodeFieldCount = this.nodeFieldCount;
|
|
795
797
|
const edgeFieldsCount = this.edgeFieldsCount;
|
|
796
|
-
const nodeEdgeCountOffset = this
|
|
798
|
+
const nodeEdgeCountOffset = this.#nodeEdgeCountOffset;
|
|
797
799
|
firstEdgeIndexes[nodeCount] = this.containmentEdges.length;
|
|
798
800
|
for (let nodeOrdinal = 0, edgeIndex = 0; nodeOrdinal < nodeCount; ++nodeOrdinal) {
|
|
799
801
|
firstEdgeIndexes[nodeOrdinal] = edgeIndex;
|
|
@@ -965,11 +967,11 @@ export abstract class HeapSnapshot {
|
|
|
965
967
|
|
|
966
968
|
private createAllocationStackFilter(bottomUpAllocationNodeId: number):
|
|
967
969
|
((arg0: HeapSnapshotNode) => boolean)|undefined {
|
|
968
|
-
if (!this
|
|
970
|
+
if (!this.#allocationProfile) {
|
|
969
971
|
throw new Error('No Allocation Profile provided');
|
|
970
972
|
}
|
|
971
973
|
|
|
972
|
-
const traceIds = this
|
|
974
|
+
const traceIds = this.#allocationProfile.traceIds(bottomUpAllocationNodeId);
|
|
973
975
|
if (!traceIds.length) {
|
|
974
976
|
return undefined;
|
|
975
977
|
}
|
|
@@ -989,20 +991,20 @@ export abstract class HeapSnapshot {
|
|
|
989
991
|
const aggregates = this.buildAggregates(filter);
|
|
990
992
|
|
|
991
993
|
let aggregatesByClassName;
|
|
992
|
-
if (key && this
|
|
993
|
-
aggregatesByClassName = this
|
|
994
|
+
if (key && this.#aggregates[key]) {
|
|
995
|
+
aggregatesByClassName = this.#aggregates[key];
|
|
994
996
|
} else {
|
|
995
997
|
this.calculateClassesRetainedSize(aggregates.aggregatesByClassIndex, filter);
|
|
996
998
|
aggregatesByClassName = aggregates.aggregatesByClassName;
|
|
997
999
|
if (key) {
|
|
998
|
-
this
|
|
1000
|
+
this.#aggregates[key] = aggregatesByClassName;
|
|
999
1001
|
}
|
|
1000
1002
|
}
|
|
1001
1003
|
|
|
1002
|
-
if (sortedIndexes && (!key || !this
|
|
1004
|
+
if (sortedIndexes && (!key || !this.#aggregatesSortedFlags[key])) {
|
|
1003
1005
|
this.sortAggregateIndexes(aggregates.aggregatesByClassName);
|
|
1004
1006
|
if (key) {
|
|
1005
|
-
this
|
|
1007
|
+
this.#aggregatesSortedFlags[key] = sortedIndexes;
|
|
1006
1008
|
}
|
|
1007
1009
|
}
|
|
1008
1010
|
|
|
@@ -1012,11 +1014,11 @@ export abstract class HeapSnapshot {
|
|
|
1012
1014
|
}
|
|
1013
1015
|
|
|
1014
1016
|
allocationTracesTops(): HeapSnapshotModel.HeapSnapshotModel.SerializedAllocationNode[] {
|
|
1015
|
-
return this
|
|
1017
|
+
return this.#allocationProfile.serializeTraceTops();
|
|
1016
1018
|
}
|
|
1017
1019
|
|
|
1018
1020
|
allocationNodeCallers(nodeId: number): HeapSnapshotModel.HeapSnapshotModel.AllocationNodeCallers {
|
|
1019
|
-
return this
|
|
1021
|
+
return this.#allocationProfile.serializeCallers(nodeId);
|
|
1020
1022
|
}
|
|
1021
1023
|
|
|
1022
1024
|
allocationStack(nodeIndex: number): HeapSnapshotModel.HeapSnapshotModel.AllocationStackFrame[]|null {
|
|
@@ -1025,16 +1027,16 @@ export abstract class HeapSnapshot {
|
|
|
1025
1027
|
if (!allocationNodeId) {
|
|
1026
1028
|
return null;
|
|
1027
1029
|
}
|
|
1028
|
-
return this
|
|
1030
|
+
return this.#allocationProfile.serializeAllocationStack(allocationNodeId);
|
|
1029
1031
|
}
|
|
1030
1032
|
|
|
1031
1033
|
aggregatesForDiff(): {[x: string]: HeapSnapshotModel.HeapSnapshotModel.AggregateForDiff} {
|
|
1032
|
-
if (this
|
|
1033
|
-
return this
|
|
1034
|
+
if (this.#aggregatesForDiffInternal) {
|
|
1035
|
+
return this.#aggregatesForDiffInternal;
|
|
1034
1036
|
}
|
|
1035
1037
|
|
|
1036
1038
|
const aggregatesByClassName = this.getAggregatesByClassName(true, 'allObjects');
|
|
1037
|
-
this
|
|
1039
|
+
this.#aggregatesForDiffInternal = {};
|
|
1038
1040
|
|
|
1039
1041
|
const node = this.createNode();
|
|
1040
1042
|
for (const className in aggregatesByClassName) {
|
|
@@ -1048,9 +1050,9 @@ export abstract class HeapSnapshot {
|
|
|
1048
1050
|
selfSizes[i] = node.selfSize();
|
|
1049
1051
|
}
|
|
1050
1052
|
|
|
1051
|
-
this
|
|
1053
|
+
this.#aggregatesForDiffInternal[className] = {indexes: indexes, ids: ids, selfSizes: selfSizes};
|
|
1052
1054
|
}
|
|
1053
|
-
return this
|
|
1055
|
+
return this.#aggregatesForDiffInternal;
|
|
1054
1056
|
}
|
|
1055
1057
|
|
|
1056
1058
|
isUserRoot(_node: HeapSnapshotNode): boolean {
|
|
@@ -1060,7 +1062,7 @@ export abstract class HeapSnapshot {
|
|
|
1060
1062
|
calculateDistances(filter?: ((arg0: HeapSnapshotNode, arg1: HeapSnapshotEdge) => boolean)): void {
|
|
1061
1063
|
const nodeCount = this.nodeCount;
|
|
1062
1064
|
const distances = this.nodeDistances;
|
|
1063
|
-
const noDistance = this
|
|
1065
|
+
const noDistance = this.#noDistance;
|
|
1064
1066
|
for (let i = 0; i < nodeCount; ++i) {
|
|
1065
1067
|
distances[i] = noDistance;
|
|
1066
1068
|
}
|
|
@@ -1098,7 +1100,7 @@ export abstract class HeapSnapshot {
|
|
|
1098
1100
|
const edgeTypeOffset = this.edgeTypeOffset;
|
|
1099
1101
|
const nodeCount = this.nodeCount;
|
|
1100
1102
|
const edgeWeakType = this.edgeWeakType;
|
|
1101
|
-
const noDistance = this
|
|
1103
|
+
const noDistance = this.#noDistance;
|
|
1102
1104
|
|
|
1103
1105
|
let index = 0;
|
|
1104
1106
|
const edge = this.createEdge(0);
|
|
@@ -1652,7 +1654,7 @@ export abstract class HeapSnapshot {
|
|
|
1652
1654
|
* "Detached <Name>".
|
|
1653
1655
|
*/
|
|
1654
1656
|
private propagateDOMState(): void {
|
|
1655
|
-
if (this
|
|
1657
|
+
if (this.#nodeDetachednessOffset === -1) {
|
|
1656
1658
|
return;
|
|
1657
1659
|
}
|
|
1658
1660
|
|
|
@@ -1697,7 +1699,7 @@ export abstract class HeapSnapshot {
|
|
|
1697
1699
|
return;
|
|
1698
1700
|
}
|
|
1699
1701
|
|
|
1700
|
-
snapshot.nodes[nodeIndex + snapshot
|
|
1702
|
+
snapshot.nodes[nodeIndex + snapshot.#nodeDetachednessOffset] = newState;
|
|
1701
1703
|
|
|
1702
1704
|
if (newState === DOMLinkState.Attached) {
|
|
1703
1705
|
attached.push(nodeOrdinal);
|
|
@@ -1722,7 +1724,7 @@ export abstract class HeapSnapshot {
|
|
|
1722
1724
|
// through processing to have their name adjusted and them enqueued in
|
|
1723
1725
|
// the respective queues.
|
|
1724
1726
|
for (let nodeOrdinal = 0; nodeOrdinal < this.nodeCount; ++nodeOrdinal) {
|
|
1725
|
-
const state = this.nodes[nodeOrdinal * this.nodeFieldCount + this
|
|
1727
|
+
const state = this.nodes[nodeOrdinal * this.nodeFieldCount + this.#nodeDetachednessOffset];
|
|
1726
1728
|
// Bail out for objects that have no known state. For all other objects set that state.
|
|
1727
1729
|
if (state === DOMLinkState.Unknown) {
|
|
1728
1730
|
continue;
|
|
@@ -1737,7 +1739,7 @@ export abstract class HeapSnapshot {
|
|
|
1737
1739
|
// 3. If the parent is not attached, then the child inherits the parent's state.
|
|
1738
1740
|
while (detached.length !== 0) {
|
|
1739
1741
|
const nodeOrdinal = (detached.pop() as number);
|
|
1740
|
-
const nodeState = this.nodes[nodeOrdinal * this.nodeFieldCount + this
|
|
1742
|
+
const nodeState = this.nodes[nodeOrdinal * this.nodeFieldCount + this.#nodeDetachednessOffset];
|
|
1741
1743
|
// Ignore if the node has been found through propagating forward attached state.
|
|
1742
1744
|
if (nodeState === DOMLinkState.Attached) {
|
|
1743
1745
|
continue;
|
|
@@ -1749,7 +1751,7 @@ export abstract class HeapSnapshot {
|
|
|
1749
1751
|
}
|
|
1750
1752
|
|
|
1751
1753
|
private buildSamples(): void {
|
|
1752
|
-
const samples = this
|
|
1754
|
+
const samples = this.#rawSamples;
|
|
1753
1755
|
if (!samples || !samples.length) {
|
|
1754
1756
|
return;
|
|
1755
1757
|
}
|
|
@@ -1758,8 +1760,8 @@ export abstract class HeapSnapshot {
|
|
|
1758
1760
|
const timestamps = new Array(sampleCount);
|
|
1759
1761
|
const lastAssignedIds = new Array(sampleCount);
|
|
1760
1762
|
|
|
1761
|
-
const timestampOffset = this
|
|
1762
|
-
const lastAssignedIdOffset = this
|
|
1763
|
+
const timestampOffset = this.#metaNode.sample_fields.indexOf('timestamp_us');
|
|
1764
|
+
const lastAssignedIdOffset = this.#metaNode.sample_fields.indexOf('last_assigned_id');
|
|
1763
1765
|
for (let i = 0; i < sampleCount; i++) {
|
|
1764
1766
|
sizeForRange[i] = 0;
|
|
1765
1767
|
timestamps[i] = (samples[2 * i + timestampOffset]) / 1000;
|
|
@@ -1786,30 +1788,30 @@ export abstract class HeapSnapshot {
|
|
|
1786
1788
|
}
|
|
1787
1789
|
sizeForRange[rangeIndex] += node.selfSize();
|
|
1788
1790
|
}
|
|
1789
|
-
this
|
|
1791
|
+
this.#samples = new HeapSnapshotModel.HeapSnapshotModel.Samples(timestamps, lastAssignedIds, sizeForRange);
|
|
1790
1792
|
}
|
|
1791
1793
|
|
|
1792
1794
|
private buildLocationMap(): void {
|
|
1793
1795
|
const map = new Map<number, HeapSnapshotModel.HeapSnapshotModel.Location>();
|
|
1794
|
-
const locations = this
|
|
1796
|
+
const locations = this.#locations;
|
|
1795
1797
|
|
|
1796
|
-
for (let i = 0; i < locations.length; i += this
|
|
1797
|
-
const nodeIndex = locations[i + this
|
|
1798
|
-
const scriptId = locations[i + this
|
|
1799
|
-
const line = locations[i + this
|
|
1800
|
-
const col = locations[i + this
|
|
1798
|
+
for (let i = 0; i < locations.length; i += this.#locationFieldCount) {
|
|
1799
|
+
const nodeIndex = locations[i + this.#locationIndexOffset];
|
|
1800
|
+
const scriptId = locations[i + this.#locationScriptIdOffset];
|
|
1801
|
+
const line = locations[i + this.#locationLineOffset];
|
|
1802
|
+
const col = locations[i + this.#locationColumnOffset];
|
|
1801
1803
|
map.set(nodeIndex, new HeapSnapshotModel.HeapSnapshotModel.Location(scriptId, line, col));
|
|
1802
1804
|
}
|
|
1803
1805
|
|
|
1804
|
-
this
|
|
1806
|
+
this.#locationMap = map;
|
|
1805
1807
|
}
|
|
1806
1808
|
|
|
1807
1809
|
getLocation(nodeIndex: number): HeapSnapshotModel.HeapSnapshotModel.Location|null {
|
|
1808
|
-
return this
|
|
1810
|
+
return this.#locationMap.get(nodeIndex) || null;
|
|
1809
1811
|
}
|
|
1810
1812
|
|
|
1811
1813
|
getSamples(): HeapSnapshotModel.HeapSnapshotModel.Samples|null {
|
|
1812
|
-
return this
|
|
1814
|
+
return this.#samples;
|
|
1813
1815
|
}
|
|
1814
1816
|
|
|
1815
1817
|
calculateFlags(): void {
|
|
@@ -1830,7 +1832,7 @@ export abstract class HeapSnapshot {
|
|
|
1830
1832
|
{[x: string]: HeapSnapshotModel.HeapSnapshotModel.Diff} {
|
|
1831
1833
|
let snapshotDiff: {[x: string]: HeapSnapshotModel.HeapSnapshotModel.Diff}|{
|
|
1832
1834
|
[x: string]: HeapSnapshotModel.HeapSnapshotModel.Diff,
|
|
1833
|
-
} = this
|
|
1835
|
+
} = this.#snapshotDiffs[baseSnapshotId];
|
|
1834
1836
|
if (snapshotDiff) {
|
|
1835
1837
|
return snapshotDiff;
|
|
1836
1838
|
}
|
|
@@ -1857,7 +1859,7 @@ export abstract class HeapSnapshot {
|
|
|
1857
1859
|
}
|
|
1858
1860
|
}
|
|
1859
1861
|
|
|
1860
|
-
this
|
|
1862
|
+
this.#snapshotDiffs[baseSnapshotId] = snapshotDiff;
|
|
1861
1863
|
return snapshotDiff;
|
|
1862
1864
|
}
|
|
1863
1865
|
|
|
@@ -1973,7 +1975,7 @@ export abstract class HeapSnapshot {
|
|
|
1973
1975
|
}
|
|
1974
1976
|
|
|
1975
1977
|
createAddedNodesProvider(baseSnapshotId: string, className: string): HeapSnapshotNodesProvider {
|
|
1976
|
-
const snapshotDiff = this
|
|
1978
|
+
const snapshotDiff = this.#snapshotDiffs[baseSnapshotId];
|
|
1977
1979
|
const diffForClass = snapshotDiff[className];
|
|
1978
1980
|
return new HeapSnapshotNodesProvider(this, diffForClass.addedIndexes);
|
|
1979
1981
|
}
|
|
@@ -2043,20 +2045,20 @@ export class HeapSnapshotHeader {
|
|
|
2043
2045
|
|
|
2044
2046
|
export abstract class HeapSnapshotItemProvider {
|
|
2045
2047
|
protected readonly iterator: HeapSnapshotItemIterator;
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
+
readonly #indexProvider: HeapSnapshotItemIndexProvider;
|
|
2049
|
+
readonly #isEmptyInternal: boolean;
|
|
2048
2050
|
protected iterationOrder: number[]|null;
|
|
2049
2051
|
protected currentComparator: HeapSnapshotModel.HeapSnapshotModel.ComparatorConfig|null;
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
+
#sortedPrefixLength: number;
|
|
2053
|
+
#sortedSuffixLength: number;
|
|
2052
2054
|
constructor(iterator: HeapSnapshotItemIterator, indexProvider: HeapSnapshotItemIndexProvider) {
|
|
2053
2055
|
this.iterator = iterator;
|
|
2054
|
-
this
|
|
2055
|
-
this
|
|
2056
|
+
this.#indexProvider = indexProvider;
|
|
2057
|
+
this.#isEmptyInternal = !iterator.hasNext();
|
|
2056
2058
|
this.iterationOrder = null;
|
|
2057
2059
|
this.currentComparator = null;
|
|
2058
|
-
this
|
|
2059
|
-
this
|
|
2060
|
+
this.#sortedPrefixLength = 0;
|
|
2061
|
+
this.#sortedSuffixLength = 0;
|
|
2060
2062
|
}
|
|
2061
2063
|
|
|
2062
2064
|
protected createIterationOrder(): void {
|
|
@@ -2070,7 +2072,7 @@ export abstract class HeapSnapshotItemProvider {
|
|
|
2070
2072
|
}
|
|
2071
2073
|
|
|
2072
2074
|
isEmpty(): boolean {
|
|
2073
|
-
return this
|
|
2075
|
+
return this.#isEmptyInternal;
|
|
2074
2076
|
}
|
|
2075
2077
|
|
|
2076
2078
|
serializeItemsRange(begin: number, end: number): HeapSnapshotModel.HeapSnapshotModel.ItemsRange {
|
|
@@ -2086,17 +2088,17 @@ export abstract class HeapSnapshotItemProvider {
|
|
|
2086
2088
|
if (end > this.iterationOrder.length) {
|
|
2087
2089
|
end = this.iterationOrder.length;
|
|
2088
2090
|
}
|
|
2089
|
-
if (this
|
|
2091
|
+
if (this.#sortedPrefixLength < end && begin < this.iterationOrder.length - this.#sortedSuffixLength &&
|
|
2090
2092
|
this.currentComparator) {
|
|
2091
2093
|
const currentComparator = this.currentComparator;
|
|
2092
2094
|
this.sort(
|
|
2093
|
-
currentComparator, this
|
|
2095
|
+
currentComparator, this.#sortedPrefixLength, this.iterationOrder.length - 1 - this.#sortedSuffixLength, begin,
|
|
2094
2096
|
end - 1);
|
|
2095
|
-
if (begin <= this
|
|
2096
|
-
this
|
|
2097
|
+
if (begin <= this.#sortedPrefixLength) {
|
|
2098
|
+
this.#sortedPrefixLength = end;
|
|
2097
2099
|
}
|
|
2098
|
-
if (end >= this.iterationOrder.length - this
|
|
2099
|
-
this
|
|
2100
|
+
if (end >= this.iterationOrder.length - this.#sortedSuffixLength) {
|
|
2101
|
+
this.#sortedSuffixLength = this.iterationOrder.length - begin;
|
|
2100
2102
|
}
|
|
2101
2103
|
}
|
|
2102
2104
|
let position = begin;
|
|
@@ -2104,7 +2106,7 @@ export abstract class HeapSnapshotItemProvider {
|
|
|
2104
2106
|
const result = new Array(count);
|
|
2105
2107
|
for (let i = 0; i < count; ++i) {
|
|
2106
2108
|
const itemIndex = this.iterationOrder[position++];
|
|
2107
|
-
const item = this
|
|
2109
|
+
const item = this.#indexProvider.itemForIndex(itemIndex);
|
|
2108
2110
|
result[i] = item.serialize();
|
|
2109
2111
|
}
|
|
2110
2112
|
return new HeapSnapshotModel.HeapSnapshotModel.ItemsRange(begin, end, this.iterationOrder.length, result);
|
|
@@ -2112,8 +2114,8 @@ export abstract class HeapSnapshotItemProvider {
|
|
|
2112
2114
|
|
|
2113
2115
|
sortAndRewind(comparator: HeapSnapshotModel.HeapSnapshotModel.ComparatorConfig): void {
|
|
2114
2116
|
this.currentComparator = comparator;
|
|
2115
|
-
this
|
|
2116
|
-
this
|
|
2117
|
+
this.#sortedPrefixLength = 0;
|
|
2118
|
+
this.#sortedSuffixLength = 0;
|
|
2117
2119
|
}
|
|
2118
2120
|
|
|
2119
2121
|
abstract sort(
|
|
@@ -2280,9 +2282,7 @@ export class HeapSnapshotNodesProvider extends HeapSnapshotItemProvider {
|
|
|
2280
2282
|
const ascending1 = comparator.ascending1 ? 1 : -1;
|
|
2281
2283
|
const ascending2 = comparator.ascending2 ? 1 : -1;
|
|
2282
2284
|
|
|
2283
|
-
|
|
2284
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2285
|
-
function sortByNodeField(fieldAccessor: () => any, ascending: number): number {
|
|
2285
|
+
function sortByNodeField(fieldAccessor: () => void, ascending: number): number {
|
|
2286
2286
|
const valueA = fieldAccessor.call(nodeA);
|
|
2287
2287
|
const valueB = fieldAccessor.call(nodeB);
|
|
2288
2288
|
return valueA < valueB ? -ascending : (valueA > valueB ? ascending : 0);
|
|
@@ -2323,7 +2323,7 @@ export class JSHeapSnapshot extends HeapSnapshot {
|
|
|
2323
2323
|
};
|
|
2324
2324
|
lazyStringCache: {};
|
|
2325
2325
|
private flags!: Uint32Array;
|
|
2326
|
-
|
|
2326
|
+
#statistics?: HeapSnapshotModel.HeapSnapshotModel.Statistics;
|
|
2327
2327
|
constructor(profile: Profile, progress: HeapSnapshotProgress) {
|
|
2328
2328
|
super(profile, progress);
|
|
2329
2329
|
this.nodeFlags = {
|
|
@@ -2575,14 +2575,14 @@ export class JSHeapSnapshot extends HeapSnapshot {
|
|
|
2575
2575
|
sizeJSArrays += this.calculateArraySize(node);
|
|
2576
2576
|
}
|
|
2577
2577
|
}
|
|
2578
|
-
this
|
|
2579
|
-
this
|
|
2580
|
-
this
|
|
2581
|
-
this
|
|
2582
|
-
this
|
|
2583
|
-
this
|
|
2584
|
-
this
|
|
2585
|
-
this
|
|
2578
|
+
this.#statistics = new HeapSnapshotModel.HeapSnapshotModel.Statistics();
|
|
2579
|
+
this.#statistics.total = this.totalSize;
|
|
2580
|
+
this.#statistics.v8heap = this.totalSize - sizeNative;
|
|
2581
|
+
this.#statistics.native = sizeNative;
|
|
2582
|
+
this.#statistics.code = sizeCode;
|
|
2583
|
+
this.#statistics.jsArrays = sizeJSArrays;
|
|
2584
|
+
this.#statistics.strings = sizeStrings;
|
|
2585
|
+
this.#statistics.system = sizeSystem;
|
|
2586
2586
|
}
|
|
2587
2587
|
|
|
2588
2588
|
private calculateArraySize(node: HeapSnapshotNode): number {
|
|
@@ -2616,7 +2616,7 @@ export class JSHeapSnapshot extends HeapSnapshot {
|
|
|
2616
2616
|
}
|
|
2617
2617
|
|
|
2618
2618
|
getStatistics(): HeapSnapshotModel.HeapSnapshotModel.Statistics {
|
|
2619
|
-
return this
|
|
2619
|
+
return this.#statistics as HeapSnapshotModel.HeapSnapshotModel.Statistics;
|
|
2620
2620
|
}
|
|
2621
2621
|
}
|
|
2622
2622
|
|