From ec89a86ef501b8370cb271f1bfc5f6ce245907c8 Mon Sep 17 00:00:00 2001 From: Ilia Vorobev Date: Mon, 29 Jan 2024 09:53:09 -0800 Subject: [PATCH] Removes QPL from github (#42641) Summary: This removes QPL from public github repo Changelog: [internal] Reviewed By: rubennorte Differential Revision: D53041914 --- .../Performance/QuickPerformanceLogger.js | 155 ------------------ .../__snapshots__/public-api-test.js.snap | 42 ----- 2 files changed, 197 deletions(-) delete mode 100644 packages/react-native/Libraries/Performance/QuickPerformanceLogger.js diff --git a/packages/react-native/Libraries/Performance/QuickPerformanceLogger.js b/packages/react-native/Libraries/Performance/QuickPerformanceLogger.js deleted file mode 100644 index d867b7ae2d5d67..00000000000000 --- a/packages/react-native/Libraries/Performance/QuickPerformanceLogger.js +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const AUTO_SET_TIMESTAMP = -1; -const DUMMY_INSTANCE_KEY = 0; - -// Defines map of annotations -// Use as following: -// {string: {key1: value1, key2: value2}} -export type AnnotationsMap = Partial<{ - string: ?{[string]: string, ...}, - int: ?{[string]: number, ...}, - double: ?{[string]: number, ...}, - bool: ?{[string]: boolean, ...}, - string_array: ?{[string]: $ReadOnlyArray, ...}, - int_array: ?{[string]: $ReadOnlyArray, ...}, - double_array: ?{[string]: $ReadOnlyArray, ...}, - bool_array: ?{[string]: $ReadOnlyArray, ...}, -}>; - -const QuickPerformanceLogger = { - markerStart( - markerId: number, - instanceKey: number = DUMMY_INSTANCE_KEY, - timestamp: number = AUTO_SET_TIMESTAMP, - ): void { - if (global.nativeQPLMarkerStart) { - global.nativeQPLMarkerStart(markerId, instanceKey, timestamp); - } - }, - - markerEnd( - markerId: number, - actionId: number, - instanceKey: number = DUMMY_INSTANCE_KEY, - timestamp: number = AUTO_SET_TIMESTAMP, - ): void { - if (global.nativeQPLMarkerEnd) { - global.nativeQPLMarkerEnd(markerId, instanceKey, actionId, timestamp); - } - }, - - markerTag( - markerId: number, - tag: string, - instanceKey: number = DUMMY_INSTANCE_KEY, - ): void { - if (global.nativeQPLMarkerTag) { - global.nativeQPLMarkerTag(markerId, instanceKey, tag); - } - }, - - markerAnnotate( - markerId: number, - annotations: AnnotationsMap, - instanceKey: number = DUMMY_INSTANCE_KEY, - ): void { - if (global.nativeQPLMarkerAnnotateWithMap) { - global.nativeQPLMarkerAnnotateWithMap(markerId, annotations, instanceKey); - } else if (global.nativeQPLMarkerAnnotate) { - for (const type of [ - 'string', - 'int', - 'double', - 'bool', - 'string_array', - 'int_array', - 'double_array', - 'bool_array', - ]) { - const keyValsOfType = annotations[type]; - if (keyValsOfType != null) { - for (const annotationKey of Object.keys(keyValsOfType)) { - global.nativeQPLMarkerAnnotate( - markerId, - instanceKey, - annotationKey, - keyValsOfType[annotationKey].toString(), - ); - } - } - } - } - }, - - markerCancel( - markerId: number, - instanceKey?: number = DUMMY_INSTANCE_KEY, - ): void { - // $FlowFixMe[object-this-reference] - this.markerDrop(markerId, instanceKey); - }, - - markerPoint( - markerId: number, - name: string, - instanceKey: number = DUMMY_INSTANCE_KEY, - timestamp: number = AUTO_SET_TIMESTAMP, - data: ?string = null, - ): void { - if (global.nativeQPLMarkerPoint) { - global.nativeQPLMarkerPoint(markerId, name, instanceKey, timestamp, data); - } - }, - - markerDrop( - markerId: number, - instanceKey?: number = DUMMY_INSTANCE_KEY, - ): void { - if (global.nativeQPLMarkerDrop) { - global.nativeQPLMarkerDrop(markerId, instanceKey); - } - }, - - // Checks whether the given QPL marker is going to be sent to server or not - // (the latter may be the case due to e.g. downsampling). - // Note that markerStart is expected to have been already called at this point. - isMarkerOn( - markerId: number, - instanceKey?: number = DUMMY_INSTANCE_KEY, - ): boolean { - if (global.nativeQPLIsMarkerOn) { - return global.nativeQPLIsMarkerOn(markerId, instanceKey); - } - return true; - }, - - markEvent( - markerId: number, - type: string, - annotations: ?AnnotationsMap = null, - ): void { - if (global.nativeQPLMarkEvent) { - global.nativeQPLMarkEvent(markerId, type, annotations); - } - }, - - currentTimestamp(): number { - if (global.nativeQPLTimestamp) { - return global.nativeQPLTimestamp(); - } - return 0; - }, -}; - -module.exports = QuickPerformanceLogger; diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 16d88b5a147b35..006258d71fc488 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -5982,48 +5982,6 @@ declare export default typeof NativeJSCSamplingProfiler; " `; -exports[`public API should not change unintentionally Libraries/Performance/QuickPerformanceLogger.js 1`] = ` -"export type AnnotationsMap = Partial<{ - string: ?{ [string]: string, ... }, - int: ?{ [string]: number, ... }, - double: ?{ [string]: number, ... }, - bool: ?{ [string]: boolean, ... }, - string_array: ?{ [string]: $ReadOnlyArray, ... }, - int_array: ?{ [string]: $ReadOnlyArray, ... }, - double_array: ?{ [string]: $ReadOnlyArray, ... }, - bool_array: ?{ [string]: $ReadOnlyArray, ... }, -}>; -declare const QuickPerformanceLogger: { - markerStart(markerId: number, instanceKey: number, timestamp: number): void, - markerEnd( - markerId: number, - actionId: number, - instanceKey: number, - timestamp: number - ): void, - markerTag(markerId: number, tag: string, instanceKey: number): void, - markerAnnotate( - markerId: number, - annotations: AnnotationsMap, - instanceKey: number - ): void, - markerCancel(markerId: number, instanceKey?: number): void, - markerPoint( - markerId: number, - name: string, - instanceKey: number, - timestamp: number, - data: ?string - ): void, - markerDrop(markerId: number, instanceKey?: number): void, - isMarkerOn(markerId: number, instanceKey?: number): boolean, - markEvent(markerId: number, type: string, annotations: ?AnnotationsMap): void, - currentTimestamp(): number, -}; -declare module.exports: QuickPerformanceLogger; -" -`; - exports[`public API should not change unintentionally Libraries/Performance/SamplingProfiler.js 1`] = ` "declare const SamplingProfiler: { poke: (token: number) => void }; declare module.exports: SamplingProfiler;