Skip to content

Commit de466d4

Browse files
yungstersaleclarson
authored andcommitted
RN: Remove React Stack Systrace Logic
Reviewed By: sophiebits Differential Revision: D7027263 fbshipit-source-id: f4eb3fab402eda337f464e4ebb0771202a9b93f2
1 parent 51695a0 commit de466d4

File tree

2 files changed

+6
-57
lines changed

2 files changed

+6
-57
lines changed

Libraries/Core/InitializeCore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Object.defineProperty(global.process, 'argv',
103103
// Setup the Systrace profiling hooks if necessary
104104
if (global.__RCTProfileIsProfiling) {
105105
const Systrace = require('Systrace');
106-
Systrace.installReactHook(true);
106+
Systrace.installReactHook();
107107
Systrace.setEnabled(true);
108108
}
109109

Libraries/Performance/Systrace.js

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ let _asyncCookie = 0;
3434
const _markStack = [];
3535
let _markStackIndex = -1;
3636
let _canInstallReactHook = false;
37-
let _useFiber = false;
3837

3938
// Implements a subset of User Timing API necessary for React measurements.
4039
// https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API
@@ -100,54 +99,13 @@ const userTimingPolyfill = __DEV__ ? {
10099
},
101100
} : null;
102101

103-
// A hook to get React Stack markers in Systrace.
104-
const reactDebugToolHook = __DEV__ ? {
105-
onBeforeMountComponent(debugID) {
106-
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
107-
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
108-
Systrace.beginEvent(`ReactReconciler.mountComponent(${displayName})`);
109-
},
110-
onMountComponent(debugID) {
111-
Systrace.endEvent();
112-
},
113-
onBeforeUpdateComponent(debugID) {
114-
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
115-
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
116-
Systrace.beginEvent(`ReactReconciler.updateComponent(${displayName})`);
117-
},
118-
onUpdateComponent(debugID) {
119-
Systrace.endEvent();
120-
},
121-
onBeforeUnmountComponent(debugID) {
122-
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
123-
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
124-
Systrace.beginEvent(`ReactReconciler.unmountComponent(${displayName})`);
125-
},
126-
onUnmountComponent(debugID) {
127-
Systrace.endEvent();
128-
},
129-
onBeginLifeCycleTimer(debugID, timerType) {
130-
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
131-
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
132-
Systrace.beginEvent(`${displayName}.${timerType}()`);
133-
},
134-
onEndLifeCycleTimer(debugID, timerType) {
135-
Systrace.endEvent();
136-
},
137-
} : null;
138-
139102
const Systrace = {
140-
installReactHook(useFiber: boolean) {
103+
installReactHook() {
141104
if (_enabled) {
142105
if (__DEV__) {
143-
if (useFiber) {
144-
global.performance = userTimingPolyfill;
145-
} else {
146-
require('ReactDebugTool').addHook(reactDebugToolHook);
147-
}
106+
global.performance = userTimingPolyfill;
148107
}
149108
}
150-
_useFiber = useFiber;
151109
_canInstallReactHook = true;
152110
},
153111

@@ -160,17 +118,8 @@ const Systrace = {
160118
global.nativeTraceEndLegacy && global.nativeTraceEndLegacy(TRACE_TAG_JS_VM_CALLS);
161119
}
162120
if (_canInstallReactHook) {
163-
if (_useFiber) {
164-
if (enabled && global.performance === undefined) {
165-
global.performance = userTimingPolyfill;
166-
}
167-
} else {
168-
const ReactDebugTool = require('ReactDebugTool');
169-
if (enabled) {
170-
ReactDebugTool.addHook(reactDebugToolHook);
171-
} else {
172-
ReactDebugTool.removeHook(reactDebugToolHook);
173-
}
121+
if (enabled && global.performance === undefined) {
122+
global.performance = userTimingPolyfill;
174123
}
175124
}
176125
}
@@ -242,7 +191,7 @@ const Systrace = {
242191
attachToRelayProfiler(relayProfiler: RelayProfiler) {
243192
relayProfiler.attachProfileHandler('*', (name, state?) => {
244193
if (state != null && state.queryName !== undefined) {
245-
name += '_' + state.queryName
194+
name += '_' + state.queryName;
246195
}
247196
const cookie = Systrace.beginAsyncEvent(name);
248197
return () => {

0 commit comments

Comments
 (0)