Set up Systrace during initialization
Summary: When we're profiling, we want to load Systrace immediately and profile all the startup and initial render code. The code here used to load Systrace during startup only if `__DEV__` but would always start profiling once Systrace was otherwise required. That seems pretty hard to reason about, so I'm switching to always requiring Systrace during the startup path and enabling profiling if appropriate. In actual production that'll always be false, of course. Reviewed By: javache Differential Revision: D3338216 fbshipit-source-id: f173e82f34e110d83e7ff04f11af9b302a54b859
This commit is contained in:
parent
11449359e5
commit
8876eaaea0
|
@ -40,6 +40,11 @@ function setUpProcess() {
|
|||
}
|
||||
}
|
||||
|
||||
function setUpProfile() {
|
||||
const Systrace = require('Systrace');
|
||||
Systrace.setEnabled(global.__RCTProfileIsProfiling || false);
|
||||
}
|
||||
|
||||
function setUpConsole() {
|
||||
// ExceptionsManager transitively requires Promise so we install it after
|
||||
const ExceptionsManager = require('ExceptionsManager');
|
||||
|
@ -229,6 +234,7 @@ function getPropertyDescriptor(object, name) {
|
|||
}
|
||||
|
||||
setUpProcess();
|
||||
setUpProfile();
|
||||
setUpConsole();
|
||||
setUpTimers();
|
||||
setUpAlert();
|
||||
|
|
|
@ -194,8 +194,6 @@ const Systrace = {
|
|||
},
|
||||
};
|
||||
|
||||
Systrace.setEnabled(global.__RCTProfileIsProfiling || false);
|
||||
|
||||
if (__DEV__) {
|
||||
// This is needed, because require callis in polyfills are not processed as
|
||||
// other files. Therefore, calls to `require('moduleId')` are not replaced
|
||||
|
|
Loading…
Reference in New Issue