( componentInfo: ReactComponentInfo, trackIdx: number, startTime: number, endTime: number, childrenEndTime: number, rootEnv: string, )
| 73 | ]; |
| 74 | |
| 75 | export function logComponentRender( |
| 76 | componentInfo: ReactComponentInfo, |
| 77 | trackIdx: number, |
| 78 | startTime: number, |
| 79 | endTime: number, |
| 80 | childrenEndTime: number, |
| 81 | rootEnv: string, |
| 82 | ): void { |
| 83 | if (supportsUserTiming && childrenEndTime >= 0 && trackIdx < 10) { |
| 84 | const env = componentInfo.env; |
| 85 | const name = componentInfo.name; |
| 86 | const isPrimaryEnv = env === rootEnv; |
| 87 | const selfTime = endTime - startTime; |
| 88 | const color = |
| 89 | selfTime < 0.5 |
| 90 | ? isPrimaryEnv |
| 91 | ? 'primary-light' |
| 92 | : 'secondary-light' |
| 93 | : selfTime < 50 |
| 94 | ? isPrimaryEnv |
| 95 | ? 'primary' |
| 96 | : 'secondary' |
| 97 | : selfTime < 500 |
| 98 | ? isPrimaryEnv |
| 99 | ? 'primary-dark' |
| 100 | : 'secondary-dark' |
| 101 | : 'error'; |
| 102 | const entryName = |
| 103 | isPrimaryEnv || env === undefined ? name : name + ' [' + env + ']'; |
| 104 | const debugTask = componentInfo.debugTask; |
| 105 | if (__DEV__ && debugTask) { |
| 106 | const properties: Array<[string, string]> = []; |
| 107 | if (componentInfo.key != null) { |
| 108 | addValueToProperties('key', componentInfo.key, properties, 0, ''); |
| 109 | } |
| 110 | if (componentInfo.props != null) { |
| 111 | addObjectToProperties(componentInfo.props, properties, 0, ''); |
| 112 | } |
| 113 | debugTask.run( |
| 114 | // $FlowFixMe[method-unbinding] |
| 115 | performance.measure.bind(performance, '\u200b' + entryName, { |
| 116 | start: startTime < 0 ? 0 : startTime, |
| 117 | end: childrenEndTime, |
| 118 | detail: { |
| 119 | devtools: { |
| 120 | color: color, |
| 121 | track: trackNames[trackIdx], |
| 122 | trackGroup: COMPONENTS_TRACK, |
| 123 | properties, |
| 124 | }, |
| 125 | }, |
| 126 | }), |
| 127 | ); |
| 128 | } else { |
| 129 | console.timeStamp( |
| 130 | '\u200b' + entryName, |
| 131 | startTime < 0 ? 0 : startTime, |
| 132 | childrenEndTime, |
no test coverage detected