(root: FiberRoot, lanes: Lanes)
| 1930 | } |
| 1931 | |
| 1932 | function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber { |
| 1933 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 1934 | // The order of tracks within a group are determined by the earliest start time. |
| 1935 | // Are tracks should show up in priority order and we should ideally always show |
| 1936 | // every track. This is a hack to ensure that we're displaying all tracks in the |
| 1937 | // right order. Ideally we could do this only once but because calls that aren't |
| 1938 | // recorded aren't considered for ordering purposes, we need to keep adding these |
| 1939 | // over and over again in case recording has just started. We can't tell when |
| 1940 | // recording starts. |
| 1941 | markAllLanesInOrder(); |
| 1942 | |
| 1943 | const previousRenderStartTime = renderStartTime; |
| 1944 | // Starting a new render. Log the end of any previous renders and the |
| 1945 | // blocked time before the render started. |
| 1946 | recordRenderTime(); |
| 1947 | // If this was a restart, e.g. due to an interrupting update, then there's no space |
| 1948 | // in the track to log the cause since we'll have rendered all the way up until the |
| 1949 | // restart so we need to clamp that. |
| 1950 | if ( |
| 1951 | workInProgressRootRenderLanes !== NoLanes && |
| 1952 | previousRenderStartTime > 0 |
| 1953 | ) { |
| 1954 | setCurrentTrackFromLanes(workInProgressRootRenderLanes); |
| 1955 | if ( |
| 1956 | workInProgressRootExitStatus === RootSuspended || |
| 1957 | workInProgressRootExitStatus === RootSuspendedWithDelay |
| 1958 | ) { |
| 1959 | // If the root was already suspended when it got interrupted and restarted, |
| 1960 | // then this is considered a prewarm and not an interrupted render because |
| 1961 | // we couldn't have shown anything anyway so it's not a bad thing that we |
| 1962 | // got interrupted. |
| 1963 | logSuspendedRenderPhase( |
| 1964 | previousRenderStartTime, |
| 1965 | renderStartTime, |
| 1966 | lanes, |
| 1967 | workInProgressUpdateTask, |
| 1968 | ); |
| 1969 | } else { |
| 1970 | logInterruptedRenderPhase( |
| 1971 | previousRenderStartTime, |
| 1972 | renderStartTime, |
| 1973 | lanes, |
| 1974 | workInProgressUpdateTask, |
| 1975 | ); |
| 1976 | } |
| 1977 | finalizeRender(workInProgressRootRenderLanes, renderStartTime); |
| 1978 | } |
| 1979 | const previousUpdateTask = workInProgressUpdateTask; |
| 1980 | |
| 1981 | workInProgressUpdateTask = null; |
| 1982 | if (isGestureRender(lanes)) { |
| 1983 | workInProgressUpdateTask = gestureUpdateTask; |
| 1984 | const clampedUpdateTime = |
| 1985 | gestureUpdateTime >= 0 && gestureUpdateTime < gestureClampTime |
| 1986 | ? gestureClampTime |
| 1987 | : gestureUpdateTime; |
| 1988 | const clampedEventTime = |
| 1989 | gestureEventTime >= 0 && gestureEventTime < gestureClampTime |
no test coverage detected