chrome-devtools-frontend 1.0.1153166 → 1.0.1155899
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 -2
- package/front_end/core/common/Revealer.ts +1 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/host/UserMetrics.ts +32 -12
- package/front_end/core/platform/array-utilities.ts +25 -9
- package/front_end/core/sdk/ChildTargetManager.ts +2 -1
- package/front_end/core/sdk/FilmStripModel.ts +35 -25
- package/front_end/devtools_compatibility.js +2 -0
- package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +8 -2
- package/front_end/entrypoints/worker_app/worker_app.ts +0 -1
- package/front_end/generated/InspectorBackendCommands.js +2 -1
- package/front_end/generated/protocol.ts +36 -0
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +90 -73
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +31 -61
- package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +69 -0
- package/front_end/models/issues_manager/descriptions/stylesheetLateImport.md +4 -0
- package/front_end/models/issues_manager/descriptions/stylesheetRequestFailed.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +4 -0
- package/front_end/models/trace/ModelImpl.ts +1 -0
- package/front_end/models/trace/README.md +73 -17
- package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +1 -1
- package/front_end/models/trace/handlers/RendererHandler.ts +33 -143
- package/front_end/models/trace/handlers/UserTimings.md +1 -1
- package/front_end/models/trace/types/TraceEvents.ts +3 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -6
- package/front_end/panels/application/PreloadingTreeElement.ts +25 -7
- package/front_end/panels/application/preloading/PreloadingView.ts +64 -31
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +19 -9
- package/front_end/panels/console/ConsoleViewMessage.ts +14 -2
- package/front_end/panels/elements/ElementsPanel.ts +2 -3
- package/front_end/panels/elements/components/LayoutPane.ts +256 -60
- package/front_end/panels/elements/elements-legacy.ts +0 -3
- package/front_end/panels/elements/elements-meta.ts +10 -2
- package/front_end/panels/elements/elements.ts +0 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +8 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -1
- package/front_end/panels/network/NetworkPanel.ts +12 -1
- package/front_end/panels/recorder/components/ExtensionView.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +7 -4
- package/front_end/panels/sources/SourcesPanel.ts +1 -1
- package/front_end/panels/sources/components/BreakpointsView.ts +406 -89
- package/front_end/panels/sources/sources-meta.ts +13 -4
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +106 -95
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +5 -0
- package/front_end/panels/timeline/TimelinePanel.ts +8 -8
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/.eslintrc.js +18 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +5 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +10 -0
- package/package.json +1 -1
- package/scripts/build/generate_deprecations.py +3 -0
- package/front_end/panels/elements/LayoutSidebarPane.ts +0 -249
- package/front_end/panels/sources/BreakpointsSidebarPane.ts +0 -480
- package/front_end/ui/components/docs/layout_pane/basic.html +0 -25
- package/front_end/ui/components/docs/layout_pane/basic.ts +0 -78
@@ -14,6 +14,7 @@ import * as QuickOpen from '../../ui/legacy/components/quick_open/quick_open.js'
|
|
14
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
15
15
|
|
16
16
|
import type * as Sources from './sources.js';
|
17
|
+
import type * as SourcesComponents from './components/components.js';
|
17
18
|
|
18
19
|
const UIStrings = {
|
19
20
|
/**
|
@@ -412,6 +413,7 @@ const UIStrings = {
|
|
412
413
|
const str_ = i18n.i18n.registerUIStrings('panels/sources/sources-meta.ts', UIStrings);
|
413
414
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
414
415
|
let loadedSourcesModule: (typeof Sources|undefined);
|
416
|
+
let loadedSourcesComponentsModule: (typeof SourcesComponents|undefined);
|
415
417
|
|
416
418
|
async function loadSourcesModule(): Promise<typeof Sources> {
|
417
419
|
if (!loadedSourcesModule) {
|
@@ -420,6 +422,13 @@ async function loadSourcesModule(): Promise<typeof Sources> {
|
|
420
422
|
return loadedSourcesModule;
|
421
423
|
}
|
422
424
|
|
425
|
+
async function loadSourcesComponentsModule(): Promise<typeof SourcesComponents> {
|
426
|
+
if (!loadedSourcesComponentsModule) {
|
427
|
+
loadedSourcesComponentsModule = await import('./components/components.js');
|
428
|
+
}
|
429
|
+
return loadedSourcesComponentsModule;
|
430
|
+
}
|
431
|
+
|
423
432
|
function maybeRetrieveContextTypes<T = unknown>(getClassCallBack: (sourcesModule: typeof Sources) => T[]): T[] {
|
424
433
|
if (loadedSourcesModule === undefined) {
|
425
434
|
return [];
|
@@ -532,8 +541,8 @@ UI.ViewManager.registerViewExtension({
|
|
532
541
|
title: i18nLazyString(UIStrings.breakpoints),
|
533
542
|
persistence: UI.ViewManager.ViewPersistence.PERMANENT,
|
534
543
|
async loadView() {
|
535
|
-
const
|
536
|
-
return
|
544
|
+
const SourcesComponents = await loadSourcesComponentsModule();
|
545
|
+
return SourcesComponents.BreakpointsView.BreakpointsView.instance().wrapper as UI.Widget.Widget;
|
537
546
|
},
|
538
547
|
});
|
539
548
|
|
@@ -1858,8 +1867,8 @@ UI.Context.registerListener({
|
|
1858
1867
|
return [SDK.DebuggerModel.DebuggerPausedDetails];
|
1859
1868
|
},
|
1860
1869
|
async loadListener() {
|
1861
|
-
const
|
1862
|
-
return
|
1870
|
+
const SourcesComponents = await loadSourcesComponentsModule();
|
1871
|
+
return SourcesComponents.BreakpointsView.BreakpointsSidebarController.instance();
|
1863
1872
|
},
|
1864
1873
|
});
|
1865
1874
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
import * as AddSourceMapURLDialog from './AddSourceMapURLDialog.js';
|
6
6
|
import * as BreakpointEditDialog from './BreakpointEditDialog.js';
|
7
|
-
import * as BreakpointsSidebarPane from './BreakpointsSidebarPane.js';
|
8
7
|
import * as CallStackSidebarPane from './CallStackSidebarPane.js';
|
9
8
|
import * as CoveragePlugin from './CoveragePlugin.js';
|
10
9
|
import * as CSSPlugin from './CSSPlugin.js';
|
@@ -35,7 +34,6 @@ import * as WatchExpressionsSidebarPane from './WatchExpressionsSidebarPane.js';
|
|
35
34
|
export {
|
36
35
|
AddSourceMapURLDialog,
|
37
36
|
BreakpointEditDialog,
|
38
|
-
BreakpointsSidebarPane,
|
39
37
|
CallStackSidebarPane,
|
40
38
|
CoveragePlugin,
|
41
39
|
CSSPlugin,
|
@@ -145,7 +145,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
|
|
145
145
|
private currentLevel: number;
|
146
146
|
|
147
147
|
// The Performance and the Timeline models are expected to be
|
148
|
-
//
|
148
|
+
// deprecated in favor of using traceEngineData (new RPP engine) only
|
149
149
|
// as part of the work in crbug.com/1386091. For this reason they
|
150
150
|
// have the "legacy" prefix on their name.
|
151
151
|
private legacyPerformanceModel: PerformanceModel|null;
|
@@ -10,6 +10,7 @@ import timelineFlamechartPopoverStyles from './timelineFlamechartPopover.css.js'
|
|
10
10
|
|
11
11
|
import type * as TimelineModel from '../../models/timeline_model/timeline_model.js';
|
12
12
|
import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
|
13
|
+
import type * as TraceEngine from '../../models/trace/trace.js';
|
13
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
14
15
|
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
15
16
|
import * as Protocol from '../../generated/protocol.js';
|
@@ -29,8 +30,8 @@ const UIStrings = {
|
|
29
30
|
const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelineFlameChartNetworkDataProvider.ts', UIStrings);
|
30
31
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
31
32
|
export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.FlameChartDataProvider {
|
32
|
-
|
33
|
-
|
33
|
+
readonly #font: string;
|
34
|
+
readonly #style: {
|
34
35
|
padding: number,
|
35
36
|
height: number,
|
36
37
|
collapsible: boolean,
|
@@ -42,98 +43,107 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
42
43
|
useDecoratorsForOverview: boolean,
|
43
44
|
shareHeaderLine: boolean,
|
44
45
|
};
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
#group: PerfUI.FlameChart.Group;
|
47
|
+
#minimumBoundaryInternal: number;
|
48
|
+
#maximumBoundary: number;
|
49
|
+
#timeSpan: number;
|
50
|
+
#requests: TimelineModel.TimelineModel.NetworkRequest[];
|
51
|
+
#maxLevel: number;
|
52
|
+
#legacyTimelineModel?: TimelineModel.TimelineModel.TimelineModelImpl|null;
|
52
53
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
53
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
#timelineDataInternal?: any;
|
56
|
+
#startTime?: number;
|
57
|
+
#endTime?: number;
|
58
|
+
#lastSelection?: Selection;
|
59
|
+
#priorityToValue?: Map<string, number>;
|
60
|
+
// Ignored during the migration to new trace data engine.
|
61
|
+
/* eslint-disable-next-line no-unused-private-class-members */
|
62
|
+
#traceEngineData: TraceEngine.TraceModel.PartialTraceParseDataDuringMigration|null;
|
59
63
|
constructor() {
|
60
|
-
this
|
61
|
-
this
|
62
|
-
this.style = {
|
64
|
+
this.#font = `${PerfUI.Font.DEFAULT_FONT_SIZE} ${PerfUI.Font.getFontFamilyForCanvas()}`;
|
65
|
+
this.#style = {
|
63
66
|
padding: 4,
|
64
67
|
height: 17,
|
65
68
|
collapsible: true,
|
66
69
|
color: ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary'),
|
67
|
-
font: this
|
70
|
+
font: this.#font,
|
68
71
|
backgroundColor: ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background'),
|
69
72
|
nestingLevel: 0,
|
70
73
|
useFirstLineForOverview: false,
|
71
74
|
useDecoratorsForOverview: true,
|
72
75
|
shareHeaderLine: false,
|
73
76
|
};
|
74
|
-
this
|
75
|
-
({startLevel: 0, name: i18nString(UIStrings.network), expanded: false, style: this
|
77
|
+
this.#group =
|
78
|
+
({startLevel: 0, name: i18nString(UIStrings.network), expanded: false, style: this.#style} as
|
76
79
|
PerfUI.FlameChart.Group);
|
77
|
-
this
|
78
|
-
this
|
79
|
-
this
|
80
|
-
this
|
81
|
-
this
|
80
|
+
this.#minimumBoundaryInternal = 0;
|
81
|
+
this.#maximumBoundary = 0;
|
82
|
+
this.#timeSpan = 0;
|
83
|
+
this.#requests = [];
|
84
|
+
this.#maxLevel = 0;
|
85
|
+
|
86
|
+
this.#legacyTimelineModel = null;
|
87
|
+
this.#traceEngineData = null;
|
82
88
|
|
83
89
|
// In the event of a theme change, these colors must be recalculated.
|
84
90
|
ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
|
85
|
-
this
|
86
|
-
this
|
91
|
+
this.#style.color = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
|
92
|
+
this.#style.backgroundColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
|
87
93
|
});
|
88
94
|
}
|
89
95
|
|
90
|
-
setModel(
|
91
|
-
|
92
|
-
|
96
|
+
setModel(
|
97
|
+
performanceModel: PerformanceModel|null,
|
98
|
+
traceEngineData: TraceEngine.TraceModel.PartialTraceParseDataDuringMigration|null): void {
|
99
|
+
this.#timelineDataInternal = null;
|
100
|
+
|
101
|
+
this.#legacyTimelineModel = performanceModel && performanceModel.timelineModel();
|
102
|
+
this.#traceEngineData = traceEngineData;
|
93
103
|
}
|
94
104
|
|
95
105
|
isEmpty(): boolean {
|
96
106
|
this.timelineData();
|
97
|
-
return !this
|
107
|
+
return !this.#requests.length;
|
98
108
|
}
|
99
109
|
|
100
110
|
maxStackDepth(): number {
|
101
|
-
return this
|
111
|
+
return this.#maxLevel;
|
102
112
|
}
|
103
113
|
|
104
114
|
timelineData(): PerfUI.FlameChart.FlameChartTimelineData {
|
105
|
-
if (this
|
106
|
-
return this
|
115
|
+
if (this.#timelineDataInternal) {
|
116
|
+
return this.#timelineDataInternal;
|
107
117
|
}
|
108
|
-
this
|
109
|
-
this
|
110
|
-
if (this
|
111
|
-
this
|
118
|
+
this.#requests = [];
|
119
|
+
this.#timelineDataInternal = PerfUI.FlameChart.FlameChartTimelineData.createEmpty();
|
120
|
+
if (this.#legacyTimelineModel) {
|
121
|
+
this.#appendTimelineData();
|
112
122
|
}
|
113
|
-
return this
|
123
|
+
return this.#timelineDataInternal;
|
114
124
|
}
|
115
125
|
|
116
126
|
minimumBoundary(): number {
|
117
|
-
return this
|
127
|
+
return this.#minimumBoundaryInternal;
|
118
128
|
}
|
119
129
|
|
120
130
|
totalTime(): number {
|
121
|
-
return this
|
131
|
+
return this.#timeSpan;
|
122
132
|
}
|
123
133
|
|
124
134
|
setWindowTimes(startTime: number, endTime: number): void {
|
125
|
-
this
|
126
|
-
this
|
127
|
-
this
|
135
|
+
this.#startTime = startTime;
|
136
|
+
this.#endTime = endTime;
|
137
|
+
this.#updateTimelineData();
|
128
138
|
}
|
129
139
|
|
130
140
|
createSelection(index: number): TimelineSelection|null {
|
131
141
|
if (index === -1) {
|
132
142
|
return null;
|
133
143
|
}
|
134
|
-
const request = this
|
135
|
-
this
|
136
|
-
return this
|
144
|
+
const request = this.#requests[index];
|
145
|
+
this.#lastSelection = new Selection(TimelineSelection.fromNetworkRequest(request), index);
|
146
|
+
return this.#lastSelection.timelineSelection;
|
137
147
|
}
|
138
148
|
|
139
149
|
entryIndexForSelection(selection: TimelineSelection|null): number {
|
@@ -141,22 +151,22 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
141
151
|
return -1;
|
142
152
|
}
|
143
153
|
|
144
|
-
if (this
|
145
|
-
return this
|
154
|
+
if (this.#lastSelection && this.#lastSelection.timelineSelection.object === selection.object) {
|
155
|
+
return this.#lastSelection.entryIndex;
|
146
156
|
}
|
147
157
|
|
148
158
|
if (!TimelineSelection.isNetworkRequestSelection(selection.object)) {
|
149
159
|
return -1;
|
150
160
|
}
|
151
|
-
const index = this
|
161
|
+
const index = this.#requests.indexOf(selection.object);
|
152
162
|
if (index !== -1) {
|
153
|
-
this
|
163
|
+
this.#lastSelection = new Selection(TimelineSelection.fromNetworkRequest(selection.object), index);
|
154
164
|
}
|
155
165
|
return index;
|
156
166
|
}
|
157
167
|
|
158
168
|
entryColor(index: number): string {
|
159
|
-
const request = (this
|
169
|
+
const request = (this.#requests[index] as TimelineModel.TimelineModel.NetworkRequest);
|
160
170
|
const category = TimelineUIUtils.networkRequestCategory(request);
|
161
171
|
return TimelineUIUtils.networkCategoryColor(category);
|
162
172
|
}
|
@@ -166,19 +176,19 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
166
176
|
}
|
167
177
|
|
168
178
|
entryTitle(index: number): string|null {
|
169
|
-
const request = (this
|
179
|
+
const request = (this.#requests[index] as TimelineModel.TimelineModel.NetworkRequest);
|
170
180
|
const parsedURL = new Common.ParsedURL.ParsedURL(request.url || '');
|
171
181
|
return parsedURL.isValid ? `${parsedURL.displayName} (${parsedURL.host})` : request.url || null;
|
172
182
|
}
|
173
183
|
|
174
184
|
entryFont(_index: number): string|null {
|
175
|
-
return this
|
185
|
+
return this.#font;
|
176
186
|
}
|
177
187
|
|
178
188
|
decorateEntry(
|
179
189
|
index: number, context: CanvasRenderingContext2D, text: string|null, barX: number, barY: number, barWidth: number,
|
180
190
|
barHeight: number, unclippedBarX: number, timeToPixelRatio: number): boolean {
|
181
|
-
const request = (this
|
191
|
+
const request = (this.#requests[index] as TimelineModel.TimelineModel.NetworkRequest);
|
182
192
|
if (!request.timing) {
|
183
193
|
return false;
|
184
194
|
}
|
@@ -223,7 +233,7 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
223
233
|
context.stroke();
|
224
234
|
|
225
235
|
if (typeof request.priority === 'string') {
|
226
|
-
const color = this
|
236
|
+
const color = this.#colorForPriority(request.priority);
|
227
237
|
if (color) {
|
228
238
|
context.fillStyle = color;
|
229
239
|
context.fillRect(sendStart + 0.5, barY + 0.5, 3.5, 3.5);
|
@@ -258,7 +268,7 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
258
268
|
|
259
269
|
prepareHighlightedEntryInfo(index: number): Element|null {
|
260
270
|
const /** @const */ maxURLChars = 80;
|
261
|
-
const request = (this
|
271
|
+
const request = (this.#requests[index] as TimelineModel.TimelineModel.NetworkRequest);
|
262
272
|
if (!request.url) {
|
263
273
|
return null;
|
264
274
|
}
|
@@ -278,15 +288,15 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
278
288
|
const div = (contents.createChild('span') as HTMLElement);
|
279
289
|
div.textContent =
|
280
290
|
PerfUI.NetworkPriorities.uiLabelForNetworkPriority((request.priority as Protocol.Network.ResourcePriority));
|
281
|
-
div.style.color = this
|
291
|
+
div.style.color = this.#colorForPriority(request.priority) || 'black';
|
282
292
|
}
|
283
293
|
contents.createChild('span').textContent = Platform.StringUtilities.trimMiddle(request.url, maxURLChars);
|
284
294
|
return element;
|
285
295
|
}
|
286
296
|
|
287
|
-
|
288
|
-
if (!this
|
289
|
-
this
|
297
|
+
#colorForPriority(priority: string): string|null {
|
298
|
+
if (!this.#priorityToValue) {
|
299
|
+
this.#priorityToValue = new Map([
|
290
300
|
[Protocol.Network.ResourcePriority.VeryLow, 1],
|
291
301
|
[Protocol.Network.ResourcePriority.Low, 2],
|
292
302
|
[Protocol.Network.ResourcePriority.Medium, 3],
|
@@ -294,70 +304,71 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
294
304
|
[Protocol.Network.ResourcePriority.VeryHigh, 5],
|
295
305
|
]);
|
296
306
|
}
|
297
|
-
const value = this
|
307
|
+
const value = this.#priorityToValue.get(priority);
|
298
308
|
return value ? `hsla(214, 80%, 50%, ${value / 5})` : null;
|
299
309
|
}
|
300
310
|
|
301
|
-
|
302
|
-
if (this
|
303
|
-
this
|
304
|
-
this
|
305
|
-
this
|
306
|
-
|
307
|
-
this.
|
311
|
+
#appendTimelineData(): void {
|
312
|
+
if (this.#legacyTimelineModel) {
|
313
|
+
this.#minimumBoundaryInternal = this.#legacyTimelineModel.minimumRecordTime();
|
314
|
+
this.#maximumBoundary = this.#legacyTimelineModel.maximumRecordTime();
|
315
|
+
this.#timeSpan =
|
316
|
+
this.#legacyTimelineModel.isEmpty() ? 1000 : this.#maximumBoundary - this.#minimumBoundaryInternal;
|
317
|
+
this.#legacyTimelineModel.networkRequests().forEach(this.#appendEntry.bind(this));
|
318
|
+
this.#updateTimelineData();
|
308
319
|
}
|
309
320
|
}
|
310
321
|
|
311
|
-
|
312
|
-
if (!this
|
322
|
+
#updateTimelineData(): void {
|
323
|
+
if (!this.#timelineDataInternal) {
|
313
324
|
return;
|
314
325
|
}
|
315
326
|
const lastTimeByLevel = [];
|
316
327
|
let maxLevel = 0;
|
317
|
-
for (let i = 0; i < this
|
318
|
-
const r = this
|
328
|
+
for (let i = 0; i < this.#requests.length; ++i) {
|
329
|
+
const r = this.#requests[i];
|
319
330
|
const beginTime = r.beginTime();
|
320
|
-
const startTime = (this
|
321
|
-
const endTime = (this
|
331
|
+
const startTime = (this.#startTime as number);
|
332
|
+
const endTime = (this.#endTime as number);
|
322
333
|
const visible = beginTime < endTime && r.endTime > startTime;
|
323
334
|
if (!visible) {
|
324
|
-
this
|
335
|
+
this.#timelineDataInternal.entryLevels[i] = -1;
|
325
336
|
continue;
|
326
337
|
}
|
327
338
|
while (lastTimeByLevel.length && lastTimeByLevel[lastTimeByLevel.length - 1] <= beginTime) {
|
328
339
|
lastTimeByLevel.pop();
|
329
340
|
}
|
330
|
-
this
|
341
|
+
this.#timelineDataInternal.entryLevels[i] = lastTimeByLevel.length;
|
331
342
|
lastTimeByLevel.push(r.endTime);
|
332
343
|
maxLevel = Math.max(maxLevel, lastTimeByLevel.length);
|
333
344
|
}
|
334
|
-
for (let i = 0; i < this
|
335
|
-
if (this
|
336
|
-
this
|
345
|
+
for (let i = 0; i < this.#requests.length; ++i) {
|
346
|
+
if (this.#timelineDataInternal.entryLevels[i] === -1) {
|
347
|
+
this.#timelineDataInternal.entryLevels[i] = maxLevel;
|
337
348
|
}
|
338
349
|
}
|
339
|
-
this
|
340
|
-
entryLevels: this
|
341
|
-
entryTotalTimes: this
|
342
|
-
entryStartTimes: this
|
343
|
-
groups: [this
|
350
|
+
this.#timelineDataInternal = PerfUI.FlameChart.FlameChartTimelineData.create({
|
351
|
+
entryLevels: this.#timelineDataInternal.entryLevels,
|
352
|
+
entryTotalTimes: this.#timelineDataInternal.entryTotalTimes,
|
353
|
+
entryStartTimes: this.#timelineDataInternal.entryStartTimes,
|
354
|
+
groups: [this.#group],
|
344
355
|
});
|
345
|
-
this
|
356
|
+
this.#maxLevel = maxLevel;
|
346
357
|
}
|
347
358
|
|
348
|
-
|
349
|
-
this
|
350
|
-
this
|
351
|
-
this
|
352
|
-
this
|
359
|
+
#appendEntry(request: TimelineModel.TimelineModel.NetworkRequest): void {
|
360
|
+
this.#requests.push(request);
|
361
|
+
this.#timelineDataInternal.entryStartTimes.push(request.beginTime());
|
362
|
+
this.#timelineDataInternal.entryTotalTimes.push(request.endTime - request.beginTime());
|
363
|
+
this.#timelineDataInternal.entryLevels.push(this.#requests.length - 1);
|
353
364
|
}
|
354
365
|
|
355
366
|
preferredHeight(): number {
|
356
|
-
return this
|
367
|
+
return this.#style.height * (this.#group.expanded ? Platform.NumberUtilities.clamp(this.#maxLevel + 1, 4, 8.5) : 1);
|
357
368
|
}
|
358
369
|
|
359
370
|
isExpanded(): boolean {
|
360
|
-
return this
|
371
|
+
return this.#group && Boolean(this.#group.expanded);
|
361
372
|
}
|
362
373
|
|
363
374
|
formatValue(value: number, precision?: number): string {
|
@@ -373,10 +384,10 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
373
384
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
374
385
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
375
386
|
navStartTimes(): Map<any, any> {
|
376
|
-
if (!this
|
387
|
+
if (!this.#legacyTimelineModel) {
|
377
388
|
return new Map();
|
378
389
|
}
|
379
390
|
|
380
|
-
return this.
|
391
|
+
return this.#legacyTimelineModel.navStartTimes();
|
381
392
|
}
|
382
393
|
}
|
@@ -200,7 +200,7 @@ export class TimelineFlameChartView extends UI.Widget.VBox implements PerfUI.Fla
|
|
200
200
|
this.model = model;
|
201
201
|
this.#selectedEvents = null;
|
202
202
|
this.mainDataProvider.setModel(this.model, newTraceEngineData);
|
203
|
-
this.networkDataProvider.setModel(this.model);
|
203
|
+
this.networkDataProvider.setModel(this.model, newTraceEngineData);
|
204
204
|
if (this.model) {
|
205
205
|
this.eventListeners = [
|
206
206
|
this.model.addEventListener(PerformanceModelEvents.WindowChanged, this.onWindowChanged, this),
|
@@ -99,6 +99,11 @@ export class TimelinePaintProfilerView extends UI.SplitWidget.SplitWidget {
|
|
99
99
|
if (this.pendingSnapshot) {
|
100
100
|
snapshotPromise = Promise.resolve({rect: null, snapshot: this.pendingSnapshot});
|
101
101
|
} else if (this.event && this.event.name === TimelineModel.TimelineModel.RecordType.Paint) {
|
102
|
+
// When we process events (TimelineModel#processEvent) and find a
|
103
|
+
// snapshot event, we look for the last paint that occurred and link the
|
104
|
+
// snapshot to that paint event. That is why here if the event is a Paint
|
105
|
+
// event, we look to see if it has had a matching picture event set for
|
106
|
+
// it.
|
102
107
|
const picture =
|
103
108
|
(TimelineModel.TimelineModel.EventOnTimelineData.forEvent(this.event).picture as
|
104
109
|
SDK.TracingModel.ObjectSnapshot);
|
@@ -324,9 +324,9 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
|
|
324
324
|
private cpuThrottlingSelect?: UI.Toolbar.ToolbarComboBox;
|
325
325
|
private fileSelectorElement?: HTMLInputElement;
|
326
326
|
private selection?: TimelineSelection|null;
|
327
|
-
private
|
328
|
-
private
|
329
|
-
this.
|
327
|
+
private primaryPageTargetPromiseCallback = (_target: SDK.Target.Target): void => {};
|
328
|
+
private primaryPageTargetPromise = new Promise<SDK.Target.Target>(res => {
|
329
|
+
this.primaryPageTargetPromiseCallback = res;
|
330
330
|
});
|
331
331
|
|
332
332
|
#traceEngineModel: TraceEngine.TraceModel.Model<typeof TraceEngine.TraceModel.ENABLED_TRACE_HANDLERS>;
|
@@ -430,7 +430,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
|
|
430
430
|
if (target !== SDK.TargetManager.TargetManager.instance().primaryPageTarget()) {
|
431
431
|
return;
|
432
432
|
}
|
433
|
-
this.
|
433
|
+
this.primaryPageTargetPromiseCallback(target);
|
434
434
|
},
|
435
435
|
targetRemoved: (_: SDK.Target.Target) => {},
|
436
436
|
});
|
@@ -870,16 +870,16 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
|
|
870
870
|
|
871
871
|
const MAX_WAIT_FOR_TARGET_MS = 2000;
|
872
872
|
const timeoutPromise = new Promise(res => setTimeout(res, MAX_WAIT_FOR_TARGET_MS));
|
873
|
-
const
|
874
|
-
if (!(
|
873
|
+
const primaryPageTarget = await Promise.race([this.primaryPageTargetPromise, timeoutPromise]);
|
874
|
+
if (!(primaryPageTarget instanceof SDK.Target.Target)) {
|
875
875
|
this.recordingFailed(i18nString(UIStrings.couldNotStart));
|
876
876
|
return;
|
877
877
|
}
|
878
878
|
|
879
879
|
if (UIDevtoolsUtils.isUiDevTools()) {
|
880
|
-
this.controller = new UIDevtoolsController(
|
880
|
+
this.controller = new UIDevtoolsController(primaryPageTarget, this);
|
881
881
|
} else {
|
882
|
-
this.controller = new TimelineController(
|
882
|
+
this.controller = new TimelineController(primaryPageTarget, this);
|
883
883
|
}
|
884
884
|
this.setUIControlsEnabled(false);
|
885
885
|
this.hideLandingPage();
|
@@ -1201,7 +1201,7 @@ export class CheckboxLabel extends HTMLSpanElement {
|
|
1201
1201
|
element.checkboxElement.checked = Boolean(checked);
|
1202
1202
|
if (title !== undefined) {
|
1203
1203
|
element.textElement.textContent = title;
|
1204
|
-
|
1204
|
+
element.checkboxElement.title = title;
|
1205
1205
|
if (subtitle !== undefined) {
|
1206
1206
|
element.textElement.createChild('div', 'dt-checkbox-subtitle').textContent = subtitle;
|
1207
1207
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Copyright 2023 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
const path = require('path');
|
6
|
+
const rulesDirPlugin = require('eslint-plugin-rulesdir');
|
7
|
+
rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', '..', '..', '..', '..', 'scripts', 'eslint_rules', 'lib');
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
'rules' : {
|
11
|
+
// Enable tracking of canvas save() and
|
12
|
+
// restore() calls to try and catch bugs. Only
|
13
|
+
// enabled in this folder because it is an
|
14
|
+
// expensive rule to run and we do not need it
|
15
|
+
// for any code that doesn't use Canvas.
|
16
|
+
'rulesdir/canvas_context_tracking' : 2,
|
17
|
+
}
|
18
|
+
};
|
@@ -1148,7 +1148,11 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
1148
1148
|
const barWidth = overrides?.width || this.#eventBarWidth(timelineData, entryIndex);
|
1149
1149
|
// We purposefully leave a 1px gap off the height so there is a small gap
|
1150
1150
|
// visually between events vertically in the panel.
|
1151
|
-
|
1151
|
+
// Similarly, we leave 0.5 pixels off the width so that there is a small
|
1152
|
+
// gap between events. Otherwise if a trace has a lot of events it looks
|
1153
|
+
// like one solid block and is not very easy to distinguish when events
|
1154
|
+
// start and end.
|
1155
|
+
context.rect(barX, barY, barWidth - 0.5, barHeight - 1);
|
1152
1156
|
}
|
1153
1157
|
|
1154
1158
|
#eventBarHeight(timelineData: FlameChartTimelineData, entryIndex: number): number {
|
@@ -219,8 +219,11 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
|
|
219
219
|
return;
|
220
220
|
}
|
221
221
|
|
222
|
-
this.windowStartTime =
|
223
|
-
|
222
|
+
this.windowStartTime =
|
223
|
+
event.data.rawStartValue === this.overviewCalculator.minimumBoundary() ? 0 : event.data.rawStartValue;
|
224
|
+
this.windowEndTime =
|
225
|
+
event.data.rawEndValue === this.overviewCalculator.maximumBoundary() ? Infinity : event.data.rawEndValue;
|
226
|
+
|
224
227
|
const windowTimes = {startTime: this.windowStartTime, endTime: this.windowEndTime};
|
225
228
|
|
226
229
|
this.dispatchEventToListeners(Events.WindowChanged, windowTimes);
|
@@ -234,6 +234,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
234
234
|
className: options?.className,
|
235
235
|
tabStop: options?.tabStop,
|
236
236
|
inlineFrameIndex: options?.inlineFrameIndex ?? 0,
|
237
|
+
userMetric: options?.userMetric,
|
237
238
|
};
|
238
239
|
const {columnNumber, className = ''} = linkifyURLOptions;
|
239
240
|
if (sourceURL) {
|
@@ -265,6 +266,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
265
266
|
fallbackAnchor && fallbackAnchor.textContent ? fallbackAnchor.textContent : '', className, createLinkOptions);
|
266
267
|
linkInfo.enableDecorator = this.useLinkDecorator;
|
267
268
|
linkInfo.fallback = fallbackAnchor;
|
269
|
+
linkInfo.userMetric = options?.userMetric;
|
268
270
|
|
269
271
|
const pool = this.locationPoolByTarget.get(rawLocation.debuggerModel.target());
|
270
272
|
if (!pool) {
|
@@ -303,6 +305,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
303
305
|
showColumnNumber: Boolean(options?.showColumnNumber),
|
304
306
|
inlineFrameIndex: options?.inlineFrameIndex ?? 0,
|
305
307
|
tabStop: options?.tabStop,
|
308
|
+
userMetric: options?.userMetric,
|
306
309
|
};
|
307
310
|
|
308
311
|
return scriptLink || Linkifier.linkifyURL(sourceURL, linkifyURLOptions);
|
@@ -543,6 +546,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
543
546
|
if (columnNumber) {
|
544
547
|
linkInfo.columnNumber = columnNumber;
|
545
548
|
}
|
549
|
+
linkInfo.userMetric = options?.userMetric;
|
546
550
|
return link;
|
547
551
|
}
|
548
552
|
|
@@ -692,6 +696,9 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
692
696
|
const actions = Linkifier.linkActions(linkInfo);
|
693
697
|
if (actions.length) {
|
694
698
|
void actions[0].handler.call(null);
|
699
|
+
if (linkInfo.userMetric) {
|
700
|
+
Host.userMetrics.actionTaken(linkInfo.userMetric);
|
701
|
+
}
|
695
702
|
return true;
|
696
703
|
}
|
697
704
|
return false;
|
@@ -992,6 +999,7 @@ export interface _LinkInfo {
|
|
992
999
|
inlineFrameIndex: number;
|
993
1000
|
revealable: Object|null;
|
994
1001
|
fallback: Element|null;
|
1002
|
+
userMetric?: Host.UserMetrics.Action;
|
995
1003
|
}
|
996
1004
|
|
997
1005
|
export interface LinkifyURLOptions {
|
@@ -1005,6 +1013,7 @@ export interface LinkifyURLOptions {
|
|
1005
1013
|
maxLength?: number;
|
1006
1014
|
tabStop?: boolean;
|
1007
1015
|
bypassURLTrimming?: boolean;
|
1016
|
+
userMetric?: Host.UserMetrics.Action;
|
1008
1017
|
}
|
1009
1018
|
|
1010
1019
|
export interface LinkifyOptions {
|
@@ -1013,6 +1022,7 @@ export interface LinkifyOptions {
|
|
1013
1022
|
showColumnNumber?: boolean;
|
1014
1023
|
inlineFrameIndex: number;
|
1015
1024
|
tabStop?: boolean;
|
1025
|
+
userMetric?: Host.UserMetrics.Action;
|
1016
1026
|
|
1017
1027
|
/**
|
1018
1028
|
* {@link LinkDisplayOptions.revealBreakpoint}
|
package/package.json
CHANGED