File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,18 @@ import {NoPriority} from './SchedulerPriorities';
1515let runIdCounter : number = 0 ;
1616let mainThreadIdCounter : number = 0 ;
1717
18+ const isEnabledSharedArrayBuffer =
19+ // $FlowFixMe Flow doesn't know about SharedArrayBuffer
20+ typeof SharedArrayBuffer === 'function' &&
21+ // We only use SharedArrayBuffer when cross origin isolation is enabled.
22+ typeof window !== 'undefined' &&
23+ window . crossOriginIsolated === true ;
24+
1825const profilingStateSize = 4 ;
1926export const sharedProfilingBuffer = enableProfiling
20- ? // $FlowFixMe Flow doesn't know about SharedArrayBuffer
21- typeof SharedArrayBuffer === 'function'
27+ ? isEnabledSharedArrayBuffer
2228 ? new SharedArrayBuffer ( profilingStateSize * Int32Array . BYTES_PER_ELEMENT )
23- : // $FlowFixMe Flow doesn't know about ArrayBuffer
24- typeof ArrayBuffer === 'function'
29+ : typeof ArrayBuffer === 'function'
2530 ? new ArrayBuffer ( profilingStateSize * Int32Array . BYTES_PER_ELEMENT )
2631 : null // Don't crash the init path on IE9
2732 : null ;
You can’t perform that action at this time.
0 commit comments