Skip to content

Commit b97f3e7

Browse files
rubennortefacebook-github-bot
authored andcommitted
Move Web performance APIs to private directory (facebook#42769)
Summary: Pull Request resolved: facebook#42769 Changelog: [internal] These APIs are not currently enabled in OSS, so moving the modules should be safe and not considered a breaking change. Reviewed By: NickGerleman Differential Revision: D53267565 fbshipit-source-id: edd3daa7c5043e44e5fd4b1af074093ed3ef4152
1 parent a68ae2e commit b97f3e7

32 files changed

+10
-266
lines changed

packages/react-native/Libraries/Core/setUpPerformance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* @format
99
*/
1010

11-
import NativePerformance from '../WebPerformance/NativePerformance';
12-
import Performance from '../WebPerformance/Performance';
11+
import NativePerformance from '../../src/private/webapis/performance/NativePerformance';
12+
import Performance from '../../src/private/webapis/performance/Performance';
1313

1414
// In case if the native implementation of the Performance API is available, use it,
1515
// otherwise fall back to the legacy/default one, which only defines 'Performance.now()'

packages/react-native/Libraries/Core/setUpPerformanceObserver.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ import {polyfillGlobal} from '../Utilities/PolyfillFunctions';
1212

1313
polyfillGlobal(
1414
'PerformanceObserver',
15-
() => require('../WebPerformance/PerformanceObserver').default,
15+
() =>
16+
require('../../src/private/webapis/performance/PerformanceObserver')
17+
.default,
1618
);

packages/react-native/Libraries/WebPerformance/NativePerformance.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/react-native/Libraries/WebPerformance/NativePerformanceObserver.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 0 additions & 232 deletions
Original file line numberDiff line numberDiff line change
@@ -8914,238 +8914,6 @@ declare module.exports: Vibration;
89148914
"
89158915
`;
89168916

8917-
exports[`public API should not change unintentionally Libraries/WebPerformance/EventCounts.js 1`] = `
8918-
"type EventCountsForEachCallbackType =
8919-
| (() => void)
8920-
| ((value: number) => void)
8921-
| ((value: number, key: string) => void)
8922-
| ((value: number, key: string, map: Map<string, number>) => void);
8923-
declare export default class EventCounts {
8924-
get size(): number;
8925-
entries(): Iterator<[string, number]>;
8926-
forEach(callback: EventCountsForEachCallbackType): void;
8927-
get(key: string): ?number;
8928-
has(key: string): boolean;
8929-
keys(): Iterator<string>;
8930-
values(): Iterator<number>;
8931-
}
8932-
"
8933-
`;
8934-
8935-
exports[`public API should not change unintentionally Libraries/WebPerformance/MemoryInfo.js 1`] = `
8936-
"type MemoryInfoLike = {
8937-
jsHeapSizeLimit: ?number,
8938-
totalJSHeapSize: ?number,
8939-
usedJSHeapSize: ?number,
8940-
};
8941-
declare export default class MemoryInfo {
8942-
_jsHeapSizeLimit: ?number;
8943-
_totalJSHeapSize: ?number;
8944-
_usedJSHeapSize: ?number;
8945-
constructor(memoryInfo: ?MemoryInfoLike): void;
8946-
get jsHeapSizeLimit(): ?number;
8947-
get totalJSHeapSize(): ?number;
8948-
get usedJSHeapSize(): ?number;
8949-
}
8950-
"
8951-
`;
8952-
8953-
exports[`public API should not change unintentionally Libraries/WebPerformance/NativePerformance.js 1`] = `
8954-
"export * from \\"../../src/private/specs/modules/NativePerformance\\";
8955-
declare export default typeof NativePerformance;
8956-
"
8957-
`;
8958-
8959-
exports[`public API should not change unintentionally Libraries/WebPerformance/NativePerformanceObserver.js 1`] = `
8960-
"export * from \\"../../src/private/specs/modules/NativePerformanceObserver\\";
8961-
declare export default typeof NativePerformanceObserver;
8962-
"
8963-
`;
8964-
8965-
exports[`public API should not change unintentionally Libraries/WebPerformance/Performance.js 1`] = `
8966-
"type DetailType = mixed;
8967-
export type PerformanceMarkOptions = {
8968-
detail?: DetailType,
8969-
startTime?: HighResTimeStamp,
8970-
};
8971-
declare export class PerformanceMark extends PerformanceEntry {
8972-
detail: DetailType;
8973-
constructor(markName: string, markOptions?: PerformanceMarkOptions): void;
8974-
}
8975-
export type TimeStampOrName = HighResTimeStamp | string;
8976-
export type PerformanceMeasureOptions = {
8977-
detail?: DetailType,
8978-
start?: TimeStampOrName,
8979-
end?: TimeStampOrName,
8980-
duration?: HighResTimeStamp,
8981-
};
8982-
declare export class PerformanceMeasure extends PerformanceEntry {
8983-
detail: DetailType;
8984-
constructor(
8985-
measureName: string,
8986-
measureOptions?: PerformanceMeasureOptions
8987-
): void;
8988-
}
8989-
declare export default class Performance {
8990-
eventCounts: EventCounts;
8991-
get memory(): MemoryInfo;
8992-
get rnStartupTiming(): ReactNativeStartupTiming;
8993-
mark(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
8994-
clearMarks(markName?: string): void;
8995-
measure(
8996-
measureName: string,
8997-
startMarkOrOptions?: string | PerformanceMeasureOptions,
8998-
endMark?: string
8999-
): PerformanceMeasure;
9000-
clearMeasures(measureName?: string): void;
9001-
now(): HighResTimeStamp;
9002-
getEntries(): PerformanceEntryList;
9003-
getEntriesByType(entryType: PerformanceEntryType): PerformanceEntryList;
9004-
getEntriesByName(
9005-
entryName: string,
9006-
entryType?: PerformanceEntryType
9007-
): PerformanceEntryList;
9008-
}
9009-
"
9010-
`;
9011-
9012-
exports[`public API should not change unintentionally Libraries/WebPerformance/PerformanceEntry.js 1`] = `
9013-
"export type HighResTimeStamp = number;
9014-
export type PerformanceEntryType = \\"mark\\" | \\"measure\\" | \\"event\\";
9015-
export type PerformanceEntryJSON = {
9016-
name: string,
9017-
entryType: PerformanceEntryType,
9018-
startTime: HighResTimeStamp,
9019-
duration: HighResTimeStamp,
9020-
...
9021-
};
9022-
declare export const ALWAYS_LOGGED_ENTRY_TYPES: $ReadOnlyArray<PerformanceEntryType>;
9023-
declare export class PerformanceEntry {
9024-
name: string;
9025-
entryType: PerformanceEntryType;
9026-
startTime: HighResTimeStamp;
9027-
duration: HighResTimeStamp;
9028-
constructor(init: {
9029-
name: string,
9030-
entryType: PerformanceEntryType,
9031-
startTime: HighResTimeStamp,
9032-
duration: HighResTimeStamp,
9033-
}): void;
9034-
toJSON(): PerformanceEntryJSON;
9035-
}
9036-
"
9037-
`;
9038-
9039-
exports[`public API should not change unintentionally Libraries/WebPerformance/PerformanceEventTiming.js 1`] = `
9040-
"export type PerformanceEventTimingJSON = {
9041-
...PerformanceEntryJSON,
9042-
processingStart: HighResTimeStamp,
9043-
processingEnd: HighResTimeStamp,
9044-
interactionId: number,
9045-
...
9046-
};
9047-
declare export default class PerformanceEventTiming extends PerformanceEntry {
9048-
processingStart: HighResTimeStamp;
9049-
processingEnd: HighResTimeStamp;
9050-
interactionId: number;
9051-
constructor(init: {
9052-
name: string,
9053-
startTime?: HighResTimeStamp,
9054-
duration?: HighResTimeStamp,
9055-
processingStart?: HighResTimeStamp,
9056-
processingEnd?: HighResTimeStamp,
9057-
interactionId?: number,
9058-
}): void;
9059-
toJSON(): PerformanceEventTimingJSON;
9060-
}
9061-
"
9062-
`;
9063-
9064-
exports[`public API should not change unintentionally Libraries/WebPerformance/PerformanceObserver.js 1`] = `
9065-
"export type PerformanceEntryList = $ReadOnlyArray<PerformanceEntry>;
9066-
declare export class PerformanceObserverEntryList {
9067-
_entries: PerformanceEntryList;
9068-
constructor(entries: PerformanceEntryList): void;
9069-
getEntries(): PerformanceEntryList;
9070-
getEntriesByType(type: PerformanceEntryType): PerformanceEntryList;
9071-
getEntriesByName(
9072-
name: string,
9073-
type?: PerformanceEntryType
9074-
): PerformanceEntryList;
9075-
}
9076-
export type PerformanceObserverCallback = (
9077-
list: PerformanceObserverEntryList,
9078-
observer: PerformanceObserver,
9079-
droppedEntryCount?: number
9080-
) => void;
9081-
export type PerformanceObserverInit =
9082-
| {
9083-
entryTypes: Array<PerformanceEntryType>,
9084-
}
9085-
| {
9086-
type: PerformanceEntryType,
9087-
durationThreshold?: HighResTimeStamp,
9088-
};
9089-
declare export function warnNoNativePerformanceObserver(): void;
9090-
declare export default class PerformanceObserver {
9091-
_callback: PerformanceObserverCallback;
9092-
_type: \\"single\\" | \\"multiple\\" | void;
9093-
constructor(callback: PerformanceObserverCallback): void;
9094-
observe(options: PerformanceObserverInit): void;
9095-
disconnect(): void;
9096-
_validateObserveOptions(options: PerformanceObserverInit): void;
9097-
static supportedEntryTypes: $ReadOnlyArray<PerformanceEntryType>;
9098-
}
9099-
export { PerformanceEventTiming };
9100-
"
9101-
`;
9102-
9103-
exports[`public API should not change unintentionally Libraries/WebPerformance/RawPerformanceEntry.js 1`] = `
9104-
"declare export const RawPerformanceEntryTypeValues: {
9105-
UNDEFINED: 0,
9106-
MARK: 1,
9107-
MEASURE: 2,
9108-
EVENT: 3,
9109-
};
9110-
declare export function rawToPerformanceEntry(
9111-
entry: RawPerformanceEntry
9112-
): PerformanceEntry;
9113-
declare export function rawToPerformanceEntryType(
9114-
type: RawPerformanceEntryType
9115-
): PerformanceEntryType;
9116-
declare export function performanceEntryTypeToRaw(
9117-
type: PerformanceEntryType
9118-
): RawPerformanceEntryType;
9119-
"
9120-
`;
9121-
9122-
exports[`public API should not change unintentionally Libraries/WebPerformance/ReactNativeStartupTiming.js 1`] = `
9123-
"type ReactNativeStartupTimingLike = {
9124-
startTime: ?number,
9125-
endTime: ?number,
9126-
initializeRuntimeStart: ?number,
9127-
initializeRuntimeEnd: ?number,
9128-
executeJavaScriptBundleEntryPointStart: ?number,
9129-
executeJavaScriptBundleEntryPointEnd: ?number,
9130-
};
9131-
declare export default class ReactNativeStartupTiming {
9132-
_startTime: ?number;
9133-
_endTime: ?number;
9134-
_initializeRuntimeStart: ?number;
9135-
_initializeRuntimeEnd: ?number;
9136-
_executeJavaScriptBundleEntryPointStart: ?number;
9137-
_executeJavaScriptBundleEntryPointEnd: ?number;
9138-
constructor(startUpTiming: ?ReactNativeStartupTimingLike): void;
9139-
get startTime(): ?number;
9140-
get endTime(): ?number;
9141-
get initializeRuntimeStart(): ?number;
9142-
get initializeRuntimeEnd(): ?number;
9143-
get executeJavaScriptBundleEntryPointStart(): ?number;
9144-
get executeJavaScriptBundleEntryPointEnd(): ?number;
9145-
}
9146-
"
9147-
`;
9148-
91498917
exports[`public API should not change unintentionally Libraries/WebSocket/NativeWebSocketModule.js 1`] = `
91508918
"export * from \\"../../src/private/specs/modules/NativeWebSocketModule\\";
91518919
declare export default typeof NativeWebSocketModule;

0 commit comments

Comments
 (0)