From 49a594a513fd8008091529bb99ae607f44222e40 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 12 Dec 2024 14:43:18 -0800 Subject: [PATCH] Remove references to legacy JSC SamplingProfiler Summary: This module is no longer functional, the global method `pokeSamplingProfiler` does not exist. There are no implementations in the core of `JSCSamplingProfiler` (removed back in 2019! - https://www.internalfb.com/diff/D10473627) Changelog: [Internal] Reviewed By: fabriziocucci Differential Revision: D67140119 fbshipit-source-id: 9dfe80d63e935004ef4a1956e8a7a544a2f9a8c1 --- .../Libraries/Core/setUpBatchedBridge.js | 3 -- .../Performance/NativeJSCSamplingProfiler.js | 13 ------- .../Libraries/Performance/SamplingProfiler.js | 39 ------------------- .../__snapshots__/public-api-test.js.snap | 12 ------ .../React/CoreModules/RCTDevSettings.h | 1 - .../modules/NativeJSCSamplingProfiler.js | 19 --------- 6 files changed, 87 deletions(-) delete mode 100644 packages/react-native/Libraries/Performance/NativeJSCSamplingProfiler.js delete mode 100644 packages/react-native/Libraries/Performance/SamplingProfiler.js delete mode 100644 packages/react-native/src/private/specs/modules/NativeJSCSamplingProfiler.js diff --git a/packages/react-native/Libraries/Core/setUpBatchedBridge.js b/packages/react-native/Libraries/Core/setUpBatchedBridge.js index da04fc30be2..d2768a32eea 100644 --- a/packages/react-native/Libraries/Core/setUpBatchedBridge.js +++ b/packages/react-native/Libraries/Core/setUpBatchedBridge.js @@ -16,9 +16,6 @@ registerModule('Systrace', () => require('../Performance/Systrace')); if (!(global.RN$Bridgeless === true)) { registerModule('JSTimers', () => require('./Timers/JSTimers')); } -registerModule('SamplingProfiler', () => - require('../Performance/SamplingProfiler'), -); registerModule('RCTLog', () => require('../Utilities/RCTLog')); registerModule( 'RCTDeviceEventEmitter', diff --git a/packages/react-native/Libraries/Performance/NativeJSCSamplingProfiler.js b/packages/react-native/Libraries/Performance/NativeJSCSamplingProfiler.js deleted file mode 100644 index 3d7a19497be..00000000000 --- a/packages/react-native/Libraries/Performance/NativeJSCSamplingProfiler.js +++ /dev/null @@ -1,13 +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. - * - * @flow strict - * @format - */ - -export * from '../../src/private/specs/modules/NativeJSCSamplingProfiler'; -import NativeJSCSamplingProfiler from '../../src/private/specs/modules/NativeJSCSamplingProfiler'; -export default NativeJSCSamplingProfiler; diff --git a/packages/react-native/Libraries/Performance/SamplingProfiler.js b/packages/react-native/Libraries/Performance/SamplingProfiler.js deleted file mode 100644 index 9c27d4c04d4..00000000000 --- a/packages/react-native/Libraries/Performance/SamplingProfiler.js +++ /dev/null @@ -1,39 +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 SamplingProfiler = { - poke: function (token: number): void { - let error = null; - let result = null; - try { - result = global.pokeSamplingProfiler(); - if (result === null) { - console.log('The JSC Sampling Profiler has started'); - } else { - console.log('The JSC Sampling Profiler has stopped'); - } - } catch (e) { - console.log( - 'Error occurred when restarting Sampling Profiler: ' + e.toString(), - ); - error = e.toString(); - } - - const NativeJSCSamplingProfiler = - require('./NativeJSCSamplingProfiler').default; - if (NativeJSCSamplingProfiler) { - NativeJSCSamplingProfiler.operationComplete(token, result, error); - } - }, -}; - -module.exports = SamplingProfiler; 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 bc01d5fcf08..98486c57dc1 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 @@ -6953,18 +6953,6 @@ exports[`public API should not change unintentionally Libraries/NewAppScreen/ind " `; -exports[`public API should not change unintentionally Libraries/Performance/NativeJSCSamplingProfiler.js 1`] = ` -"export * from \\"../../src/private/specs/modules/NativeJSCSamplingProfiler\\"; -declare export default typeof NativeJSCSamplingProfiler; -" -`; - -exports[`public API should not change unintentionally Libraries/Performance/SamplingProfiler.js 1`] = ` -"declare const SamplingProfiler: { poke: (token: number) => void }; -declare module.exports: SamplingProfiler; -" -`; - exports[`public API should not change unintentionally Libraries/Performance/Systrace.js 1`] = ` "type EventName = string | (() => string); type EventArgs = ?{ [string]: string }; diff --git a/packages/react-native/React/CoreModules/RCTDevSettings.h b/packages/react-native/React/CoreModules/RCTDevSettings.h index 35a24b5d919..5c3898740d6 100644 --- a/packages/react-native/React/CoreModules/RCTDevSettings.h +++ b/packages/react-native/React/CoreModules/RCTDevSettings.h @@ -49,7 +49,6 @@ @property (nonatomic, readonly) BOOL isHotLoadingAvailable; @property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable; @property (nonatomic, readonly) BOOL isDeviceDebuggingAvailable; -@property (nonatomic, readonly) BOOL isJSCSamplingProfilerAvailable; /** * Whether the bridge is connected to a remote JS executor. diff --git a/packages/react-native/src/private/specs/modules/NativeJSCSamplingProfiler.js b/packages/react-native/src/private/specs/modules/NativeJSCSamplingProfiler.js deleted file mode 100644 index 473f0cc8e77..00000000000 --- a/packages/react-native/src/private/specs/modules/NativeJSCSamplingProfiler.js +++ /dev/null @@ -1,19 +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. - * - * @flow strict - * @format - */ - -import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; - -import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; - -export interface Spec extends TurboModule { - +operationComplete: (token: number, result: ?string, error: ?string) => void; -} - -export default (TurboModuleRegistry.get('JSCSamplingProfiler'): ?Spec);