MCPcopy
hub / github.com/facebook/react / startHostActionTimer

Function startHostActionTimer

packages/react-reconciler/src/ReactProfilerTimer.js:200–246  ·  view source on GitHub ↗
(fiber: Fiber)

Source from the content-addressed store, hash-verified

198}
199
200export function startHostActionTimer(fiber: Fiber): void {
201 if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
202 return;
203 }
204 // This schedules an update on both the blocking lane for the pending state and on the
205 // transition lane for the action update. Using the debug task from the host fiber.
206 if (blockingUpdateTime < 0) {
207 blockingUpdateTime = now();
208 blockingUpdateTask =
209 __DEV__ && fiber._debugTask != null ? fiber._debugTask : null;
210 if (isAlreadyRendering()) {
211 blockingUpdateType = SPAWNED_UPDATE;
212 }
213 const newEventTime = resolveEventTimeStamp();
214 const newEventType = resolveEventType();
215 if (
216 newEventTime !== blockingEventRepeatTime ||
217 newEventType !== blockingEventType
218 ) {
219 blockingEventRepeatTime = -1.1;
220 } else if (newEventType !== null) {
221 // If this is a second update in the same event, we treat it as a spawned update.
222 // This might be a microtask spawned from useEffect, multiple flushSync or
223 // a setState in a microtask spawned after the first setState. Regardless it's bad.
224 blockingUpdateType = SPAWNED_UPDATE;
225 }
226 blockingEventTime = newEventTime;
227 blockingEventType = newEventType;
228 }
229 if (transitionUpdateTime < 0) {
230 transitionUpdateTime = now();
231 transitionUpdateTask =
232 __DEV__ && fiber._debugTask != null ? fiber._debugTask : null;
233 if (transitionStartTime < 0) {
234 const newEventTime = resolveEventTimeStamp();
235 const newEventType = resolveEventType();
236 if (
237 newEventTime !== transitionEventRepeatTime ||
238 newEventType !== transitionEventType
239 ) {
240 transitionEventRepeatTime = -1.1;
241 }
242 transitionEventTime = newEventTime;
243 transitionEventType = newEventType;
244 }
245 }
246}
247
248export function startPingTimerByLanes(lanes: Lanes): void {
249 if (!enableProfilerTimer || !enableComponentPerformanceTrack) {

Callers 1

ReactFiberHooks.jsFile · 0.90

Calls 4

isAlreadyRenderingFunction · 0.90
resolveEventTimeStampFunction · 0.90
resolveEventTypeFunction · 0.90
nowFunction · 0.50

Tested by

no test coverage detected