Skip to content

Commit 6e249b3

Browse files
authored
Add experiment for enabling frames and screenshots (#212)
Adds back the frames track under an RN experiment.
1 parent e1dd7af commit 6e249b3

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

front_end/core/rn_experiments/experimentsImpl.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,10 @@ Instance.register({
184184
unstable: false,
185185
enabledByDefault: ({ isReactNativeEntryPoint }) => isReactNativeEntryPoint,
186186
});
187+
188+
Instance.register({
189+
name: RNExperimentName.ENABLE_TIMELINE_FRAMES,
190+
title: 'Enable performance frames track',
191+
unstable: true,
192+
enabledByDefault: () => globalThis.enableTimelineFrames ?? false,
193+
});

front_end/core/root/Runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ export const experiments = new ExperimentsSupport();
305305
export enum RNExperimentName {
306306
REACT_NATIVE_SPECIFIC_UI = 'react-native-specific-ui',
307307
JS_HEAP_PROFILER_ENABLE = 'js-heap-profiler-enable',
308+
ENABLE_TIMELINE_FRAMES = 'enable-timeline-frames',
308309
}
309310

310311
export enum ConditionName {
@@ -339,6 +340,7 @@ export const enum ExperimentName {
339340
JS_HEAP_PROFILER_ENABLE = RNExperimentName.JS_HEAP_PROFILER_ENABLE,
340341
REACT_NATIVE_SPECIFIC_UI = RNExperimentName.REACT_NATIVE_SPECIFIC_UI,
341342
NOT_REACT_NATIVE_SPECIFIC_UI = '!' + RNExperimentName.REACT_NATIVE_SPECIFIC_UI,
343+
ENABLE_TIMELINE_FRAMES = RNExperimentName.ENABLE_TIMELINE_FRAMES,
342344
}
343345

344346
export enum GenAiEnterprisePolicyValue {

front_end/global_typings/react_native.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ declare global {
1616
// eslint-disable-next-line no-var
1717
var enableDisplayingFullDisconnectedReason: boolean|undefined;
1818
// eslint-disable-next-line no-var
19+
var enableTimelineFrames: boolean|undefined;
20+
// eslint-disable-next-line no-var
1921
var reactNativeOpenInEditorButtonImage: string|undefined;
2022
// eslint-disable-next-line no-var,@typescript-eslint/naming-convention
2123
var FB_ONLY__reactNativeFeedbackLink: string|undefined;

front_end/panels/timeline/TimelineFlameChartDataProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
615615
// In CPU Profiles the trace data will not have frames nor
616616
// screenshots, so we can keep this call as it will be a no-op in
617617
// these cases.
618-
if (!this.isReactNative) {
618+
if (Root.Runtime.experiments.isEnabled(Root.Runtime.RNExperimentName.ENABLE_TIMELINE_FRAMES) || !this.isReactNative) {
619619
this.#appendFramesAndScreenshotsTrack();
620620
}
621621

front_end/testing/EnvironmentHelpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const REGISTERED_EXPERIMENTS = [
130130
Root.Runtime.ExperimentName.TIMELINE_ALTERNATIVE_NAVIGATION,
131131
Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI,
132132
Root.Runtime.ExperimentName.NOT_REACT_NATIVE_SPECIFIC_UI,
133+
Root.Runtime.ExperimentName.ENABLE_TIMELINE_FRAMES,
133134
];
134135

135136
export async function initializeGlobalVars({reset = true} = {}) {

0 commit comments

Comments
 (0)