scheduler
Advanced tools
Comparing version 0.20.1 to 0.20.2
{ | ||
"branch": "17.0.1", | ||
"buildNumber": "222790", | ||
"checksum": "addb3df", | ||
"commit": "8e5adfbd7", | ||
"branch": "pull/21051", | ||
"buildNumber": "287151", | ||
"checksum": "94f5c65", | ||
"commit": "12adaffef", | ||
"environment": "ci", | ||
"reactVersion": "17.0.0-8e5adfbd7" | ||
"reactVersion": "17.0.0-12adaffef" | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-tracing.development.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-tracing.production.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-tracing.profiling.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_mock.development.js | ||
@@ -17,3 +17,3 @@ * | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
var enableProfiling = false; | ||
@@ -296,3 +296,2 @@ var currentTime = 0; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -304,163 +303,5 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
@@ -504,7 +345,2 @@ // Math.pow(2, 30) - 1 | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -538,5 +374,2 @@ // Remaining timers are pending. | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
@@ -576,8 +409,2 @@ | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = getCurrentTime(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
@@ -603,3 +430,3 @@ } | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -610,8 +437,3 @@ currentTime = getCurrentTime(); | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -761,6 +583,2 @@ if (currentTask === peek(taskQueue)) { | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -786,7 +604,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -820,9 +633,2 @@ | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = getCurrentTime(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -840,7 +646,3 @@ // array based heap, only the first one.) | ||
var unstable_requestPaint = requestPaint; | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
var unstable_Profiling = null; | ||
@@ -847,0 +649,0 @@ exports.unstable_IdlePriority = IdlePriority; |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_mock.production.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_post_task.development.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_post_task.production.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler.development.js | ||
@@ -17,3 +17,3 @@ * | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
var enableProfiling = false; | ||
@@ -288,3 +288,2 @@ var requestHostCallback; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -296,163 +295,5 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
@@ -496,7 +337,2 @@ // Math.pow(2, 30) - 1 | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -530,5 +366,2 @@ // Remaining timers are pending. | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
@@ -568,8 +401,2 @@ | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = exports.unstable_now(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
@@ -595,3 +422,3 @@ } | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -602,8 +429,3 @@ currentTime = exports.unstable_now(); | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -753,6 +575,2 @@ if (currentTask === peek(taskQueue)) { | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -778,7 +596,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -812,9 +625,2 @@ | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = exports.unstable_now(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -832,7 +638,3 @@ // array based heap, only the first one.) | ||
var unstable_requestPaint = requestPaint; | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
var unstable_Profiling = null; | ||
@@ -839,0 +641,0 @@ exports.unstable_IdlePriority = IdlePriority; |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler.production.min.js | ||
@@ -3,0 +3,0 @@ * |
{ | ||
"name": "scheduler", | ||
"version": "0.20.1", | ||
"version": "0.20.2", | ||
"description": "Cooperative scheduler for the browser environment.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_mock.development.js | ||
@@ -16,3 +16,3 @@ * | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
var enableProfiling = false; | ||
@@ -295,3 +295,2 @@ var currentTime = 0; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -303,163 +302,5 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
@@ -503,7 +344,2 @@ // Math.pow(2, 30) - 1 | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -537,5 +373,2 @@ // Remaining timers are pending. | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
@@ -575,8 +408,2 @@ | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = getCurrentTime(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
@@ -602,3 +429,3 @@ } | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -609,8 +436,3 @@ currentTime = getCurrentTime(); | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -760,6 +582,2 @@ if (currentTask === peek(taskQueue)) { | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -785,7 +603,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -819,9 +632,2 @@ | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = getCurrentTime(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -839,7 +645,3 @@ // array based heap, only the first one.) | ||
var unstable_requestPaint = requestPaint; | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
var unstable_Profiling = null; | ||
@@ -846,0 +648,0 @@ exports.unstable_IdlePriority = IdlePriority; |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.20.1 | ||
/** @license React v0.20.2 | ||
* scheduler-unstable_mock.production.min.js | ||
@@ -3,0 +3,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113156
2889