mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove unnecessary checks for profiling in dev mode
Summary: It doesn't make sense to have checks for whether we're profiling or not in `__DEV__` blocks, where we shouldn't be profiling in the first case. We're going to remove the `global.__RCTProfileIsProfiling` flag in favor of a function that checks if we're profiling in real time (as opposed to checking if we're profiling only on startup, which is what that value does). This is just to make that migration easier without having to migrate callsites that are bad practices anyway. Changelog: [internal] Reviewed By: rshest Differential Revision: D40095841 fbshipit-source-id: ba6cdf4bef8a4c169c50a974671c21144ccee92b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0f56adb07
commit
789912441e
@@ -52,7 +52,7 @@ registerModule('GlobalPerformanceLogger', () =>
|
||||
require('../Utilities/GlobalPerformanceLogger'),
|
||||
);
|
||||
|
||||
if (__DEV__ && !global.__RCTProfileIsProfiling) {
|
||||
if (__DEV__) {
|
||||
registerModule('HMRClient', () => require('../Utilities/HMRClient'));
|
||||
} else {
|
||||
registerModule('HMRClient', () => require('../Utilities/HMRClientProdShim'));
|
||||
|
||||
@@ -17,13 +17,11 @@ declare var console: typeof console & {_isPolyfilled: boolean, ...};
|
||||
* You can use this module directly, or just require InitializeCore.
|
||||
*/
|
||||
if (__DEV__) {
|
||||
if (!global.__RCTProfileIsProfiling) {
|
||||
require('./setUpReactDevTools');
|
||||
require('./setUpReactDevTools');
|
||||
|
||||
// Set up inspector
|
||||
const JSInspector = require('../JSInspector/JSInspector');
|
||||
JSInspector.registerAgent(require('../JSInspector/NetworkAgent'));
|
||||
}
|
||||
// Set up inspector
|
||||
const JSInspector = require('../JSInspector/JSInspector');
|
||||
JSInspector.registerAgent(require('../JSInspector/NetworkAgent'));
|
||||
|
||||
// Note we can't check if console is "native" because it would appear "native" in JSC and Hermes.
|
||||
// We also can't check any properties that don't exist in the Chrome worker environment.
|
||||
|
||||
@@ -50,10 +50,7 @@ class AppContainer extends React.Component<Props, State> {
|
||||
|
||||
componentDidMount(): void {
|
||||
if (__DEV__) {
|
||||
if (
|
||||
!global.__RCTProfileIsProfiling &&
|
||||
!this.props.internal_excludeInspector
|
||||
) {
|
||||
if (!this.props.internal_excludeInspector) {
|
||||
this._subscription = RCTDeviceEventEmitter.addListener(
|
||||
'toggleElementInspector',
|
||||
() => {
|
||||
@@ -93,12 +90,10 @@ class AppContainer extends React.Component<Props, State> {
|
||||
render(): React.Node {
|
||||
let logBox = null;
|
||||
if (__DEV__) {
|
||||
if (!global.__RCTProfileIsProfiling) {
|
||||
if (!this.props.internal_excludeLogBox) {
|
||||
const LogBoxNotificationContainer =
|
||||
require('../LogBox/LogBoxNotificationContainer').default;
|
||||
logBox = <LogBoxNotificationContainer />;
|
||||
}
|
||||
if (!this.props.internal_excludeLogBox) {
|
||||
const LogBoxNotificationContainer =
|
||||
require('../LogBox/LogBoxNotificationContainer').default;
|
||||
logBox = <LogBoxNotificationContainer />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user