devtools-tracing 1.0.0 → 1.1.0
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/README.md +4 -0
- package/generate.ts +32 -26
- package/index.ts +2 -1
- package/lib/extension-api/ExtensionAPI.d.ts +357 -0
- package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +318 -0
- package/lib/front_end/models/bindings/CompilerScriptMapping.ts +536 -0
- package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +187 -0
- package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +1197 -0
- package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +733 -0
- package/lib/front_end/models/bindings/DefaultScriptMapping.ts +141 -0
- package/lib/front_end/models/bindings/FileUtils.ts +228 -0
- package/lib/front_end/models/bindings/LiveLocation.ts +81 -0
- package/lib/front_end/models/bindings/NetworkProject.ts +157 -0
- package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +312 -0
- package/lib/front_end/models/bindings/ResourceMapping.ts +539 -0
- package/lib/front_end/models/bindings/ResourceScriptMapping.ts +491 -0
- package/lib/front_end/models/bindings/ResourceUtils.ts +103 -0
- package/lib/front_end/models/bindings/SASSSourceMapping.ts +222 -0
- package/lib/front_end/models/bindings/StylesSourceMapping.ts +316 -0
- package/lib/front_end/models/bindings/TempFile.ts +67 -0
- package/lib/front_end/models/bindings/bindings.ts +39 -0
- package/lib/front_end/models/source_map_scopes/NamesResolver.ts +765 -0
- package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +84 -0
- package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +11 -0
- package/lib/front_end/models/stack_trace/StackTrace.ts +53 -0
- package/lib/front_end/models/stack_trace/StackTraceImpl.ts +85 -0
- package/lib/front_end/models/stack_trace/StackTraceModel.ts +128 -0
- package/lib/front_end/models/stack_trace/Trie.ts +163 -0
- package/lib/front_end/models/stack_trace/stack_trace.ts +9 -0
- package/lib/front_end/models/stack_trace/stack_trace_impl.ts +13 -0
- package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +240 -0
- package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +5 -0
- package/lib/front_end/models/workspace/FileManager.ts +97 -0
- package/lib/front_end/models/workspace/IgnoreListManager.ts +628 -0
- package/lib/front_end/models/workspace/SearchConfig.ts +149 -0
- package/lib/front_end/models/workspace/UISourceCode.ts +698 -0
- package/lib/front_end/models/workspace/WorkspaceImpl.ts +339 -0
- package/lib/front_end/models/workspace/workspace.ts +17 -0
- package/lib/front_end/panels/timeline/TimelineUIUtils.ts +1029 -0
- package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +49 -0
- package/lib/front_end/panels/timeline/extensions/extensions.ts +9 -0
- package/lib/front_end/third_party/codemirror.next/LICENSE +21 -0
- package/lib/front_end/third_party/codemirror.next/README.chromium +30 -0
- package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +24 -0
- package/lib/front_end/third_party/codemirror.next/bundle.ts +135 -0
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/css.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/html.js +4 -0
- package/lib/front_end/third_party/codemirror.next/chunk/java.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/less.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/php.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/python.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js +2 -0
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +8057 -0
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js +2 -0
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +1 -0
- package/lib/front_end/third_party/codemirror.next/package.json +43 -0
- package/lib/front_end/third_party/codemirror.next/rebuild.sh +6 -0
- package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +49 -0
- package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +26 -0
- package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +31 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +33 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +26 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +64 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +62 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +37 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +29 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +8 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +6 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +21 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +14 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +196 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +262 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +235 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +359 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +39 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +53 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +438 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +539 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +23 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +35 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +257 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +348 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +8 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +20 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +8 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +184 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +9 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +12 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +82 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +1 -0
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +99 -0
- package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +5 -0
- package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +222 -0
- package/lib/front_end/ui/legacy/theme_support/theme_support.ts +5 -0
- package/package.json +11 -5
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +1549 -20
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
// Copyright 2021 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (C) 2013 Google Inc. All rights reserved.
|
|
8
|
+
* Copyright (C) 2012 Intel Inc. All rights reserved.
|
|
9
|
+
*
|
|
10
|
+
* Redistribution and use in source and binary forms, with or without
|
|
11
|
+
* modification, are permitted provided that the following conditions are
|
|
12
|
+
* met:
|
|
13
|
+
*
|
|
14
|
+
* * Redistributions of source code must retain the above copyright
|
|
15
|
+
* notice, this list of conditions and the following disclaimer.
|
|
16
|
+
* * Redistributions in binary form must reproduce the above
|
|
17
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
18
|
+
* in the documentation and/or other materials provided with the
|
|
19
|
+
* distribution.
|
|
20
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
21
|
+
* contributors may be used to endorse or promote products derived from
|
|
22
|
+
* this software without specific prior written permission.
|
|
23
|
+
*
|
|
24
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
25
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
26
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
27
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
28
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
29
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
30
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
31
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
32
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
33
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import * as Common from '../../core/common/common.js';
|
|
38
|
+
import * as i18n from '../../core/i18n/i18n.js';
|
|
39
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
40
|
+
import * as Root from '../../core/root/root.js';
|
|
41
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
42
|
+
import * as Trace from '../../models/trace/trace.js';
|
|
43
|
+
import * as SourceMapsResolver from '../../models/trace_source_maps_resolver/trace_source_maps_resolver.js';
|
|
44
|
+
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
|
45
|
+
|
|
46
|
+
import * as Extensions from './extensions/extensions.js';
|
|
47
|
+
|
|
48
|
+
const UIStrings = {
|
|
49
|
+
/**
|
|
50
|
+
* @description Text that only contain a placeholder
|
|
51
|
+
* @example {100ms (at 200ms)} PH1
|
|
52
|
+
*/
|
|
53
|
+
emptyPlaceholder: '{PH1}', // eslint-disable-line @devtools/l10n-no-locked-or-placeholder-only-phrase
|
|
54
|
+
/**
|
|
55
|
+
* @description Text for timestamps of items
|
|
56
|
+
*/
|
|
57
|
+
timestamp: 'Timestamp',
|
|
58
|
+
/**
|
|
59
|
+
* @description Text shown next to the interaction event's ID in the detail view.
|
|
60
|
+
*/
|
|
61
|
+
interactionID: 'ID',
|
|
62
|
+
/**
|
|
63
|
+
* @description Text shown next to the interaction event's input delay time in the detail view.
|
|
64
|
+
*/
|
|
65
|
+
inputDelay: 'Input delay',
|
|
66
|
+
/**
|
|
67
|
+
* @description Text shown next to the interaction event's thread processing duration in the detail view.
|
|
68
|
+
*/
|
|
69
|
+
processingDuration: 'Processing duration',
|
|
70
|
+
/**
|
|
71
|
+
* @description Text shown next to the interaction event's presentation delay time in the detail view.
|
|
72
|
+
*/
|
|
73
|
+
presentationDelay: 'Presentation delay',
|
|
74
|
+
/**
|
|
75
|
+
* @description Text shown when the user has selected an event that represents script compiliation.
|
|
76
|
+
*/
|
|
77
|
+
compile: 'Compile',
|
|
78
|
+
/**
|
|
79
|
+
* @description Text shown when the user selects an event that represents script parsing.
|
|
80
|
+
*/
|
|
81
|
+
parse: 'Parse',
|
|
82
|
+
/**
|
|
83
|
+
* @description Text with two placeholders separated by a colon
|
|
84
|
+
* @example {Node removed} PH1
|
|
85
|
+
* @example {div#id1} PH2
|
|
86
|
+
*/
|
|
87
|
+
sS: '{PH1}: {PH2}',
|
|
88
|
+
/**
|
|
89
|
+
* @description Text that is usually a hyperlink to more documentation
|
|
90
|
+
*/
|
|
91
|
+
learnMore: 'Learn more',
|
|
92
|
+
/**
|
|
93
|
+
* @description Text referring to the status of the browser's compilation cache.
|
|
94
|
+
*/
|
|
95
|
+
compilationCacheStatus: 'Compilation cache status',
|
|
96
|
+
/**
|
|
97
|
+
* @description Text referring to the size of the browser's compiliation cache.
|
|
98
|
+
*/
|
|
99
|
+
compilationCacheSize: 'Compilation cache size',
|
|
100
|
+
/**
|
|
101
|
+
* @description Text in Timeline UIUtils of the Performance panel. "Compilation
|
|
102
|
+
* cache" refers to the code cache described at
|
|
103
|
+
* https://v8.dev/blog/code-caching-for-devs . This label is followed by the
|
|
104
|
+
* type of code cache data used, either "normal" or "full" as described in the
|
|
105
|
+
* linked article.
|
|
106
|
+
*/
|
|
107
|
+
compilationCacheKind: 'Compilation cache kind',
|
|
108
|
+
/**
|
|
109
|
+
* @description Text used to inform the user that the script they are looking
|
|
110
|
+
* at was loaded from the browser's cache.
|
|
111
|
+
*/
|
|
112
|
+
scriptLoadedFromCache: 'script loaded from cache',
|
|
113
|
+
/**
|
|
114
|
+
* @description Text to inform the user that the script they are looking at
|
|
115
|
+
* was unable to be loaded from the browser's cache.
|
|
116
|
+
*/
|
|
117
|
+
failedToLoadScriptFromCache: 'failed to load script from cache',
|
|
118
|
+
/**
|
|
119
|
+
* @description Text to inform the user that the script they are looking at was not eligible to be loaded from the browser's cache.
|
|
120
|
+
*/
|
|
121
|
+
scriptNotEligibleToBeLoadedFromCache: 'script not eligible',
|
|
122
|
+
/**
|
|
123
|
+
* @description Label in the summary view in the Performance panel for a number which indicates how much managed memory has been reclaimed by performing Garbage Collection
|
|
124
|
+
*/
|
|
125
|
+
collected: 'Collected',
|
|
126
|
+
/**
|
|
127
|
+
* @description Text for a programming function
|
|
128
|
+
*/
|
|
129
|
+
function: 'Function',
|
|
130
|
+
/**
|
|
131
|
+
* @description Text for referring to the ID of a timer.
|
|
132
|
+
*/
|
|
133
|
+
timerId: 'Timer ID',
|
|
134
|
+
/**
|
|
135
|
+
* @description Text for referring to a timer that has timed-out and therefore is being removed.
|
|
136
|
+
*/
|
|
137
|
+
timeout: 'Timeout',
|
|
138
|
+
/**
|
|
139
|
+
* @description Text used to refer to a positive timeout value that schedules the idle callback once elapsed, even if no idle time is available.
|
|
140
|
+
*/
|
|
141
|
+
requestIdleCallbackTimeout: 'Timeout',
|
|
142
|
+
/**
|
|
143
|
+
* @description Text used to indicate that a timer is repeating (e.g. every X seconds) rather than a one off.
|
|
144
|
+
*/
|
|
145
|
+
repeats: 'Repeats',
|
|
146
|
+
/**
|
|
147
|
+
* @description Text for referring to the ID of a callback function installed by an event.
|
|
148
|
+
*/
|
|
149
|
+
callbackId: 'Callback ID',
|
|
150
|
+
/**
|
|
151
|
+
* @description Text for a module, the programming concept
|
|
152
|
+
*/
|
|
153
|
+
module: 'Module',
|
|
154
|
+
/**
|
|
155
|
+
* @description Label for a group of JavaScript files
|
|
156
|
+
*/
|
|
157
|
+
script: 'Script',
|
|
158
|
+
/**
|
|
159
|
+
* @description Text used to tell a user that a compilation trace event was streamed.
|
|
160
|
+
*/
|
|
161
|
+
streamed: 'Streamed',
|
|
162
|
+
/**
|
|
163
|
+
* @description Text to indicate if a compilation event was eager.
|
|
164
|
+
*/
|
|
165
|
+
eagerCompile: 'Compiling all functions eagerly',
|
|
166
|
+
/**
|
|
167
|
+
* @description Text to refer to the URL associated with a given event.
|
|
168
|
+
*/
|
|
169
|
+
url: 'Url',
|
|
170
|
+
/**
|
|
171
|
+
* @description Text to indicate to the user the size of the cache (as a filesize - e.g. 5mb).
|
|
172
|
+
*/
|
|
173
|
+
producedCacheSize: 'Produced cache size',
|
|
174
|
+
/**
|
|
175
|
+
* @description Text to indicate to the user the amount of the cache (as a filesize - e.g. 5mb) that has been used.
|
|
176
|
+
*/
|
|
177
|
+
consumedCacheSize: 'Consumed cache size',
|
|
178
|
+
/**
|
|
179
|
+
* @description Related node label in Timeline UIUtils of the Performance panel
|
|
180
|
+
*/
|
|
181
|
+
layerRoot: 'Layer root',
|
|
182
|
+
/**
|
|
183
|
+
* @description Related node label in Timeline UIUtils of the Performance panel
|
|
184
|
+
*/
|
|
185
|
+
ownerElement: 'Owner element',
|
|
186
|
+
/**
|
|
187
|
+
* @description Text used to show the user the URL of the image they are viewing.
|
|
188
|
+
*/
|
|
189
|
+
imageUrl: 'Image URL',
|
|
190
|
+
/**
|
|
191
|
+
* @description Text used to show the user that the URL they are viewing is loading a CSS stylesheet.
|
|
192
|
+
*/
|
|
193
|
+
stylesheetUrl: 'Stylesheet URL',
|
|
194
|
+
/**
|
|
195
|
+
* @description Text used next to a number to show the user how many elements were affected.
|
|
196
|
+
*/
|
|
197
|
+
elementsAffected: 'Elements affected',
|
|
198
|
+
/**
|
|
199
|
+
* @description Text used next to a number to show the user how many nodes required the browser to update and re-layout the page.
|
|
200
|
+
*/
|
|
201
|
+
nodesThatNeedLayout: 'Nodes that need layout',
|
|
202
|
+
/**
|
|
203
|
+
* @description Text used to show the amount in a subset - e.g. "2 of 10".
|
|
204
|
+
* @example {2} PH1
|
|
205
|
+
* @example {10} PH2
|
|
206
|
+
*/
|
|
207
|
+
sOfS: '{PH1} of {PH2}',
|
|
208
|
+
/**
|
|
209
|
+
* @description Related node label in Timeline UIUtils of the Performance panel
|
|
210
|
+
*/
|
|
211
|
+
layoutRoot: 'Layout root',
|
|
212
|
+
/**
|
|
213
|
+
* @description Text used when viewing an event that can have a custom message attached.
|
|
214
|
+
*/
|
|
215
|
+
message: 'Message',
|
|
216
|
+
/**
|
|
217
|
+
* @description Text used to tell the user they are viewing an event that has a function embedded in it, which is referred to as the "callback function".
|
|
218
|
+
*/
|
|
219
|
+
callbackFunction: 'Callback function',
|
|
220
|
+
/**
|
|
221
|
+
* @description Text used to show the relevant range of a file - e.g. "lines 2-10".
|
|
222
|
+
*/
|
|
223
|
+
range: 'Range',
|
|
224
|
+
/**
|
|
225
|
+
* @description Text used to refer to the amount of time some event or code was given to complete within.
|
|
226
|
+
*/
|
|
227
|
+
allottedTime: 'Allotted time',
|
|
228
|
+
/**
|
|
229
|
+
* @description Text used to tell a user that a particular event or function was automatically run by a timeout.
|
|
230
|
+
*/
|
|
231
|
+
invokedByTimeout: 'Invoked by timeout',
|
|
232
|
+
/**
|
|
233
|
+
* @description Text that refers to some types
|
|
234
|
+
*/
|
|
235
|
+
type: 'Type',
|
|
236
|
+
/**
|
|
237
|
+
* @description Text for the size of something
|
|
238
|
+
*/
|
|
239
|
+
size: 'Size',
|
|
240
|
+
/**
|
|
241
|
+
* @description Text for the details of something
|
|
242
|
+
*/
|
|
243
|
+
details: 'Details',
|
|
244
|
+
/**
|
|
245
|
+
* @description Text to indicate an item is a warning
|
|
246
|
+
*/
|
|
247
|
+
warning: 'Warning',
|
|
248
|
+
/**
|
|
249
|
+
* @description Text that indicates a particular HTML element or node is related to what the user is viewing.
|
|
250
|
+
*/
|
|
251
|
+
relatedNode: 'Related node',
|
|
252
|
+
/**
|
|
253
|
+
* @description Text for previewing items
|
|
254
|
+
*/
|
|
255
|
+
preview: 'Preview',
|
|
256
|
+
/**
|
|
257
|
+
* @description Text used to refer to the total time summed up across multiple events.
|
|
258
|
+
*/
|
|
259
|
+
aggregatedTime: 'Aggregated time',
|
|
260
|
+
/**
|
|
261
|
+
* @description Text for the duration of something
|
|
262
|
+
*/
|
|
263
|
+
duration: 'Duration',
|
|
264
|
+
/**
|
|
265
|
+
* @description Text for the stack trace of the initiator of something. The Initiator is the event or factor that directly triggered or precipitated a subsequent action.
|
|
266
|
+
*/
|
|
267
|
+
initiatorStackTrace: 'Initiator stack trace',
|
|
268
|
+
/**
|
|
269
|
+
* @description Text for the event initiated by another one
|
|
270
|
+
*/
|
|
271
|
+
initiatedBy: 'Initiated by',
|
|
272
|
+
/**
|
|
273
|
+
* @description Text for the event that is an initiator for another one
|
|
274
|
+
*/
|
|
275
|
+
initiatorFor: 'Initiator for',
|
|
276
|
+
/**
|
|
277
|
+
* @description Text for the underlying data behing a specific flamechart selection. Trace events are the browser instrumentation that are emitted as JSON objects.
|
|
278
|
+
*/
|
|
279
|
+
traceEvent: 'Trace event',
|
|
280
|
+
/**
|
|
281
|
+
* @description Call site stack label in Timeline UIUtils of the Performance panel
|
|
282
|
+
*/
|
|
283
|
+
timerInstalled: 'Timer installed',
|
|
284
|
+
/**
|
|
285
|
+
* @description Call site stack label in Timeline UIUtils of the Performance panel
|
|
286
|
+
*/
|
|
287
|
+
animationFrameRequested: 'Animation frame requested',
|
|
288
|
+
/**
|
|
289
|
+
* @description Call site stack label in Timeline UIUtils of the Performance panel
|
|
290
|
+
*/
|
|
291
|
+
idleCallbackRequested: 'Idle callback requested',
|
|
292
|
+
/**
|
|
293
|
+
* @description Stack label in Timeline UIUtils of the Performance panel
|
|
294
|
+
*/
|
|
295
|
+
recalculationForced: 'Recalculation forced',
|
|
296
|
+
/**
|
|
297
|
+
* @description Call site stack label in Timeline UIUtils of the Performance panel
|
|
298
|
+
*/
|
|
299
|
+
firstLayoutInvalidation: 'First layout invalidation',
|
|
300
|
+
/**
|
|
301
|
+
* @description Stack label in Timeline UIUtils of the Performance panel
|
|
302
|
+
*/
|
|
303
|
+
layoutForced: 'Layout forced',
|
|
304
|
+
/**
|
|
305
|
+
* @description Label in front of CSS property (eg `opacity`) being animated or a CSS animation name (eg `layer-4-fade-in-out`)
|
|
306
|
+
*/
|
|
307
|
+
animating: 'Animating',
|
|
308
|
+
/**
|
|
309
|
+
* @description Label in front of reasons why a CSS animation wasn't composited (aka hardware accelerated)
|
|
310
|
+
*/
|
|
311
|
+
compositingFailed: 'Compositing failed',
|
|
312
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to accelerated animations being disabled. Shown in a table with a list of other potential failure reasons. */
|
|
313
|
+
compositingFailedAcceleratedAnimationsDisabled: 'Accelerated animations disabled',
|
|
314
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to DevTools suppressing the effect. Shown in a table with a list of other potential failure reasons. */
|
|
315
|
+
compositingFailedEffectSuppressedByDevtools: 'Effect suppressed by DevTools ',
|
|
316
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the animation or effect being invalid. Shown in a table with a list of other potential failure reasons. */
|
|
317
|
+
compositingFailedInvalidAnimationOrEffect: 'Invalid animation or effect',
|
|
318
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to an effect having unsupported timing parameters. Shown in a table with a list of other potential failure reasons. */
|
|
319
|
+
compositingFailedEffectHasUnsupportedTimingParams: 'Effect has unsupported timing parameters',
|
|
320
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to an effect having a composite mode which is not `replace`. Shown in a table with a list of other potential failure reasons. */
|
|
321
|
+
compositingFailedEffectHasNonReplaceCompositeMode: 'Effect has composite mode other than "replace"',
|
|
322
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the target being in an invalid compositing state. Shown in a table with a list of other potential failure reasons. */
|
|
323
|
+
compositingFailedTargetHasInvalidCompositingState: 'Target has invalid compositing state',
|
|
324
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to another animation on the same target being incompatible. Shown in a table with a list of other potential failure reasons. */
|
|
325
|
+
compositingFailedTargetHasIncompatibleAnimations: 'Target has another animation which is incompatible',
|
|
326
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the target having a CSS offset. Shown in a table with a list of other potential failure reasons. */
|
|
327
|
+
compositingFailedTargetHasCSSOffset: 'Target has CSS offset',
|
|
328
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the animation affecting non-CSS properties. Shown in a table with a list of other potential failure reasons. */
|
|
329
|
+
compositingFailedAnimationAffectsNonCSSProperties: 'Animation affects non-CSS properties',
|
|
330
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the transform-related property not being able to be animated on the target. Shown in a table with a list of other potential failure reasons. */
|
|
331
|
+
compositingFailedTransformRelatedPropertyCannotBeAcceleratedOnTarget:
|
|
332
|
+
'Transform-related property cannot be accelerated on target',
|
|
333
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to a `transform` property being dependent on the size of the element itself. Shown in a table with a list of other potential failure reasons. */
|
|
334
|
+
compositingFailedTransformDependsBoxSize: 'Transform-related property depends on box size',
|
|
335
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to a `filter` property possibly moving pixels. Shown in a table with a list of other potential failure reasons. */
|
|
336
|
+
compositingFailedFilterRelatedPropertyMayMovePixels: 'Filter-related property may move pixels',
|
|
337
|
+
/**
|
|
338
|
+
* @description [ICU Syntax] Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the animated CSS property not being supported on the compositor. Shown in a table with a list of other potential failure reasons.
|
|
339
|
+
* @example {height, width} properties
|
|
340
|
+
*/
|
|
341
|
+
compositingFailedUnsupportedCSSProperty: `{propertyCount, plural,
|
|
342
|
+
=1 {Unsupported CSS property: {properties}}
|
|
343
|
+
other {Unsupported CSS properties: {properties}}
|
|
344
|
+
}`,
|
|
345
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to mixing keyframe value types. Shown in a table with a list of other potential failure reasons. */
|
|
346
|
+
compositingFailedMixedKeyframeValueTypes: 'Mixed keyframe value types',
|
|
347
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the timeline source being in an invalid compositing state. Shown in a table with a list of other potential failure reasons. */
|
|
348
|
+
compositingFailedTimelineSourceHasInvalidCompositingState: 'Timeline source has invalid compositing state',
|
|
349
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the animation having no visible change. Shown in a table with a list of other potential failure reasons. */
|
|
350
|
+
compositingFailedAnimationHasNoVisibleChange: 'Animation has no visible change',
|
|
351
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to an effect affecting an important property. Shown in a table with a list of other potential failure reasons. */
|
|
352
|
+
compositingFailedAffectsImportantProperty: 'Effect affects a property with !important',
|
|
353
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to the SVG target having an independent transfrom property. Shown in a table with a list of other potential failure reasons. */
|
|
354
|
+
compositingFailedSVGTargetHasIndependentTransformProperty: 'SVG target has independent transform property',
|
|
355
|
+
/** Descriptive reason for why a user-provided animation failed to be optimized by the browser due to an unknown reason. Shown in a table with a list of other potential failure reasons. */
|
|
356
|
+
compositingFailedUnknownReason: 'Unknown Reason',
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @description Text for the execution "stack trace". It is not technically a stack trace, because it points to the beginning of each function
|
|
360
|
+
* and not to each call site, so we call it a function stack instead to avoid confusion.
|
|
361
|
+
*/
|
|
362
|
+
functionStack: 'Function stack',
|
|
363
|
+
/**
|
|
364
|
+
* @description Text used to show any invalidations for a particular event that caused the browser to have to do more work to update the page.
|
|
365
|
+
* @example {2} PH1
|
|
366
|
+
*/
|
|
367
|
+
invalidations: 'Invalidations ({PH1} total)',
|
|
368
|
+
/**
|
|
369
|
+
* @description Text in Timeline UIUtils of the Performance panel. Phrase is followed by a number of milliseconds.
|
|
370
|
+
* Some events or tasks might have been only started, but have not ended yet. Such events or tasks are considered
|
|
371
|
+
* "pending".
|
|
372
|
+
*/
|
|
373
|
+
pendingFor: 'Pending for',
|
|
374
|
+
/**
|
|
375
|
+
* @description Noun label for a stack trace which indicates the first time some condition was invalidated.
|
|
376
|
+
*/
|
|
377
|
+
firstInvalidated: 'First invalidated',
|
|
378
|
+
/**
|
|
379
|
+
* @description Title of the paint profiler, old name of the performance pane
|
|
380
|
+
*/
|
|
381
|
+
paintProfiler: 'Paint profiler',
|
|
382
|
+
/**
|
|
383
|
+
* @description Text in Timeline Flame Chart View of the Performance panel
|
|
384
|
+
* @example {Frame} PH1
|
|
385
|
+
* @example {10ms} PH2
|
|
386
|
+
*/
|
|
387
|
+
sAtS: '{PH1} at {PH2}',
|
|
388
|
+
/**
|
|
389
|
+
* @description Text used next to a time to indicate that the particular event took that much time itself. In context this might look like "3ms blink.console (self)"
|
|
390
|
+
* @example {blink.console} PH1
|
|
391
|
+
*/
|
|
392
|
+
sSelf: '{PH1} (self)',
|
|
393
|
+
/**
|
|
394
|
+
* @description Text used next to a time to indicate that the event's children took that much time. In context this might look like "3ms blink.console (children)"
|
|
395
|
+
* @example {blink.console} PH1
|
|
396
|
+
*/
|
|
397
|
+
sChildren: '{PH1} (children)',
|
|
398
|
+
/**
|
|
399
|
+
* @description Text used to show the user how much time the browser spent on rendering (drawing the page onto the screen).
|
|
400
|
+
*/
|
|
401
|
+
timeSpentInRendering: 'Time spent in rendering',
|
|
402
|
+
/**
|
|
403
|
+
* @description Text for a rendering frame
|
|
404
|
+
*/
|
|
405
|
+
frame: 'Frame',
|
|
406
|
+
/**
|
|
407
|
+
* @description Text used to refer to the duration of an event at a given offset - e.g. "2ms at 10ms" which can be read as "2ms starting after 10ms".
|
|
408
|
+
* @example {10ms} PH1
|
|
409
|
+
* @example {10ms} PH2
|
|
410
|
+
*/
|
|
411
|
+
sAtSParentheses: '{PH1} (at {PH2})',
|
|
412
|
+
/**
|
|
413
|
+
* @description Text of a DOM element in Timeline UIUtils of the Performance panel
|
|
414
|
+
*/
|
|
415
|
+
UnknownNode: '[ unknown node ]',
|
|
416
|
+
/**
|
|
417
|
+
* @description Text used to refer to a particular element and the file it was referred to in.
|
|
418
|
+
* @example {node} PH1
|
|
419
|
+
* @example {app.js} PH2
|
|
420
|
+
*/
|
|
421
|
+
invalidationWithCallFrame: '{PH1} at {PH2}',
|
|
422
|
+
/**
|
|
423
|
+
* @description Text indicating that something is outside of the Performace Panel Timeline Minimap range
|
|
424
|
+
*/
|
|
425
|
+
outsideBreadcrumbRange: '(outside of the breadcrumb range)',
|
|
426
|
+
/**
|
|
427
|
+
* @description Text indicating that something is hidden from the Performace Panel Timeline
|
|
428
|
+
*/
|
|
429
|
+
entryIsHidden: '(entry is hidden)',
|
|
430
|
+
/**
|
|
431
|
+
* @description Title of a row in the details view for a `Recalculate Styles` event that contains more info about selector stats tracing.
|
|
432
|
+
*/
|
|
433
|
+
selectorStatsTitle: 'Selector stats',
|
|
434
|
+
/**
|
|
435
|
+
* @description Info text that explains to the user how to enable selector stats tracing.
|
|
436
|
+
* @example {Setting Name} PH1
|
|
437
|
+
*/
|
|
438
|
+
sSelectorStatsInfo: 'Select "{PH1}" to collect detailed CSS selector matching statistics.',
|
|
439
|
+
/**
|
|
440
|
+
* @description Label for a numeric value that was how long to wait before a function was run.
|
|
441
|
+
*/
|
|
442
|
+
delay: 'Delay',
|
|
443
|
+
/**
|
|
444
|
+
* @description Label for a string that describes the priority at which a task was scheduled, like 'background' for low-priority tasks, and 'user-blocking' for high priority.
|
|
445
|
+
*/
|
|
446
|
+
priority: 'Priority',
|
|
447
|
+
/**
|
|
448
|
+
* @description Label for third party table.
|
|
449
|
+
*/
|
|
450
|
+
thirdPartyTable: '1st / 3rd party table',
|
|
451
|
+
/**
|
|
452
|
+
* @description Label for the a source URL.
|
|
453
|
+
*/
|
|
454
|
+
source: 'Source',
|
|
455
|
+
/**
|
|
456
|
+
* @description Label for a URL origin.
|
|
457
|
+
*/
|
|
458
|
+
origin: 'Origin',
|
|
459
|
+
} as const;
|
|
460
|
+
const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelineUIUtils.ts', UIStrings);
|
|
461
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
462
|
+
|
|
463
|
+
/** Look for scheme:// plus text and exclude any punctuation at the end. **/
|
|
464
|
+
export const URL_REGEX = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/)[^\s"]{2,}[^\s"'\)\}\],:;.!?]/u;
|
|
465
|
+
|
|
466
|
+
let eventDispatchDesciptors: EventDispatchTypeDescriptor[];
|
|
467
|
+
|
|
468
|
+
let colorGenerator: Common.Color.Generator;
|
|
469
|
+
|
|
470
|
+
type TimeRangeCategoryStats = Record<string, number>;
|
|
471
|
+
|
|
472
|
+
const {SamplesIntegrator} = Trace.Helpers.SamplesIntegrator;
|
|
473
|
+
|
|
474
|
+
export class TimelineUIUtils {
|
|
475
|
+
/**
|
|
476
|
+
* use getGetDebugModeEnabled() to query this variable.
|
|
477
|
+
*/
|
|
478
|
+
static debugModeEnabled: boolean|undefined = undefined;
|
|
479
|
+
static getGetDebugModeEnabled(): boolean {
|
|
480
|
+
if (TimelineUIUtils.debugModeEnabled === undefined) {
|
|
481
|
+
TimelineUIUtils.debugModeEnabled =
|
|
482
|
+
Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.TIMELINE_DEBUG_MODE);
|
|
483
|
+
}
|
|
484
|
+
return TimelineUIUtils.debugModeEnabled;
|
|
485
|
+
}
|
|
486
|
+
static frameDisplayName(frame: Protocol.Runtime.CallFrame): string {
|
|
487
|
+
const maybeResolvedData = SourceMapsResolver.SourceMapsResolver.resolvedCodeLocationForCallFrame(frame);
|
|
488
|
+
const functionName = maybeResolvedData?.name || frame.functionName;
|
|
489
|
+
const nativeGroup = SamplesIntegrator.nativeGroup(functionName);
|
|
490
|
+
switch (nativeGroup) {
|
|
491
|
+
case SamplesIntegrator.NativeGroups.COMPILE:
|
|
492
|
+
return i18nString(UIStrings.compile);
|
|
493
|
+
case SamplesIntegrator.NativeGroups.PARSE:
|
|
494
|
+
return i18nString(UIStrings.parse);
|
|
495
|
+
}
|
|
496
|
+
return functionName;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
static testContentMatching(
|
|
500
|
+
traceEvent: Trace.Types.Events.Event, regExp: RegExp, handlerData?: Trace.Handlers.Types.HandlerData): boolean {
|
|
501
|
+
const title = TimelineUIUtils.eventStyle(traceEvent).title;
|
|
502
|
+
const tokens = [title];
|
|
503
|
+
|
|
504
|
+
if (Trace.Types.Events.isProfileCall(traceEvent)) {
|
|
505
|
+
// In the future this case will not be possible - wherever we call this
|
|
506
|
+
// function we will be able to pass in the data from the new engine. But
|
|
507
|
+
// currently this is called in a variety of places including from the
|
|
508
|
+
// legacy model which does not have a reference to the new engine's data.
|
|
509
|
+
// So if we are missing the data, we just fallback to the name from the
|
|
510
|
+
// callFrame.
|
|
511
|
+
if (!handlerData?.Samples) {
|
|
512
|
+
tokens.push(traceEvent.callFrame.functionName);
|
|
513
|
+
} else {
|
|
514
|
+
tokens.push(Trace.Handlers.ModelHandlers.Samples.getProfileCallFunctionName(handlerData.Samples, traceEvent));
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (handlerData) {
|
|
518
|
+
const url = Trace.Handlers.Helpers.getNonResolvedURL(traceEvent, handlerData);
|
|
519
|
+
if (url) {
|
|
520
|
+
tokens.push(url);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (TimelineUIUtils.getGetDebugModeEnabled()) {
|
|
524
|
+
// When in debug mode append top level properties (like timestamp)
|
|
525
|
+
// and deeply nested properties.
|
|
526
|
+
appendObjectProperties(traceEvent as unknown as ContentObject, 4);
|
|
527
|
+
} else {
|
|
528
|
+
appendObjectProperties(traceEvent.args as ContentObject, 2);
|
|
529
|
+
}
|
|
530
|
+
const result = tokens.join('|').match(regExp);
|
|
531
|
+
return result ? result.length > 0 : false;
|
|
532
|
+
|
|
533
|
+
interface ContentObject {
|
|
534
|
+
[x: string]: number|string|ContentObject;
|
|
535
|
+
}
|
|
536
|
+
function appendObjectProperties(object: ContentObject, depth: number): void {
|
|
537
|
+
if (!depth) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
for (const key in object) {
|
|
541
|
+
const value = object[key];
|
|
542
|
+
if (typeof value === 'string') {
|
|
543
|
+
tokens.push(value);
|
|
544
|
+
} else if (typeof value === 'number') {
|
|
545
|
+
tokens.push(String(value));
|
|
546
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
547
|
+
appendObjectProperties(value, depth - 1);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
static eventStyle(event: Trace.Types.Events.Event): Trace.Styles.TimelineRecordStyle {
|
|
554
|
+
if (Trace.Types.Events.isProfileCall(event) && event.callFrame.functionName === '(idle)') {
|
|
555
|
+
return new Trace.Styles.TimelineRecordStyle(event.name, Trace.Styles.getCategoryStyles().idle);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (event.cat === Trace.Types.Events.Categories.Console || event.cat === Trace.Types.Events.Categories.UserTiming) {
|
|
559
|
+
return new Trace.Styles.TimelineRecordStyle(event.name, Trace.Styles.getCategoryStyles()['scripting']);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return Trace.Styles.getEventStyle(event.name as Trace.Types.Events.Name) ??
|
|
563
|
+
new Trace.Styles.TimelineRecordStyle(event.name, Trace.Styles.getCategoryStyles().other);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
static eventColor(event: Trace.Types.Events.Event): string {
|
|
567
|
+
if (Trace.Types.Events.isProfileCall(event)) {
|
|
568
|
+
const frame = event.callFrame;
|
|
569
|
+
if (TimelineUIUtils.isUserFrame(frame)) {
|
|
570
|
+
// TODO(andoli): This should use the resolved (sourcemapped) URL
|
|
571
|
+
return TimelineUIUtils.colorForId(frame.url);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (Trace.Types.Extensions.isSyntheticExtensionEntry(event)) {
|
|
575
|
+
return Extensions.ExtensionUI.extensionEntryColor(event);
|
|
576
|
+
}
|
|
577
|
+
const themeSupport = ThemeSupport.ThemeSupport.instance();
|
|
578
|
+
let parsedColor = themeSupport.getComputedValue(TimelineUIUtils.eventStyle(event).category.cssVariable);
|
|
579
|
+
// This event is considered idle time but still rendered as a scripting event here
|
|
580
|
+
// to connect the StreamingCompileScriptParsing events it belongs to.
|
|
581
|
+
if (event.name === Trace.Types.Events.Name.STREAMING_COMPILE_SCRIPT_WAITING) {
|
|
582
|
+
parsedColor = themeSupport.getComputedValue(Trace.Styles.getCategoryStyles().scripting.cssVariable);
|
|
583
|
+
if (!parsedColor) {
|
|
584
|
+
throw new Error('Unable to parse color from getCategoryStyles().scripting.color');
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return parsedColor;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
static eventTitle(event: Trace.Types.Events.Event): string {
|
|
591
|
+
// Profile call events do not have a args.data property, thus, we
|
|
592
|
+
// need to check for profile calls in the beginning of this
|
|
593
|
+
// function.
|
|
594
|
+
if (Trace.Types.Events.isProfileCall(event)) {
|
|
595
|
+
const maybeResolvedData = SourceMapsResolver.SourceMapsResolver.resolvedCodeLocationForEntry(event);
|
|
596
|
+
const displayName = maybeResolvedData?.name || TimelineUIUtils.frameDisplayName(event.callFrame);
|
|
597
|
+
return displayName;
|
|
598
|
+
}
|
|
599
|
+
if (event.name === 'EventTiming' && Trace.Types.Events.isSyntheticInteraction(event)) {
|
|
600
|
+
// TODO(crbug.com/365047728): replace this entire method with this call.
|
|
601
|
+
return Trace.Name.forEntry(event);
|
|
602
|
+
}
|
|
603
|
+
const title = TimelineUIUtils.eventStyle(event).title;
|
|
604
|
+
if (Trace.Helpers.Trace.eventHasCategory(event, Trace.Types.Events.Categories.Console)) {
|
|
605
|
+
return title;
|
|
606
|
+
}
|
|
607
|
+
if (Trace.Types.Events.isConsoleTimeStamp(event) && event.args.data) {
|
|
608
|
+
return i18nString(UIStrings.sS, {PH1: title, PH2: event.args.data.name ?? event.args.data.message});
|
|
609
|
+
}
|
|
610
|
+
if (Trace.Types.Events.isAnimation(event) && event.args.data.name) {
|
|
611
|
+
return i18nString(UIStrings.sS, {PH1: title, PH2: event.args.data.name});
|
|
612
|
+
}
|
|
613
|
+
if (Trace.Types.Events.isDispatch(event)) {
|
|
614
|
+
return i18nString(UIStrings.sS, {PH1: title, PH2: event.args.data.type});
|
|
615
|
+
}
|
|
616
|
+
return title;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
static isUserFrame(frame: Protocol.Runtime.CallFrame): boolean {
|
|
620
|
+
return frame.scriptId !== '0' && !(frame.url?.startsWith('native '));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
static statsForTimeRange(
|
|
624
|
+
events: Trace.Types.Events.Event[], startTime: Trace.Types.Timing.Milli,
|
|
625
|
+
endTime: Trace.Types.Timing.Milli): TimeRangeCategoryStats {
|
|
626
|
+
if (!events.length) {
|
|
627
|
+
return {idle: endTime - startTime};
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
buildRangeStatsCacheIfNeeded(events);
|
|
631
|
+
const aggregatedStats = subtractStats(aggregatedStatsAtTime(endTime), aggregatedStatsAtTime(startTime));
|
|
632
|
+
const aggregatedTotal = Object.values(aggregatedStats).reduce((a, b) => a + b, 0);
|
|
633
|
+
aggregatedStats['idle'] = Math.max(0, endTime - startTime - aggregatedTotal);
|
|
634
|
+
return aggregatedStats;
|
|
635
|
+
|
|
636
|
+
function aggregatedStatsAtTime(time: number): TimeRangeCategoryStats {
|
|
637
|
+
const stats: TimeRangeCategoryStats = {};
|
|
638
|
+
// @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
|
|
639
|
+
const cache = events[categoryBreakdownCacheSymbol];
|
|
640
|
+
for (const category in cache) {
|
|
641
|
+
const categoryCache = cache[category];
|
|
642
|
+
const index =
|
|
643
|
+
Platform.ArrayUtilities.upperBound(categoryCache.time, time, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
644
|
+
let value;
|
|
645
|
+
if (index === 0) {
|
|
646
|
+
value = 0;
|
|
647
|
+
} else if (index === categoryCache.time.length) {
|
|
648
|
+
value = categoryCache.value[categoryCache.value.length - 1];
|
|
649
|
+
} else {
|
|
650
|
+
const t0 = categoryCache.time[index - 1];
|
|
651
|
+
const t1 = categoryCache.time[index];
|
|
652
|
+
const v0 = categoryCache.value[index - 1];
|
|
653
|
+
const v1 = categoryCache.value[index];
|
|
654
|
+
value = v0 + (v1 - v0) * (time - t0) / (t1 - t0);
|
|
655
|
+
}
|
|
656
|
+
stats[category] = value;
|
|
657
|
+
}
|
|
658
|
+
return stats;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function subtractStats(a: TimeRangeCategoryStats, b: TimeRangeCategoryStats): TimeRangeCategoryStats {
|
|
662
|
+
const result = Object.assign({}, a);
|
|
663
|
+
for (const key in b) {
|
|
664
|
+
result[key] -= b[key];
|
|
665
|
+
}
|
|
666
|
+
return result;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function buildRangeStatsCacheIfNeeded(events: Trace.Types.Events.Event[]): void {
|
|
670
|
+
// @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
|
|
671
|
+
if (events[categoryBreakdownCacheSymbol]) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// aggregatedStats is a map by categories. For each category there's an array
|
|
676
|
+
// containing sorted time points which records accumulated value of the category.
|
|
677
|
+
const aggregatedStats: Record<string, {
|
|
678
|
+
time: number[],
|
|
679
|
+
value: number[],
|
|
680
|
+
}> = {};
|
|
681
|
+
const categoryStack: string[] = [];
|
|
682
|
+
let lastTime = 0;
|
|
683
|
+
Trace.Helpers.Trace.forEachEvent(events, {
|
|
684
|
+
onStartEvent,
|
|
685
|
+
onEndEvent,
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
function updateCategory(category: string, time: number): void {
|
|
689
|
+
let statsArrays: {
|
|
690
|
+
time: number[],
|
|
691
|
+
value: number[],
|
|
692
|
+
} = aggregatedStats[category];
|
|
693
|
+
if (!statsArrays) {
|
|
694
|
+
statsArrays = {time: [], value: []};
|
|
695
|
+
aggregatedStats[category] = statsArrays;
|
|
696
|
+
}
|
|
697
|
+
if (statsArrays.time.length && statsArrays.time[statsArrays.time.length - 1] === time || lastTime > time) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
const lastValue = statsArrays.value.length > 0 ? statsArrays.value[statsArrays.value.length - 1] : 0;
|
|
701
|
+
statsArrays.value.push(lastValue + time - lastTime);
|
|
702
|
+
statsArrays.time.push(time);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function categoryChange(from: string|null, to: string|null, time: number): void {
|
|
706
|
+
if (from) {
|
|
707
|
+
updateCategory(from, time);
|
|
708
|
+
}
|
|
709
|
+
lastTime = time;
|
|
710
|
+
if (to) {
|
|
711
|
+
updateCategory(to, time);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function onStartEvent(e: Trace.Types.Events.Event): void {
|
|
716
|
+
const {startTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(e);
|
|
717
|
+
const category = Trace.Styles.getEventStyle(e.name as Trace.Types.Events.Name)?.category.name ||
|
|
718
|
+
Trace.Styles.getCategoryStyles().other.name;
|
|
719
|
+
const parentCategory = categoryStack.length ? categoryStack[categoryStack.length - 1] : null;
|
|
720
|
+
if (category !== parentCategory) {
|
|
721
|
+
categoryChange(parentCategory || null, category, startTime);
|
|
722
|
+
}
|
|
723
|
+
categoryStack.push(category);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function onEndEvent(e: Trace.Types.Events.Event): void {
|
|
727
|
+
const {endTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(e);
|
|
728
|
+
const category = categoryStack.pop();
|
|
729
|
+
const parentCategory = categoryStack.length ? categoryStack[categoryStack.length - 1] : null;
|
|
730
|
+
if (category !== parentCategory) {
|
|
731
|
+
categoryChange(category || null, parentCategory || null, endTime || 0);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
const obj = (events as Object);
|
|
736
|
+
// @ts-expect-error TODO(crbug.com/1011811): Remove symbol usage.
|
|
737
|
+
obj[categoryBreakdownCacheSymbol] = aggregatedStats;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** Populates the passed object then returns true/false if it makes sense to show the pie chart */
|
|
742
|
+
private static aggregatedStatsForTraceEvent(
|
|
743
|
+
total: TimeRangeCategoryStats, parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
744
|
+
event: Trace.Types.Events.Event): boolean {
|
|
745
|
+
const node = parsedTrace.data.Renderer.entryToNode.get(event);
|
|
746
|
+
if (!node) {
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// If the event has no children, we cannot calculate a pie chart.
|
|
751
|
+
if (node.children.length === 0) {
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
const childNodesToVisit: Trace.Helpers.TreeHelpers.TraceEntryNode[] = [...node.children];
|
|
756
|
+
|
|
757
|
+
while (childNodesToVisit.length) {
|
|
758
|
+
// Traversal order doesn't matter, pop() is more efficient than shift().
|
|
759
|
+
const childNode = childNodesToVisit.pop();
|
|
760
|
+
if (!childNode) {
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
const childSelfTime = childNode.selfTime ?? 0;
|
|
764
|
+
if (childSelfTime > 0) {
|
|
765
|
+
const categoryName = TimelineUIUtils.eventStyle(childNode.entry).category.name;
|
|
766
|
+
total[categoryName] = (total[categoryName] || 0) + childSelfTime;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
childNodesToVisit.push(...childNode.children);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
if (Trace.Types.Events.isPhaseAsync(event.ph)) {
|
|
773
|
+
let aggregatedTotal = 0;
|
|
774
|
+
for (const categoryName in total) {
|
|
775
|
+
aggregatedTotal += total[categoryName];
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
const {startTime, endTime} = Trace.Helpers.Timing.eventTimingsMicroSeconds(event);
|
|
779
|
+
const deltaInMicro = (endTime - startTime) as Trace.Types.Timing.Micro;
|
|
780
|
+
total['idle'] = Math.max(0, deltaInMicro - aggregatedTotal);
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
for (const categoryName in total) {
|
|
785
|
+
const value = total[categoryName] as Trace.Types.Timing.Micro;
|
|
786
|
+
// Up until now we've kept the math all in micro integers. Finally switch these sums to milli.
|
|
787
|
+
total[categoryName] = Trace.Helpers.Timing.microToMilli(value);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
static createEventDivider(event: Trace.Types.Events.Event, zeroTime: number): HTMLDivElement {
|
|
794
|
+
const eventDivider = document.createElement('div');
|
|
795
|
+
eventDivider.classList.add('resources-event-divider');
|
|
796
|
+
const {startTime: eventStartTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(event);
|
|
797
|
+
|
|
798
|
+
const startTime = i18n.TimeUtilities.millisToString(eventStartTime - zeroTime);
|
|
799
|
+
const style = TimelineUIUtils.markerStyleForEvent(event);
|
|
800
|
+
if (style.tall) {
|
|
801
|
+
eventDivider.style.backgroundColor = style.color;
|
|
802
|
+
}
|
|
803
|
+
return eventDivider;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
static visibleEventsFilter(): Trace.Extras.TraceFilter.TraceFilter {
|
|
807
|
+
return new Trace.Extras.TraceFilter.VisibleEventsFilter(Trace.Styles.visibleTypes());
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Included only for layout tests.
|
|
811
|
+
// TODO(crbug.com/1386091): Fix/port layout tests and remove.
|
|
812
|
+
static categories(): Trace.Styles.CategoryPalette {
|
|
813
|
+
return Trace.Styles.getCategoryStyles();
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
static frameDuration(frame: Trace.Types.Events.LegacyTimelineFrame): Element {
|
|
817
|
+
const offsetMilli = Trace.Helpers.Timing.microToMilli(frame.startTimeOffset);
|
|
818
|
+
const durationMilli = Trace.Helpers.Timing.microToMilli(Trace.Types.Timing.Micro(frame.endTime - frame.startTime));
|
|
819
|
+
|
|
820
|
+
const durationText = i18nString(UIStrings.sAtSParentheses, {
|
|
821
|
+
PH1: i18n.TimeUtilities.millisToString(durationMilli, true),
|
|
822
|
+
PH2: i18n.TimeUtilities.millisToString(offsetMilli, true),
|
|
823
|
+
});
|
|
824
|
+
return i18n.i18n.getFormatLocalizedString(str_, UIStrings.emptyPlaceholder, {PH1: durationText});
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
static quadWidth(quad: number[]): number {
|
|
828
|
+
return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
static quadHeight(quad: number[]): number {
|
|
832
|
+
return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1] - quad[7], 2)));
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
static eventDispatchDesciptors(): EventDispatchTypeDescriptor[] {
|
|
836
|
+
if (eventDispatchDesciptors) {
|
|
837
|
+
return eventDispatchDesciptors;
|
|
838
|
+
}
|
|
839
|
+
const lightOrange = 'hsl(40,100%,80%)';
|
|
840
|
+
const orange = 'hsl(40,100%,50%)';
|
|
841
|
+
const green = 'hsl(90,100%,40%)';
|
|
842
|
+
const purple = 'hsl(256,100%,75%)';
|
|
843
|
+
eventDispatchDesciptors = [
|
|
844
|
+
new EventDispatchTypeDescriptor(
|
|
845
|
+
1, lightOrange, ['mousemove', 'mouseenter', 'mouseleave', 'mouseout', 'mouseover']),
|
|
846
|
+
new EventDispatchTypeDescriptor(
|
|
847
|
+
1, lightOrange, ['pointerover', 'pointerout', 'pointerenter', 'pointerleave', 'pointermove']),
|
|
848
|
+
new EventDispatchTypeDescriptor(2, green, ['wheel']),
|
|
849
|
+
new EventDispatchTypeDescriptor(3, orange, ['click', 'mousedown', 'mouseup']),
|
|
850
|
+
new EventDispatchTypeDescriptor(3, orange, ['touchstart', 'touchend', 'touchmove', 'touchcancel']),
|
|
851
|
+
new EventDispatchTypeDescriptor(
|
|
852
|
+
3, orange, ['pointerdown', 'pointerup', 'pointercancel', 'gotpointercapture', 'lostpointercapture']),
|
|
853
|
+
new EventDispatchTypeDescriptor(3, purple, ['keydown', 'keyup', 'keypress']),
|
|
854
|
+
];
|
|
855
|
+
return eventDispatchDesciptors;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
static markerStyleForEvent(event: Trace.Types.Events.Event): TimelineMarkerStyle {
|
|
859
|
+
// Note: keep the colors matching that of `markerDetailsForEvent`.
|
|
860
|
+
|
|
861
|
+
const tallMarkerDashStyle = [6, 4];
|
|
862
|
+
const title = TimelineUIUtils.eventTitle(event);
|
|
863
|
+
|
|
864
|
+
if (event.name !== Trace.Types.Events.Name.NAVIGATION_START &&
|
|
865
|
+
(Trace.Helpers.Trace.eventHasCategory(event, Trace.Types.Events.Categories.Console) ||
|
|
866
|
+
Trace.Helpers.Trace.eventHasCategory(event, Trace.Types.Events.Categories.UserTiming))) {
|
|
867
|
+
return {
|
|
868
|
+
title,
|
|
869
|
+
dashStyle: tallMarkerDashStyle,
|
|
870
|
+
lineWidth: 0.5,
|
|
871
|
+
color: Trace.Helpers.Trace.eventHasCategory(event, Trace.Types.Events.Categories.Console) ? 'purple' : 'orange',
|
|
872
|
+
tall: false,
|
|
873
|
+
lowPriority: false,
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
let tall = false;
|
|
877
|
+
let color = 'grey';
|
|
878
|
+
switch (event.name) {
|
|
879
|
+
case Trace.Types.Events.Name.NAVIGATION_START:
|
|
880
|
+
color = 'var(--color-text-primary)';
|
|
881
|
+
tall = true;
|
|
882
|
+
break;
|
|
883
|
+
case Trace.Types.Events.Name.FRAME_STARTED_LOADING:
|
|
884
|
+
color = 'green';
|
|
885
|
+
tall = true;
|
|
886
|
+
break;
|
|
887
|
+
case Trace.Types.Events.Name.MARK_DOM_CONTENT:
|
|
888
|
+
color = 'var(--color-text-disabled)';
|
|
889
|
+
tall = true;
|
|
890
|
+
break;
|
|
891
|
+
case Trace.Types.Events.Name.MARK_LOAD:
|
|
892
|
+
color = 'var(--color-text-disabled)';
|
|
893
|
+
tall = true;
|
|
894
|
+
break;
|
|
895
|
+
case Trace.Types.Events.Name.MARK_FIRST_PAINT:
|
|
896
|
+
color = '#228847';
|
|
897
|
+
tall = true;
|
|
898
|
+
break;
|
|
899
|
+
case Trace.Types.Events.Name.MARK_FCP:
|
|
900
|
+
color = 'var(--sys-color-green-bright)';
|
|
901
|
+
tall = true;
|
|
902
|
+
break;
|
|
903
|
+
case Trace.Types.Events.Name.MARK_LCP_CANDIDATE:
|
|
904
|
+
color = 'var(--sys-color-green)';
|
|
905
|
+
tall = true;
|
|
906
|
+
break;
|
|
907
|
+
case Trace.Types.Events.Name.TIME_STAMP:
|
|
908
|
+
color = 'orange';
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
return {
|
|
912
|
+
title,
|
|
913
|
+
dashStyle: tallMarkerDashStyle,
|
|
914
|
+
lineWidth: 0.5,
|
|
915
|
+
color,
|
|
916
|
+
tall,
|
|
917
|
+
lowPriority: false,
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
static colorForId(id: string): string {
|
|
922
|
+
if (!colorGenerator) {
|
|
923
|
+
colorGenerator =
|
|
924
|
+
new Common.Color.Generator({min: 30, max: 330, count: undefined}, {min: 50, max: 80, count: 3}, 85);
|
|
925
|
+
colorGenerator.setColorForID('', '#f2ecdc');
|
|
926
|
+
}
|
|
927
|
+
return colorGenerator.colorForID(id);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
static displayNameForFrame(frame: Trace.Types.Events.TraceFrame, trimAt = 80): string {
|
|
931
|
+
const url = frame.url as Platform.DevToolsPath.UrlString;
|
|
932
|
+
return Common.ParsedURL.schemeIs(url, 'about:') ? `"${Platform.StringUtilities.trimMiddle(frame.name, trimAt)}"` :
|
|
933
|
+
frame.url.slice(0, trimAt);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
export const aggregatedStatsKey = Symbol('aggregatedStats');
|
|
938
|
+
|
|
939
|
+
export const previewElementSymbol = Symbol('previewElement');
|
|
940
|
+
|
|
941
|
+
export class EventDispatchTypeDescriptor {
|
|
942
|
+
priority: number;
|
|
943
|
+
color: string;
|
|
944
|
+
eventTypes: string[];
|
|
945
|
+
|
|
946
|
+
constructor(priority: number, color: string, eventTypes: string[]) {
|
|
947
|
+
this.priority = priority;
|
|
948
|
+
this.color = color;
|
|
949
|
+
this.eventTypes = eventTypes;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
export const categoryBreakdownCacheSymbol = Symbol('categoryBreakdownCache');
|
|
954
|
+
export interface TimelineMarkerStyle {
|
|
955
|
+
title: string;
|
|
956
|
+
color: string;
|
|
957
|
+
lineWidth: number;
|
|
958
|
+
dashStyle: number[];
|
|
959
|
+
tall: boolean;
|
|
960
|
+
lowPriority: boolean;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Given a particular event, this method can adjust its timestamp by
|
|
965
|
+
* substracting the timestamp of the previous navigation. This helps in cases
|
|
966
|
+
* where the user has navigated multiple times in the trace, so that we can show
|
|
967
|
+
* the LCP (for example) relative to the last navigation.
|
|
968
|
+
**/
|
|
969
|
+
export function timeStampForEventAdjustedForClosestNavigationIfPossible(
|
|
970
|
+
event: Trace.Types.Events.Event, parsedTrace: Trace.TraceModel.ParsedTrace|null): Trace.Types.Timing.Milli {
|
|
971
|
+
if (!parsedTrace) {
|
|
972
|
+
const {startTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(event);
|
|
973
|
+
return startTime;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
const time = Trace.Helpers.Timing.timeStampForEventAdjustedByClosestNavigation(
|
|
977
|
+
event,
|
|
978
|
+
parsedTrace.data.Meta.traceBounds,
|
|
979
|
+
parsedTrace.data.Meta.navigationsByNavigationId,
|
|
980
|
+
parsedTrace.data.Meta.navigationsByFrameId,
|
|
981
|
+
);
|
|
982
|
+
return Trace.Helpers.Timing.microToMilli(time);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Determines if an event is potentially a marker event. A marker event here
|
|
987
|
+
* is a single moment in time that we want to highlight on the timeline, such as
|
|
988
|
+
* the LCP time. This method does not filter out events: for example, it treats
|
|
989
|
+
* every LCP Candidate event as a potential marker event.
|
|
990
|
+
**/
|
|
991
|
+
export function isMarkerEvent(parsedTrace: Trace.TraceModel.ParsedTrace, event: Trace.Types.Events.Event): boolean {
|
|
992
|
+
const {Name} = Trace.Types.Events;
|
|
993
|
+
|
|
994
|
+
if (event.name === Name.TIME_STAMP || event.name === Name.NAVIGATION_START) {
|
|
995
|
+
return true;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
if (Trace.Types.Events.isFirstContentfulPaint(event) || Trace.Types.Events.isFirstPaint(event)) {
|
|
999
|
+
return event.args.frame === parsedTrace.data.Meta.mainFrameId;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
if (Trace.Types.Events.isMarkDOMContent(event) || Trace.Types.Events.isMarkLoad(event) ||
|
|
1003
|
+
Trace.Types.Events.isLargestContentfulPaintCandidate(event)) {
|
|
1004
|
+
// isOutermostMainFrame was added in 2022, so we fallback to isMainFrame
|
|
1005
|
+
// for older traces.
|
|
1006
|
+
if (!event.args.data) {
|
|
1007
|
+
return false;
|
|
1008
|
+
}
|
|
1009
|
+
const {isOutermostMainFrame, isMainFrame} = event.args.data;
|
|
1010
|
+
if (typeof isOutermostMainFrame !== 'undefined') {
|
|
1011
|
+
// If isOutermostMainFrame is defined we want to use that and not
|
|
1012
|
+
// fallback to isMainFrame, even if isOutermostMainFrame is false. Hence
|
|
1013
|
+
// this check.
|
|
1014
|
+
return isOutermostMainFrame;
|
|
1015
|
+
}
|
|
1016
|
+
return Boolean(isMainFrame);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
function getEventSelfTime(
|
|
1023
|
+
event: Trace.Types.Events.Event, parsedTrace: Trace.TraceModel.ParsedTrace): Trace.Types.Timing.Micro {
|
|
1024
|
+
const mapToUse = Trace.Types.Extensions.isSyntheticExtensionEntry(event) ?
|
|
1025
|
+
parsedTrace.data.ExtensionTraceData.entryToNode :
|
|
1026
|
+
parsedTrace.data.Renderer.entryToNode;
|
|
1027
|
+
const selfTime = mapToUse.get(event)?.selfTime;
|
|
1028
|
+
return selfTime ? selfTime : Trace.Types.Timing.Micro(0);
|
|
1029
|
+
}
|