Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ module.exports = {
globals: {
nativeFabricUIManager: 'readonly',
RN$enableMicrotasksInReact: 'readonly',
RN$unstable_createTask: 'readonly',
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions packages/react-art/src/ReactFiberConfigART.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ export function resolveEventTimeStamp(): number {
return -1.1;
}

// Async Stack Tagging API.
// Chromium-only: https://developer.chrome.com/docs/devtools/console/api#createtask
// eslint-disable-next-line react-internal/no-production-logging
export const createTask = console.createTask;

export function shouldAttemptEagerTransition() {
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ export function resolveEventTimeStamp(): number {
return event && event !== schedulerEvent ? event.timeStamp : -1.1;
}

// Async Stack Tagging API.
// Chromium-only: https://developer.chrome.com/docs/devtools/console/api#createtask
// eslint-disable-next-line react-internal/no-production-logging
export const createTask: typeof console.createTask | void = console.createTask;

export const isPrimaryRenderer = true;
export const warnsIfNotActing = true;
// This initialization code may run even on server environments
Expand Down
7 changes: 7 additions & 0 deletions packages/react-native-renderer/src/ReactFiberConfigFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ export function resolveEventTimeStamp(): number {
return -1.1;
}

// This matches Chrome's console.createTask in terms of signature.
// This doesn't match Chrome's console.createTask in terms of behavior and implementation.
export const createTask: typeof console.createTask | void =
typeof RN$unstable_createTask === 'function'
? RN$unstable_createTask
: undefined;

export function shouldAttemptEagerTransition(): boolean {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-renderer/src/ReactFiberConfigNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ export function resolveEventTimeStamp(): number {
return -1.1;
}

export const createTask: typeof console.createTask | void = undefined;

export function shouldAttemptEagerTransition(): boolean {
return false;
}
Expand Down
12 changes: 7 additions & 5 deletions packages/react-reconciler/src/ReactProfilerTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import {
NoLanes,
} from './ReactFiberLane';

import {resolveEventType, resolveEventTimeStamp} from './ReactFiberConfig';
import {
resolveEventType,
resolveEventTimeStamp,
createTask as createTaskFromFiberConfig,
} from './ReactFiberConfig';

import {
enableProfilerCommitHooks,
Expand All @@ -43,10 +47,8 @@ import * as Scheduler from 'scheduler';
const {unstable_now: now} = Scheduler;

const createTask =
// eslint-disable-next-line react-internal/no-production-logging
__DEV__ && console.createTask
? // eslint-disable-next-line react-internal/no-production-logging
console.createTask
__DEV__ && createTaskFromFiberConfig
? createTaskFromFiberConfig
: (name: string) => null;

export const REGULAR_UPDATE: UpdateType = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const resolveUpdatePriority = $$$config.resolveUpdatePriority;
export const trackSchedulerEvent = $$$config.trackSchedulerEvent;
export const resolveEventType = $$$config.resolveEventType;
export const resolveEventTimeStamp = $$$config.resolveEventTimeStamp;
export const createTask = $$$config.createTask;
export const shouldAttemptEagerTransition =
$$$config.shouldAttemptEagerTransition;
export const detachDeletedInstance = $$$config.detachDeletedInstance;
Expand Down
5 changes: 5 additions & 0 deletions packages/react-test-renderer/src/ReactFiberConfigTestHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ export function resolveEventType(): null | string {
export function resolveEventTimeStamp(): number {
return -1.1;
}
// Async Stack Tagging API.
// Chromium-only: https://developer.chrome.com/docs/devtools/console/api#createtask
// eslint-disable-next-line react-internal/no-production-logging
export const createTask = console.createTask;

export function shouldAttemptEagerTransition(): boolean {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions scripts/flow/react-native-host-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,6 @@ declare const nativeFabricUIManager: {
unstable_getCurrentEventPriority: () => number,
...
};

// eslint-disable-next-line no-unused-vars
declare const RN$unstable_createTask: typeof console.createTask;
2 changes: 2 additions & 0 deletions scripts/rollup/validate/eslintrc.rn.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module.exports = {
nativeFabricUIManager: 'readonly',
// RN flag to enable microtasks
RN$enableMicrotasksInReact: 'readonly',
// RN's temporary Async Stack Tagging API.
RN$unstable_createTask: 'readonly',
// Trusted Types
trustedTypes: 'readonly',
// RN supports this
Expand Down
Loading