scheduler 0.16.2 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/scheduler-tracing.development.js +8 -88
- package/cjs/scheduler-tracing.production.min.js +2 -2
- package/cjs/scheduler-tracing.profiling.min.js +6 -5
- package/cjs/scheduler-unstable_mock.development.js +70 -80
- package/cjs/scheduler-unstable_mock.production.min.js +12 -12
- package/cjs/scheduler.development.js +106 -270
- package/cjs/scheduler.production.min.js +12 -13
- package/package.json +1 -1
- package/umd/scheduler-tracing.development.js +2 -2
- package/umd/scheduler-tracing.production.min.js +2 -2
- package/umd/scheduler-tracing.profiling.min.js +2 -2
- package/umd/scheduler-unstable_mock.development.js +671 -681
- package/umd/scheduler-unstable_mock.production.min.js +10 -10
- package/umd/scheduler.development.js +2 -2
- package/umd/scheduler.production.min.js +2 -2
- package/umd/scheduler.profiling.min.js +2 -2
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "pull/
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "pull/18344",
|
|
3
|
+
"buildNumber": "106499",
|
|
4
|
+
"checksum": "7fe5a2e",
|
|
5
|
+
"commit": "da834083c",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.
|
|
7
|
+
"reactVersion": "16.12.0-da834083c"
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.19.1
|
|
2
2
|
* scheduler-tracing.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -15,72 +15,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
15
15
|
(function() {
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
|
-
|
|
20
|
-
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
21
|
-
|
|
22
|
-
// In some cases, StrictMode should also double-render lifecycles.
|
|
23
|
-
// This can be confusing for tests though,
|
|
24
|
-
// And it can be bad for performance in production.
|
|
25
|
-
// This feature flag can be used to control the behavior:
|
|
26
|
-
|
|
27
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
28
|
-
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
29
|
-
|
|
30
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
31
|
-
|
|
32
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
33
|
-
|
|
34
|
-
// Trace which interactions trigger each commit.
|
|
35
|
-
|
|
36
|
-
var enableSchedulerTracing = true; // Only used in www builds.
|
|
37
|
-
|
|
38
|
-
// TODO: true? Here it might just be false.
|
|
39
|
-
|
|
40
|
-
// Only used in www builds.
|
|
41
|
-
|
|
42
|
-
// Only used in www builds.
|
|
43
|
-
|
|
44
|
-
// Disable javascript: URL strings in href for XSS protection.
|
|
45
|
-
|
|
46
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
47
|
-
// with their related DOM properties
|
|
48
|
-
|
|
49
|
-
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
50
|
-
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
54
|
-
// This is a flag so we can fix warnings in RN core before turning it on
|
|
55
|
-
|
|
56
|
-
// Experimental React Flare event system and event components support.
|
|
57
|
-
|
|
58
|
-
// Experimental Host Component support.
|
|
59
|
-
|
|
60
|
-
// Experimental Scope support.
|
|
61
|
-
|
|
62
|
-
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
63
|
-
|
|
64
|
-
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
65
|
-
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
66
|
-
|
|
67
|
-
// For tests, we flush suspense fallbacks in an act scope;
|
|
68
|
-
// *except* in some of our own tests, where we test incremental loading states.
|
|
69
|
-
|
|
70
|
-
// Changes priority of some events like mousemove to user-blocking priority,
|
|
71
|
-
// but without making them discrete. The flag exists in case it causes
|
|
72
|
-
// starvation problems.
|
|
73
|
-
|
|
74
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
75
|
-
// in the update queue. This allows reporting and tracing of what is causing
|
|
76
|
-
// the user to see a loading state.
|
|
77
|
-
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
78
|
-
// hydrated or deleted.
|
|
79
|
-
|
|
80
|
-
// Part of the simplification of React.createElement so we can eventually move
|
|
81
|
-
// from React.createElement to React.jsx
|
|
82
|
-
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
83
|
-
|
|
84
18
|
var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs.
|
|
85
19
|
|
|
86
20
|
var interactionIDCounter = 0;
|
|
@@ -93,7 +27,7 @@ exports.__interactionsRef = null; // Listener(s) to notify when interactions beg
|
|
|
93
27
|
|
|
94
28
|
exports.__subscriberRef = null;
|
|
95
29
|
|
|
96
|
-
|
|
30
|
+
{
|
|
97
31
|
exports.__interactionsRef = {
|
|
98
32
|
current: new Set()
|
|
99
33
|
};
|
|
@@ -101,11 +35,7 @@ if (enableSchedulerTracing) {
|
|
|
101
35
|
current: null
|
|
102
36
|
};
|
|
103
37
|
}
|
|
104
|
-
|
|
105
38
|
function unstable_clear(callback) {
|
|
106
|
-
if (!enableSchedulerTracing) {
|
|
107
|
-
return callback();
|
|
108
|
-
}
|
|
109
39
|
|
|
110
40
|
var prevInteractions = exports.__interactionsRef.current;
|
|
111
41
|
exports.__interactionsRef.current = new Set();
|
|
@@ -117,9 +47,7 @@ function unstable_clear(callback) {
|
|
|
117
47
|
}
|
|
118
48
|
}
|
|
119
49
|
function unstable_getCurrent() {
|
|
120
|
-
|
|
121
|
-
return null;
|
|
122
|
-
} else {
|
|
50
|
+
{
|
|
123
51
|
return exports.__interactionsRef.current;
|
|
124
52
|
}
|
|
125
53
|
}
|
|
@@ -129,10 +57,6 @@ function unstable_getThreadID() {
|
|
|
129
57
|
function unstable_trace(name, timestamp, callback) {
|
|
130
58
|
var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
|
131
59
|
|
|
132
|
-
if (!enableSchedulerTracing) {
|
|
133
|
-
return callback();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
60
|
var interaction = {
|
|
137
61
|
__count: 1,
|
|
138
62
|
id: interactionIDCounter++,
|
|
@@ -185,10 +109,6 @@ function unstable_trace(name, timestamp, callback) {
|
|
|
185
109
|
function unstable_wrap(callback) {
|
|
186
110
|
var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
|
187
111
|
|
|
188
|
-
if (!enableSchedulerTracing) {
|
|
189
|
-
return callback;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
112
|
var wrappedInteractions = exports.__interactionsRef.current;
|
|
193
113
|
var subscriber = exports.__subscriberRef.current;
|
|
194
114
|
|
|
@@ -274,12 +194,12 @@ function unstable_wrap(callback) {
|
|
|
274
194
|
|
|
275
195
|
var subscribers = null;
|
|
276
196
|
|
|
277
|
-
|
|
197
|
+
{
|
|
278
198
|
subscribers = new Set();
|
|
279
199
|
}
|
|
280
200
|
|
|
281
201
|
function unstable_subscribe(subscriber) {
|
|
282
|
-
|
|
202
|
+
{
|
|
283
203
|
subscribers.add(subscriber);
|
|
284
204
|
|
|
285
205
|
if (subscribers.size === 1) {
|
|
@@ -295,7 +215,7 @@ function unstable_subscribe(subscriber) {
|
|
|
295
215
|
}
|
|
296
216
|
}
|
|
297
217
|
function unstable_unsubscribe(subscriber) {
|
|
298
|
-
|
|
218
|
+
{
|
|
299
219
|
subscribers.delete(subscriber);
|
|
300
220
|
|
|
301
221
|
if (subscribers.size === 0) {
|
|
@@ -421,9 +341,9 @@ function onWorkCanceled(interactions, threadID) {
|
|
|
421
341
|
exports.unstable_clear = unstable_clear;
|
|
422
342
|
exports.unstable_getCurrent = unstable_getCurrent;
|
|
423
343
|
exports.unstable_getThreadID = unstable_getThreadID;
|
|
424
|
-
exports.unstable_trace = unstable_trace;
|
|
425
|
-
exports.unstable_wrap = unstable_wrap;
|
|
426
344
|
exports.unstable_subscribe = unstable_subscribe;
|
|
345
|
+
exports.unstable_trace = unstable_trace;
|
|
427
346
|
exports.unstable_unsubscribe = unstable_unsubscribe;
|
|
347
|
+
exports.unstable_wrap = unstable_wrap;
|
|
428
348
|
})();
|
|
429
349
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.19.1
|
|
2
2
|
* scheduler-tracing.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';
|
|
10
|
+
'use strict';var b=0;exports.__interactionsRef=null;exports.__subscriberRef=null;exports.unstable_clear=function(a){return a()};exports.unstable_getCurrent=function(){return null};exports.unstable_getThreadID=function(){return++b};exports.unstable_subscribe=function(){};exports.unstable_trace=function(a,d,c){return c()};exports.unstable_unsubscribe=function(){};exports.unstable_wrap=function(a){return a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.19.1
|
|
2
2
|
* scheduler-tracing.profiling.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
'use strict';var g=0,l=0;exports.__interactionsRef=null;exports.__subscriberRef=null;exports.__interactionsRef={current:new Set};exports.__subscriberRef={current:null};var m=null;m=new Set;function n(e){var d=!1,a=null;m.forEach(function(c){try{c.onInteractionTraced(e)}catch(b){d||(d=!0,a=b)}});if(d)throw a;}function p(e){var d=!1,a=null;m.forEach(function(c){try{c.onInteractionScheduledWorkCompleted(e)}catch(b){d||(d=!0,a=b)}});if(d)throw a;}
|
|
11
|
+
function q(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkScheduled(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function r(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkStarted(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function t(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkStopped(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function u(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkCanceled(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}
|
|
12
|
+
exports.unstable_clear=function(e){var d=exports.__interactionsRef.current;exports.__interactionsRef.current=new Set;try{return e()}finally{exports.__interactionsRef.current=d}};exports.unstable_getCurrent=function(){return exports.__interactionsRef.current};exports.unstable_getThreadID=function(){return++l};
|
|
13
|
+
exports.unstable_subscribe=function(e){m.add(e);1===m.size&&(exports.__subscriberRef.current={onInteractionScheduledWorkCompleted:p,onInteractionTraced:n,onWorkCanceled:u,onWorkScheduled:q,onWorkStarted:r,onWorkStopped:t})};
|
|
13
14
|
exports.unstable_trace=function(e,d,a){var c=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,b={__count:1,id:g++,name:e,timestamp:d},f=exports.__interactionsRef.current,k=new Set(f);k.add(b);exports.__interactionsRef.current=k;var h=exports.__subscriberRef.current;try{if(null!==h)h.onInteractionTraced(b)}finally{try{if(null!==h)h.onWorkStarted(k,c)}finally{try{var v=a()}finally{exports.__interactionsRef.current=f;try{if(null!==h)h.onWorkStopped(k,c)}finally{if(b.__count--,null!==h&&0===b.__count)h.onInteractionScheduledWorkCompleted(b)}}}}return v};
|
|
15
|
+
exports.unstable_unsubscribe=function(e){m.delete(e);0===m.size&&(exports.__subscriberRef.current=null)};
|
|
14
16
|
exports.unstable_wrap=function(e){function d(){var d=exports.__interactionsRef.current;exports.__interactionsRef.current=c;b=exports.__subscriberRef.current;try{try{if(null!==b)b.onWorkStarted(c,a)}finally{try{var h=e.apply(void 0,arguments)}finally{if(exports.__interactionsRef.current=d,null!==b)b.onWorkStopped(c,a)}}return h}finally{f||(f=!0,c.forEach(function(a){a.__count--;if(null!==b&&0===a.__count)b.onInteractionScheduledWorkCompleted(a)}))}}var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:
|
|
15
17
|
0,c=exports.__interactionsRef.current,b=exports.__subscriberRef.current;if(null!==b)b.onWorkScheduled(c,a);c.forEach(function(a){a.__count++});var f=!1;d.cancel=function(){b=exports.__subscriberRef.current;try{if(null!==b)b.onWorkCanceled(c,a)}finally{c.forEach(function(a){a.__count--;if(b&&0===a.__count)b.onInteractionScheduledWorkCompleted(a)})}};return d};
|
|
16
|
-
exports.unstable_subscribe=function(e){m.add(e);1===m.size&&(exports.__subscriberRef.current={onInteractionScheduledWorkCompleted:p,onInteractionTraced:n,onWorkCanceled:u,onWorkScheduled:q,onWorkStarted:r,onWorkStopped:t})};exports.unstable_unsubscribe=function(e){m.delete(e);0===m.size&&(exports.__subscriberRef.current=null)};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.19.1
|
|
2
2
|
* scheduler-unstable_mock.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -15,11 +15,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
15
15
|
(function() {
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
|
-
|
|
20
18
|
var enableSchedulerDebugging = false;
|
|
21
|
-
|
|
22
|
-
|
|
23
19
|
var enableProfiling = true;
|
|
24
20
|
|
|
25
21
|
var currentTime = 0;
|
|
@@ -35,7 +31,6 @@ var shouldYieldForPaint = false;
|
|
|
35
31
|
function requestHostCallback(callback) {
|
|
36
32
|
scheduledCallback = callback;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
function requestHostTimeout(callback, ms) {
|
|
40
35
|
scheduledTimeout = callback;
|
|
41
36
|
timeoutTime = currentTime + ms;
|
|
@@ -58,7 +53,6 @@ function getCurrentTime() {
|
|
|
58
53
|
}
|
|
59
54
|
function forceFrameRate() {// No-op
|
|
60
55
|
}
|
|
61
|
-
// Should only be used via an assertion helper that inspects the yielded values.
|
|
62
56
|
|
|
63
57
|
function unstable_flushNumberOfYields(count) {
|
|
64
58
|
if (isFlushing) {
|
|
@@ -193,14 +187,10 @@ function unstable_yieldValue(value) {
|
|
|
193
187
|
function unstable_advanceTime(ms) {
|
|
194
188
|
currentTime += ms;
|
|
195
189
|
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
scheduledTimeout = null;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
unstable_flushExpired();
|
|
190
|
+
if (scheduledTimeout !== null && timeoutTime <= currentTime) {
|
|
191
|
+
scheduledTimeout(currentTime);
|
|
192
|
+
timeoutTime = -1;
|
|
193
|
+
scheduledTimeout = null;
|
|
204
194
|
}
|
|
205
195
|
}
|
|
206
196
|
function requestPaint() {
|
|
@@ -237,7 +227,7 @@ function siftUp(heap, node, i) {
|
|
|
237
227
|
var index = i;
|
|
238
228
|
|
|
239
229
|
while (true) {
|
|
240
|
-
var parentIndex =
|
|
230
|
+
var parentIndex = index - 1 >>> 1;
|
|
241
231
|
var parent = heap[parentIndex];
|
|
242
232
|
|
|
243
233
|
if (parent !== undefined && compare(parent, node) > 0) {
|
|
@@ -300,18 +290,18 @@ var IdlePriority = 5;
|
|
|
300
290
|
var runIdCounter = 0;
|
|
301
291
|
var mainThreadIdCounter = 0;
|
|
302
292
|
var profilingStateSize = 4;
|
|
303
|
-
var sharedProfilingBuffer =
|
|
293
|
+
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer
|
|
304
294
|
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
|
|
305
295
|
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
|
|
306
|
-
|
|
307
|
-
var profilingState =
|
|
296
|
+
;
|
|
297
|
+
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
|
|
308
298
|
|
|
309
299
|
var PRIORITY = 0;
|
|
310
300
|
var CURRENT_TASK_ID = 1;
|
|
311
301
|
var CURRENT_RUN_ID = 2;
|
|
312
302
|
var QUEUE_SIZE = 3;
|
|
313
303
|
|
|
314
|
-
|
|
304
|
+
{
|
|
315
305
|
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
|
|
316
306
|
// array might include canceled tasks.
|
|
317
307
|
|
|
@@ -345,7 +335,8 @@ function logEvent(entries) {
|
|
|
345
335
|
eventLogSize *= 2;
|
|
346
336
|
|
|
347
337
|
if (eventLogSize > MAX_EVENT_LOG_SIZE) {
|
|
348
|
-
|
|
338
|
+
// Using console['error'] to evade Babel and ESLint
|
|
339
|
+
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
|
|
349
340
|
stopLoggingProfilingEvents();
|
|
350
341
|
return;
|
|
351
342
|
}
|
|
@@ -374,82 +365,85 @@ function stopLoggingProfilingEvents() {
|
|
|
374
365
|
eventLogIndex = 0;
|
|
375
366
|
return buffer;
|
|
376
367
|
}
|
|
377
|
-
function markTaskStart(task,
|
|
378
|
-
|
|
368
|
+
function markTaskStart(task, ms) {
|
|
369
|
+
{
|
|
379
370
|
profilingState[QUEUE_SIZE]++;
|
|
380
371
|
|
|
381
372
|
if (eventLog !== null) {
|
|
382
|
-
|
|
373
|
+
// performance.now returns a float, representing milliseconds. When the
|
|
374
|
+
// event is logged, it's coerced to an int. Convert to microseconds to
|
|
375
|
+
// maintain extra degrees of precision.
|
|
376
|
+
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
|
|
383
377
|
}
|
|
384
378
|
}
|
|
385
379
|
}
|
|
386
|
-
function markTaskCompleted(task,
|
|
387
|
-
|
|
380
|
+
function markTaskCompleted(task, ms) {
|
|
381
|
+
{
|
|
388
382
|
profilingState[PRIORITY] = NoPriority;
|
|
389
383
|
profilingState[CURRENT_TASK_ID] = 0;
|
|
390
384
|
profilingState[QUEUE_SIZE]--;
|
|
391
385
|
|
|
392
386
|
if (eventLog !== null) {
|
|
393
|
-
logEvent([TaskCompleteEvent,
|
|
387
|
+
logEvent([TaskCompleteEvent, ms * 1000, task.id]);
|
|
394
388
|
}
|
|
395
389
|
}
|
|
396
390
|
}
|
|
397
|
-
function markTaskCanceled(task,
|
|
398
|
-
|
|
391
|
+
function markTaskCanceled(task, ms) {
|
|
392
|
+
{
|
|
399
393
|
profilingState[QUEUE_SIZE]--;
|
|
400
394
|
|
|
401
395
|
if (eventLog !== null) {
|
|
402
|
-
logEvent([TaskCancelEvent,
|
|
396
|
+
logEvent([TaskCancelEvent, ms * 1000, task.id]);
|
|
403
397
|
}
|
|
404
398
|
}
|
|
405
399
|
}
|
|
406
|
-
function markTaskErrored(task,
|
|
407
|
-
|
|
400
|
+
function markTaskErrored(task, ms) {
|
|
401
|
+
{
|
|
408
402
|
profilingState[PRIORITY] = NoPriority;
|
|
409
403
|
profilingState[CURRENT_TASK_ID] = 0;
|
|
410
404
|
profilingState[QUEUE_SIZE]--;
|
|
411
405
|
|
|
412
406
|
if (eventLog !== null) {
|
|
413
|
-
logEvent([TaskErrorEvent,
|
|
407
|
+
logEvent([TaskErrorEvent, ms * 1000, task.id]);
|
|
414
408
|
}
|
|
415
409
|
}
|
|
416
410
|
}
|
|
417
|
-
function markTaskRun(task,
|
|
418
|
-
|
|
411
|
+
function markTaskRun(task, ms) {
|
|
412
|
+
{
|
|
419
413
|
runIdCounter++;
|
|
420
414
|
profilingState[PRIORITY] = task.priorityLevel;
|
|
421
415
|
profilingState[CURRENT_TASK_ID] = task.id;
|
|
422
416
|
profilingState[CURRENT_RUN_ID] = runIdCounter;
|
|
423
417
|
|
|
424
418
|
if (eventLog !== null) {
|
|
425
|
-
logEvent([TaskRunEvent,
|
|
419
|
+
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
|
|
426
420
|
}
|
|
427
421
|
}
|
|
428
422
|
}
|
|
429
|
-
function markTaskYield(task,
|
|
430
|
-
|
|
423
|
+
function markTaskYield(task, ms) {
|
|
424
|
+
{
|
|
431
425
|
profilingState[PRIORITY] = NoPriority;
|
|
432
426
|
profilingState[CURRENT_TASK_ID] = 0;
|
|
433
427
|
profilingState[CURRENT_RUN_ID] = 0;
|
|
434
428
|
|
|
435
429
|
if (eventLog !== null) {
|
|
436
|
-
logEvent([TaskYieldEvent,
|
|
430
|
+
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
|
|
437
431
|
}
|
|
438
432
|
}
|
|
439
433
|
}
|
|
440
|
-
function markSchedulerSuspended(
|
|
441
|
-
|
|
434
|
+
function markSchedulerSuspended(ms) {
|
|
435
|
+
{
|
|
442
436
|
mainThreadIdCounter++;
|
|
443
437
|
|
|
444
438
|
if (eventLog !== null) {
|
|
445
|
-
logEvent([SchedulerSuspendEvent,
|
|
439
|
+
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
|
|
446
440
|
}
|
|
447
441
|
}
|
|
448
442
|
}
|
|
449
|
-
function markSchedulerUnsuspended(
|
|
450
|
-
|
|
443
|
+
function markSchedulerUnsuspended(ms) {
|
|
444
|
+
{
|
|
451
445
|
if (eventLog !== null) {
|
|
452
|
-
logEvent([SchedulerResumeEvent,
|
|
446
|
+
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
|
|
453
447
|
}
|
|
454
448
|
}
|
|
455
449
|
}
|
|
@@ -472,8 +466,6 @@ var taskQueue = [];
|
|
|
472
466
|
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
|
473
467
|
|
|
474
468
|
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
|
475
|
-
|
|
476
|
-
var isSchedulerPaused = false;
|
|
477
469
|
var currentTask = null;
|
|
478
470
|
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
|
|
479
471
|
|
|
@@ -495,7 +487,7 @@ function advanceTimers(currentTime) {
|
|
|
495
487
|
timer.sortIndex = timer.expirationTime;
|
|
496
488
|
push(taskQueue, timer);
|
|
497
489
|
|
|
498
|
-
|
|
490
|
+
{
|
|
499
491
|
markTaskStart(timer, currentTime);
|
|
500
492
|
timer.isQueued = true;
|
|
501
493
|
}
|
|
@@ -527,7 +519,7 @@ function handleTimeout(currentTime) {
|
|
|
527
519
|
}
|
|
528
520
|
|
|
529
521
|
function flushWork(hasTimeRemaining, initialTime) {
|
|
530
|
-
|
|
522
|
+
{
|
|
531
523
|
markSchedulerUnsuspended(initialTime);
|
|
532
524
|
} // We'll need a host callback the next time work is scheduled.
|
|
533
525
|
|
|
@@ -565,7 +557,7 @@ function flushWork(hasTimeRemaining, initialTime) {
|
|
|
565
557
|
currentPriorityLevel = previousPriorityLevel;
|
|
566
558
|
isPerformingWork = false;
|
|
567
559
|
|
|
568
|
-
|
|
560
|
+
{
|
|
569
561
|
var _currentTime = getCurrentTime();
|
|
570
562
|
|
|
571
563
|
markSchedulerSuspended(_currentTime);
|
|
@@ -578,7 +570,7 @@ function workLoop(hasTimeRemaining, initialTime) {
|
|
|
578
570
|
advanceTimers(currentTime);
|
|
579
571
|
currentTask = peek(taskQueue);
|
|
580
572
|
|
|
581
|
-
while (currentTask !== null && !(enableSchedulerDebugging
|
|
573
|
+
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
|
582
574
|
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
|
|
583
575
|
// This currentTask hasn't expired, and we've reached the deadline.
|
|
584
576
|
break;
|
|
@@ -598,7 +590,7 @@ function workLoop(hasTimeRemaining, initialTime) {
|
|
|
598
590
|
currentTask.callback = continuationCallback;
|
|
599
591
|
markTaskYield(currentTask, currentTime);
|
|
600
592
|
} else {
|
|
601
|
-
|
|
593
|
+
{
|
|
602
594
|
markTaskCompleted(currentTask, currentTime);
|
|
603
595
|
currentTask.isQueued = false;
|
|
604
596
|
}
|
|
@@ -745,7 +737,7 @@ function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
|
745
737
|
sortIndex: -1
|
|
746
738
|
};
|
|
747
739
|
|
|
748
|
-
|
|
740
|
+
{
|
|
749
741
|
newTask.isQueued = false;
|
|
750
742
|
}
|
|
751
743
|
|
|
@@ -770,7 +762,7 @@ function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
|
770
762
|
newTask.sortIndex = expirationTime;
|
|
771
763
|
push(taskQueue, newTask);
|
|
772
764
|
|
|
773
|
-
|
|
765
|
+
{
|
|
774
766
|
markTaskStart(newTask, currentTime);
|
|
775
767
|
newTask.isQueued = true;
|
|
776
768
|
} // Schedule a host callback, if needed. If we're already performing work,
|
|
@@ -787,11 +779,9 @@ function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
|
787
779
|
}
|
|
788
780
|
|
|
789
781
|
function unstable_pauseExecution() {
|
|
790
|
-
isSchedulerPaused = true;
|
|
791
782
|
}
|
|
792
783
|
|
|
793
784
|
function unstable_continueExecution() {
|
|
794
|
-
isSchedulerPaused = false;
|
|
795
785
|
|
|
796
786
|
if (!isHostCallbackScheduled && !isPerformingWork) {
|
|
797
787
|
isHostCallbackScheduled = true;
|
|
@@ -804,7 +794,7 @@ function unstable_getFirstCallbackNode() {
|
|
|
804
794
|
}
|
|
805
795
|
|
|
806
796
|
function unstable_cancelCallback(task) {
|
|
807
|
-
|
|
797
|
+
{
|
|
808
798
|
if (task.isQueued) {
|
|
809
799
|
var currentTime = getCurrentTime();
|
|
810
800
|
markTaskCanceled(task, currentTime);
|
|
@@ -830,38 +820,38 @@ function unstable_shouldYield() {
|
|
|
830
820
|
}
|
|
831
821
|
|
|
832
822
|
var unstable_requestPaint = requestPaint;
|
|
833
|
-
var unstable_Profiling =
|
|
823
|
+
var unstable_Profiling = {
|
|
834
824
|
startLoggingProfilingEvents: startLoggingProfilingEvents,
|
|
835
825
|
stopLoggingProfilingEvents: stopLoggingProfilingEvents,
|
|
836
826
|
sharedProfilingBuffer: sharedProfilingBuffer
|
|
837
|
-
}
|
|
827
|
+
} ;
|
|
838
828
|
|
|
839
|
-
exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
|
|
840
|
-
exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields;
|
|
841
|
-
exports.unstable_flushExpired = unstable_flushExpired;
|
|
842
|
-
exports.unstable_clearYields = unstable_clearYields;
|
|
843
|
-
exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint;
|
|
844
|
-
exports.unstable_flushAll = unstable_flushAll;
|
|
845
|
-
exports.unstable_yieldValue = unstable_yieldValue;
|
|
846
|
-
exports.unstable_advanceTime = unstable_advanceTime;
|
|
847
|
-
exports.unstable_ImmediatePriority = ImmediatePriority;
|
|
848
|
-
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
|
849
|
-
exports.unstable_NormalPriority = NormalPriority;
|
|
850
829
|
exports.unstable_IdlePriority = IdlePriority;
|
|
830
|
+
exports.unstable_ImmediatePriority = ImmediatePriority;
|
|
851
831
|
exports.unstable_LowPriority = LowPriority;
|
|
852
|
-
exports.
|
|
853
|
-
exports.
|
|
854
|
-
exports.
|
|
832
|
+
exports.unstable_NormalPriority = NormalPriority;
|
|
833
|
+
exports.unstable_Profiling = unstable_Profiling;
|
|
834
|
+
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
|
835
|
+
exports.unstable_advanceTime = unstable_advanceTime;
|
|
855
836
|
exports.unstable_cancelCallback = unstable_cancelCallback;
|
|
856
|
-
exports.
|
|
857
|
-
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
|
858
|
-
exports.unstable_shouldYield = unstable_shouldYield;
|
|
859
|
-
exports.unstable_requestPaint = unstable_requestPaint;
|
|
837
|
+
exports.unstable_clearYields = unstable_clearYields;
|
|
860
838
|
exports.unstable_continueExecution = unstable_continueExecution;
|
|
861
|
-
exports.
|
|
839
|
+
exports.unstable_flushAll = unstable_flushAll;
|
|
840
|
+
exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
|
|
841
|
+
exports.unstable_flushExpired = unstable_flushExpired;
|
|
842
|
+
exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields;
|
|
843
|
+
exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint;
|
|
844
|
+
exports.unstable_forceFrameRate = forceFrameRate;
|
|
845
|
+
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
|
862
846
|
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
|
847
|
+
exports.unstable_next = unstable_next;
|
|
863
848
|
exports.unstable_now = getCurrentTime;
|
|
864
|
-
exports.
|
|
865
|
-
exports.
|
|
849
|
+
exports.unstable_pauseExecution = unstable_pauseExecution;
|
|
850
|
+
exports.unstable_requestPaint = unstable_requestPaint;
|
|
851
|
+
exports.unstable_runWithPriority = unstable_runWithPriority;
|
|
852
|
+
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
|
853
|
+
exports.unstable_shouldYield = unstable_shouldYield;
|
|
854
|
+
exports.unstable_wrapCallback = unstable_wrapCallback;
|
|
855
|
+
exports.unstable_yieldValue = unstable_yieldValue;
|
|
866
856
|
})();
|
|
867
857
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.19.1
|
|
2
2
|
* scheduler-unstable_mock.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
10
|
+
'use strict';var f=0,g=null,h=null,k=-1,l=null,m=-1,n=!1,p=!1,q=!1,r=!1;function t(){return-1!==m&&null!==l&&l.length>=m||r&&q?n=!0:!1}function x(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;p=!0;try{var b=!0;do b=a(!0,f);while(b);b||(g=null);return!0}finally{p=!1}}else return!1}function z(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0<A(e,b))a[d]=b,a[c]=e,c=d;else break a}}function B(a){a=a[0];return void 0===a?null:a}
|
|
11
|
+
function C(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var u=2*(d+1)-1,v=a[u],w=u+1,y=a[w];if(void 0!==v&&0>A(v,c))void 0!==y&&0>A(y,v)?(a[d]=y,a[w]=c,d=w):(a[d]=v,a[u]=c,d=u);else if(void 0!==y&&0>A(y,c))a[d]=y,a[w]=c,d=w;else break a}}return b}return null}function A(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var D=[],E=[],F=1,G=null,H=3,I=!1,J=!1,K=!1;
|
|
12
|
+
function L(a){for(var b=B(E);null!==b;){if(null===b.callback)C(E);else if(b.startTime<=a)C(E),b.sortIndex=b.expirationTime,z(D,b);else break;b=B(E)}}function M(a){K=!1;L(a);if(!J)if(null!==B(D))J=!0,g=N;else{var b=B(E);null!==b&&(a=b.startTime-a,h=M,k=f+a)}}
|
|
13
|
+
function N(a,b){J=!1;K&&(K=!1,h=null,k=-1);I=!0;var c=H;try{L(b);for(G=B(D);null!==G&&(!(G.expirationTime>b)||a&&!t());){var d=G.callback;if(null!==d){G.callback=null;H=G.priorityLevel;var e=d(G.expirationTime<=b);b=f;"function"===typeof e?G.callback=e:G===B(D)&&C(D);L(b)}else C(D);G=B(D)}if(null!==G)var u=!0;else{var v=B(E);if(null!==v){var w=v.startTime-b;h=M;k=f+w}u=!1}return u}finally{G=null,H=c,I=!1}}
|
|
14
|
+
function O(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_advanceTime=function(a){f+=a;null!==h&&k<=f&&(h(f),k=-1,h=null)};exports.unstable_cancelCallback=function(a){a.callback=null};
|
|
15
|
+
exports.unstable_clearYields=function(){if(null===l)return[];var a=l;l=null;return a};exports.unstable_continueExecution=function(){J||I||(J=!0,g=N)};exports.unstable_flushAll=function(){if(null!==l)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");x();if(null!==l)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};
|
|
16
|
+
exports.unstable_flushAllWithoutAsserting=x;exports.unstable_flushExpired=function(){if(p)throw Error("Already flushing work.");if(null!==g){p=!0;try{g(!1,f)||(g=null)}finally{p=!1}}};exports.unstable_flushNumberOfYields=function(a){if(p)throw Error("Already flushing work.");if(null!==g){var b=g;m=a;p=!0;try{a=!0;do a=b(!0,f);while(a&&!n);a||(g=null)}finally{m=-1,p=n=!1}}};
|
|
17
|
+
exports.unstable_flushUntilNextPaint=function(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;r=!0;q=!1;p=!0;try{var b=!0;do b=a(!0,f);while(b&&!n);b||(g=null)}finally{p=n=r=!1}}};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return H};exports.unstable_getFirstCallbackNode=function(){return B(D)};exports.unstable_next=function(a){switch(H){case 1:case 2:case 3:var b=3;break;default:b=H}var c=H;H=b;try{return a()}finally{H=c}};
|
|
18
|
+
exports.unstable_now=function(){return f};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){q=!0};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=H;H=a;try{return b()}finally{H=c}};
|
|
19
|
+
exports.unstable_scheduleCallback=function(a,b,c){var d=f;if("object"===typeof c&&null!==c){var e=c.delay;e="number"===typeof e&&0<e?d+e:d;c="number"===typeof c.timeout?c.timeout:O(a)}else c=O(a),e=d;c=e+c;a={id:F++,callback:b,priorityLevel:a,startTime:e,expirationTime:c,sortIndex:-1};e>d?(a.sortIndex=e,z(E,a),null===B(D)&&a===B(E)&&(K?(h=null,k=-1):K=!0,h=M,k=f+(e-d))):(a.sortIndex=c,z(D,a),J||I||(J=!0,g=N));return a};
|
|
20
|
+
exports.unstable_shouldYield=function(){var a=f;L(a);var b=B(D);return b!==G&&null!==G&&null!==b&&null!==b.callback&&b.startTime<=a&&b.expirationTime<G.expirationTime||t()};exports.unstable_wrapCallback=function(a){var b=H;return function(){var c=H;H=b;try{return a.apply(this,arguments)}finally{H=c}}};exports.unstable_yieldValue=function(a){null===l?l=[a]:l.push(a)};
|