731
}
732
733
let timeOrigin: number;
734
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
734
+ if (
735
+ enableProfilerTimer &&
736
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
737
+ ) {
738
// We start by serializing the time origin. Any future timestamps will be
739
// emitted relatively to this origin. Instead of using performance.timeOrigin
740
// as this origin, we use the timestamp at the start of the request.
981
task.keyPath, // the server component sequence continues through Promise-as-a-child.
982
task.implicitSlot,
983
request.abortableTasks,
981
- enableProfilerTimer && enableComponentPerformanceTrack ? task.time : 0,
984
+ enableProfilerTimer &&
985
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
986
+ ? task.time
987
+ : 0,
988
__DEV__ ? task.debugOwner : null,
989
__DEV__ ? task.debugStack : null,
990
__DEV__ ? task.debugTask : null,
1054
},
1055
reason => {
1056
if (newTask.status === PENDING) {
1051
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
1057
+ if (
1058
+ enableProfilerTimer &&
1059
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
1060
+ ) {
1061
// If this is async we need to time when this task finishes.
1062
newTask.timed = true;
1063
}
1103
task.keyPath,
1104
task.implicitSlot,
1105
request.abortableTasks,
1097
- enableProfilerTimer && enableComponentPerformanceTrack ? task.time : 0,
1106
+ enableProfilerTimer &&
1107
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
1108
+ ? task.time
1109
+ : 0,
1110
__DEV__ ? task.debugOwner : null,
1111
__DEV__ ? task.debugStack : null,
1112
__DEV__ ? task.debugTask : null,
1198
task.keyPath,
1199
task.implicitSlot,
1200
request.abortableTasks,
1189
- enableProfilerTimer && enableComponentPerformanceTrack ? task.time : 0,
1201
+ enableProfilerTimer &&
1202
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
1203
+ ? task.time
1204
+ : 0,
1205
__DEV__ ? task.debugOwner : null,
1206
__DEV__ ? task.debugStack : null,
1207
__DEV__ ? task.debugTask : null,
1631
outlineComponentInfo(request, componentDebugInfo);
1632
1633
// Track when we started rendering this component.
1619
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
1634
+ if (
1635
+ enableProfilerTimer &&
1636
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
1637
+ ) {
1638
advanceTaskTime(request, task, performance.now());
1639
}
1640
1704
throw null;
1705
}
1706
1689
- if (
1690
- __DEV__ ||
1691
- (enableProfilerTimer &&
1692
- enableComponentPerformanceTrack &&
1693
- enableAsyncDebugInfo)
1694
- ) {
1707
+ if (__DEV__ || (enableProfilerTimer && enableAsyncDebugInfo)) {
1708
// Forward any debug information for any Promises that we use():ed during the render.
1709
// We do this at the end so that we don't keep doing this for each retry.
1710
const trackedThenables = getTrackedThenablesAfterRendering();
2029
task.keyPath, // unlike outlineModel this one carries along context
2030
task.implicitSlot,
2031
request.abortableTasks,
2019
- enableProfilerTimer && enableComponentPerformanceTrack ? task.time : 0,
2032
+ enableProfilerTimer &&
2033
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
2034
+ ? task.time
2035
+ : 0,
2036
__DEV__ ? task.debugOwner : null,
2037
__DEV__ ? task.debugStack : null,
2038
__DEV__ ? task.debugTask : null,
2049
task.keyPath, // unlike outlineModel this one carries along context
2050
task.implicitSlot,
2051
request.abortableTasks,
2036
- enableProfilerTimer && enableComponentPerformanceTrack ? task.time : 0,
2052
+ enableProfilerTimer &&
2053
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
2054
+ ? task.time
2055
+ : 0,
2056
__DEV__ ? task.debugOwner : null,
2057
__DEV__ ? task.debugStack : null,
2058
__DEV__ ? task.debugTask : null,
2501
}
2502
2503
function pingTask(request: Request, task: Task): void {
2485
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
2504
+ if (
2505
+ enableProfilerTimer &&
2506
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
2507
+ ) {
2508
// If this was async we need to emit the time when it completes.
2509
task.timed = true;
2510
}
2609
| 'debugStack'
2610
| 'debugTask',
2611
>): any);
2590
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
2612
+ if (
2613
+ enableProfilerTimer &&
2614
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
2615
+ ) {
2616
task.timed = false;
2617
task.time = lastTimestamp;
2618
}
2820
null, // The way we use outlining is for reusing an object.
2821
false, // It makes no sense for that use case to be contextual.
2822
request.abortableTasks,
2798
- enableProfilerTimer && enableComponentPerformanceTrack
2823
+ enableProfilerTimer &&
2824
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
2825
? performance.now() // TODO: This should really inherit the time from the task.
2826
: 0,
2827
null, // TODO: Currently we don't associate any debug information with
3067
null,
3068
false,
3069
request.abortableTasks,
3044
- enableProfilerTimer && enableComponentPerformanceTrack
3070
+ enableProfilerTimer &&
3071
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
3072
? performance.now() // TODO: This should really inherit the time from the task.
3073
: 0,
3074
null, // TODO: Currently we don't associate any debug information with
3204
task.keyPath,
3205
task.implicitSlot,
3206
request.abortableTasks,
3180
- enableProfilerTimer && enableComponentPerformanceTrack
3207
+ enableProfilerTimer &&
3208
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
3209
? task.time
3210
: 0,
3211
__DEV__ ? task.debugOwner : null,
5158
forwardDebugInfo(request, task, debugInfo);
5159
}
5160
}
5133
- if (
5134
- enableProfilerTimer &&
5135
- enableComponentPerformanceTrack &&
5136
- enableAsyncDebugInfo
5137
- ) {
5161
+ if (enableProfilerTimer && enableAsyncDebugInfo) {
5162
const sequence = getAsyncSequenceFromPromise(thenable);
5163
if (sequence !== null) {
5164
emitAsyncSequence(request, task, sequence, debugInfo, owner, stack);
5179
forwardDebugInfo(request, task, debugInfo);
5180
}
5181
}
5158
- if (
5159
- enableProfilerTimer &&
5160
- enableComponentPerformanceTrack &&
5161
- enableAsyncDebugInfo
5162
- ) {
5182
+ if (enableProfilerTimer && enableAsyncDebugInfo) {
5183
const sequence = getCurrentAsyncSequence();
5184
if (sequence !== null) {
5185
emitAsyncSequence(request, task, sequence, debugInfo, null, null);
5202
forwardDebugInfo(request, task, debugInfo);
5203
}
5204
}
5185
- if (
5186
- enableProfilerTimer &&
5187
- enableComponentPerformanceTrack &&
5188
- enableAsyncDebugInfo
5189
- ) {
5205
+ if (enableProfilerTimer && enableAsyncDebugInfo) {
5206
let thenable: null | Thenable<any> = null;
5207
if (typeof model.then === 'function') {
5208
thenable = (model: any);
5278
task: Task,
5279
timestamp: number,
5280
): void {
5265
- if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
5281
+ if (
5282
+ !enableProfilerTimer ||
5283
+ (!enableComponentPerformanceTrack && !enableAsyncDebugInfo)
5284
+ ) {
5285
return;
5286
}
5287
// Emits a timing chunk, if the new timestamp is higher than the previous timestamp of this task.
5297
}
5298
5299
function markOperationEndTime(request: Request, task: Task, timestamp: number) {
5281
- if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
5300
+ if (
5301
+ !enableProfilerTimer ||
5302
+ (!enableComponentPerformanceTrack && !enableAsyncDebugInfo)
5303
+ ) {
5304
return;
5305
}
5306
// This is like advanceTaskTime() but always emits a timing chunk even if it doesn't advance.
5406
}
5407
5408
function erroredTask(request: Request, task: Task, error: mixed): void {
5387
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
5409
+ if (
5410
+ enableProfilerTimer &&
5411
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
5412
+ ) {
5413
if (task.timed) {
5414
markOperationEndTime(request, task, performance.now());
5415
}
5492
}
5493
}
5494
// We've finished rendering. Log the end time.
5470
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
5495
+ if (
5496
+ enableProfilerTimer &&
5497
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
5498
+ ) {
5499
if (task.timed) {
5500
markOperationEndTime(request, task, performance.now());
5501
}
5633
}
5634
forwardDebugInfoFromAbortedTask(request, task);
5635
// Track when we aborted this task as its end time.
5608
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
5636
+ if (
5637
+ enableProfilerTimer &&
5638
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
5639
+ ) {
5640
if (task.timed) {
5641
markOperationEndTime(request, task, request.abortTime);
5642
}
5952
}
5953
try {
5954
request.status = ABORTING;
5924
- if (enableProfilerTimer && enableComponentPerformanceTrack) {
5955
+ if (
5956
+ enableProfilerTimer &&
5957
+ (enableComponentPerformanceTrack || enableAsyncDebugInfo)
5958
+ ) {
5959
request.abortTime = performance.now();
5960
}
5961
request.cacheController.abort(reason);