GeezerVison is showing github.com — Remove "Waiting for async callback" User Timing measurement (#16379) · react/react@1fd3906
File treeExpand file treeCollapse file tree Open diff view settings packages/react-reconciler/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.js +9-7Lines changed: 9 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,7 @@ import warningWithoutStack from 'shared/warningWithoutStack'; | 31 | 31 | import { | 32 | 32 | enableProfilerTimer, | 33 | 33 | enableFundamentalAPI, | | 34 | + enableUserTimingAPI, | 34 | 35 | } from 'shared/ReactFeatureFlags'; | 35 | 36 | import {NoEffect, Placement} from 'shared/ReactSideEffectTags'; | 36 | 37 | import {ConcurrentRoot, BatchedRoot} from 'shared/ReactRootTags'; | @@ -245,11 +246,7 @@ export type Fiber = {| | 245 | 246 | _debugHookTypes?: Array<HookType> | null, | 246 | 247 | |}; | 247 | 248 |
| 248 | | -let debugCounter; | 249 | | - | 250 | | -if (__DEV__) { | 251 | | - debugCounter = 1; | 252 | | -} | | 249 | +let debugCounter = 1; | 253 | 250 |
| 254 | 251 | function FiberNode( | 255 | 252 | tag: WorkTag, | @@ -319,11 +316,16 @@ function FiberNode( | 319 | 316 | this.treeBaseDuration = 0; | 320 | 317 | } | 321 | 318 |
| 322 | | - if (__DEV__) { | | 319 | + // This is normally DEV-only except www when it adds listeners. | | 320 | + // TODO: remove the User Timing integration in favor of Root Events. | | 321 | + if (enableUserTimingAPI) { | 323 | 322 | this._debugID = debugCounter++; | | 323 | + this._debugIsCurrentlyTiming = false; | | 324 | + } | | 325 | + | | 326 | + if (__DEV__) { | 324 | 327 | this._debugSource = null; | 325 | 328 | this._debugOwner = null; | 326 | | - this._debugIsCurrentlyTiming = false; | 327 | 329 | this._debugNeedsRemount = false; | 328 | 330 | this._debugHookTypes = null; | 329 | 331 | if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.js -20Lines changed: 0 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -152,8 +152,6 @@ import { | 152 | 152 | import { | 153 | 153 | recordEffect, | 154 | 154 | recordScheduleUpdate, | 155 | | - startRequestCallbackTimer, | 156 | | - stopRequestCallbackTimer, | 157 | 155 | startWorkTimer, | 158 | 156 | stopWorkTimer, | 159 | 157 | stopFailedWorkTimer, | @@ -546,16 +544,6 @@ function scheduleCallbackForRoot( | 546 | 544 | ), | 547 | 545 | options, | 548 | 546 | ); | 549 | | - if ( | 550 | | - enableUserTimingAPI && | 551 | | - expirationTime !== Sync && | 552 | | - (executionContext & (RenderContext | CommitContext)) === NoContext | 553 | | - ) { | 554 | | - // Scheduled an async callback, and we're not already working. Add an | 555 | | - // entry to the flamegraph that shows we're waiting for a callback | 556 | | - // to fire. | 557 | | - startRequestCallbackTimer(); | 558 | | - } | 559 | 547 | } | 560 | 548 | } | 561 | 549 |
| @@ -816,11 +804,6 @@ function renderRoot( | 816 | 804 | 'Should not already be working.', | 817 | 805 | ); | 818 | 806 |
| 819 | | - if (enableUserTimingAPI && expirationTime !== Sync) { | 820 | | - const didExpire = isSync; | 821 | | - stopRequestCallbackTimer(didExpire); | 822 | | - } | 823 | | - | 824 | 807 | if (root.firstPendingTime < expirationTime) { | 825 | 808 | // If there's no work left at this expiration time, exit immediately. This | 826 | 809 | // happens when multiple callbacks are scheduled for a single root, but an | @@ -964,9 +947,6 @@ function renderRoot( | 964 | 947 | if (workInProgress !== null) { | 965 | 948 | // There's still work left over. Return a continuation. | 966 | 949 | stopInterruptedWorkLoopTimer(); | 967 | | - if (expirationTime !== Sync) { | 968 | | - startRequestCallbackTimer(); | 969 | | - } | 970 | 950 | return renderRoot.bind(null, root, expirationTime); | 971 | 951 | } | 972 | 952 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,6 +89,15 @@ describe('ReactDebugFiberPerf', () => { | 89 | 89 | // We don't use the overload with three arguments. | 90 | 90 | measure(label, markName) { | 91 | 91 | if (markName !== activeMeasure.markName) { | | 92 | + // Fail the test. | | 93 | + console.error( | | 94 | + 'Unexpected measure() call: "%s". Active mark is "%s".', | | 95 | + markName, | | 96 | + activeMeasure.markName, | | 97 | + ); | | 98 | + // This exception will be caught and ignored | | 99 | + // because in the real implementation, we don't want | | 100 | + // to spam the console due to a React bug. | 92 | 101 | throw new Error('Unexpected measure() call.'); | 93 | 102 | } | 94 | 103 | // Step one level up | |
|