Skip to content

Commit ebadb9e

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
Tracing: move debug logger to TimelinePanel
Makes more sense to do it here than make models/trace do it - especially as we want the trace engine usable in NodeJS and this code looks on `window`. [email protected] Bug: none Change-Id: Id572c1ff021eec67db860afd79bdb3df40559572 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6917686 Commit-Queue: Alex Rudenko <[email protected]> Auto-Submit: Jack Franklin <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent 18e272b commit ebadb9e

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

front_end/models/trace/ModelImpl.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,6 @@ export class Model extends EventTarget {
118118
metadata,
119119
resolveSourceMap: config?.resolveSourceMap,
120120
};
121-
if (!parseConfig.logger &&
122-
(window.location.href.includes('devtools/bundled') || window.location.search.includes('debugFrontend'))) {
123-
// Someone is debugging DevTools, enable the logger.
124-
const times: Record<string, number> = {};
125-
parseConfig.logger = {
126-
start(id) {
127-
times[id] = performance.now();
128-
},
129-
end(id) {
130-
performance.measure(id, {start: times[id]});
131-
},
132-
};
133-
}
134121
await this.#processor.parse(traceEvents, parseConfig);
135122
this.#storeParsedFileData(file, this.#processor.parsedTrace, this.#processor.insights);
136123
// We only push the file onto this.#traces here once we know it's valid

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,14 +2733,27 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
27332733
async #executeNewTrace(
27342734
collectedEvents: Trace.Types.Events.Event[], isFreshRecording: boolean,
27352735
metadata: Trace.Types.File.MetaData|null): Promise<void> {
2736-
await this.#traceEngineModel.parse(
2737-
collectedEvents,
2738-
{
2739-
metadata: metadata ?? undefined,
2740-
isFreshRecording,
2741-
resolveSourceMap: this.#createSourceMapResolver(isFreshRecording, metadata),
2736+
const config: Trace.Types.Configuration.ParseOptions = {
2737+
metadata: metadata ?? undefined,
2738+
isFreshRecording,
2739+
resolveSourceMap: this.#createSourceMapResolver(isFreshRecording, metadata),
2740+
};
2741+
2742+
if (window.location.href.includes('devtools/bundled') || window.location.search.includes('debugFrontend')) {
2743+
// Someone is debugging DevTools, enable the logger to give timings
2744+
// when tracing the performance panel itself.
2745+
const times: Record<string, number> = {};
2746+
config.logger = {
2747+
start(id) {
2748+
times[id] = performance.now();
27422749
},
2743-
);
2750+
end(id) {
2751+
performance.measure(id, {start: times[id]});
2752+
},
2753+
};
2754+
}
2755+
2756+
await this.#traceEngineModel.parse(collectedEvents, config);
27442757

27452758
// Store all source maps on the trace metadata.
27462759
// If not fresh, we can't validate the maps are still accurate.

0 commit comments

Comments
 (0)