Skip to content

Commit 95bd36c

Browse files
authored
feat: use application display name for trace title (#207)
1 parent 5a792db commit 95bd36c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

front_end/panels/timeline/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ devtools_module("timeline") {
104104
":easter-egg",
105105
"../../core/host:bundle",
106106
"../../core/i18n:bundle",
107+
"../../core/root:bundle",
107108
"../../generated:protocol",
108109
"../../models/cpu_profile:bundle",
109110
"../../models/extensions:bundle",

front_end/panels/timeline/TimelineHistoryManager.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import * as Common from '../../core/common/common.js';
66
import * as i18n from '../../core/i18n/i18n.js';
77
import * as Platform from '../../core/platform/platform.js';
8+
import * as Root from '../../core/root/root.js';
9+
import * as SDK from '../../core/sdk/sdk.js';
810
import * as Trace from '../../models/trace/trace.js';
911
import * as IconButton from '../../ui/components/icon_button/icon_button.js';
1012
import * as UI from '../../ui/legacy/legacy.js';
@@ -339,7 +341,14 @@ export class TimelineHistoryManager {
339341
parsedTraceIndex: number, parsedTrace: Trace.Handlers.Types.ParsedTrace, metadata: Trace.Types.File.MetaData|null,
340342
filmStrip: Trace.Extras.FilmStrip.Data|null): HTMLDivElement {
341343
const parsedURL = Common.ParsedURL.ParsedURL.fromString(parsedTrace.Meta.mainFrameURL);
342-
const domain = parsedURL ? parsedURL.host : '';
344+
let domain = parsedURL ? parsedURL.host : '';
345+
// [RN] React Native doesn't have a URL as a concept for Frame, we will use Application name as a fallback.
346+
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI)) {
347+
const reactNativeApplicationModel = SDK.TargetManager.TargetManager.instance().primaryPageTarget()?.model(SDK.ReactNativeApplicationModel.ReactNativeApplicationModel);
348+
if (reactNativeApplicationModel !== null && reactNativeApplicationModel !== undefined) {
349+
domain = reactNativeApplicationModel.metadataCached?.appDisplayName || '';
350+
}
351+
}
343352

344353
const sequenceNumber = this.nextNumberByDomain.get(domain) || 1;
345354
const titleWithSequenceNumber = i18nString(UIStrings.sD, {PH1: domain, PH2: sequenceNumber});

0 commit comments

Comments
 (0)