@@ -34,7 +34,6 @@ let _asyncCookie = 0;
3434const _markStack = [ ] ;
3535let _markStackIndex = - 1 ;
3636let _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-
139102const 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