mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5efb4f09fd
Summary: The `Systrace` module implements a polyfill for the User Timing API that's: 1. Incompatible with the Web standard. This polyfill expects `performance.mark` and `performance.measure` to be used exactly like `Systrace.beginEvent` and `Systrace.endEvent` respectively. If not used like those functions, they throw an error at runtime, which is really bad. 2. Never actually used. See below. This polyfill is only installed if we're actually profiling on startup: https://www.internalfb.com/code/fbsource/[4d888a933920]/xplat/js/react-native-github/Libraries/Core/setUpSystrace.js?lines=17-21 While the only code that we have that uses this API is actually not installed if we're profiling: https://www.internalfb.com/code/fbsource/[4d888a933920]/xplat/js/react-native-github/Libraries/Core/setUpDeveloperTools.js?lines=20-21 This should be safe to remove then. We have plans to add proper support for this API in the short term, so this also gets out of the way of doing that. Additionally, installing this polyfill was the only reason why we had `setupSystrace`, so we can get rid of that too :) Changelog: [Internal] Reviewed By: javache Differential Revision: D39210813 fbshipit-source-id: a90b6237c311d2157069b41975d10b33f1f464ef
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
/**
|
|
* 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-local
|
|
*/
|
|
|
|
/**
|
|
* Sets up global variables typical in most JavaScript environments.
|
|
*
|
|
* 1. Global timers (via `setTimeout` etc).
|
|
* 2. Global console object.
|
|
* 3. Hooks for printing stack traces with source maps.
|
|
*
|
|
* Leaves enough room in the environment for implementing your own:
|
|
*
|
|
* 1. Require system.
|
|
* 2. Bridged modules.
|
|
*
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const start = Date.now();
|
|
|
|
require('./setUpGlobals');
|
|
require('./setUpPerformance');
|
|
require('./setUpErrorHandling');
|
|
require('./polyfillPromise');
|
|
require('./setUpRegeneratorRuntime');
|
|
require('./setUpTimers');
|
|
require('./setUpXHR');
|
|
require('./setUpAlert');
|
|
require('./setUpNavigator');
|
|
require('./setUpBatchedBridge');
|
|
require('./setUpSegmentFetcher');
|
|
if (__DEV__) {
|
|
require('./checkNativeVersion');
|
|
require('./setUpDeveloperTools');
|
|
require('../LogBox/LogBox').install();
|
|
}
|
|
|
|
const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
|
|
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
|
|
// but then we'd be excluding the time it took to require the logger.
|
|
// Instead, we just use Date.now and backdate the timestamp.
|
|
GlobalPerformanceLogger.markPoint(
|
|
'initializeCore_start',
|
|
GlobalPerformanceLogger.currentTimestamp() - (Date.now() - start),
|
|
);
|
|
GlobalPerformanceLogger.markPoint('initializeCore_end');
|