| OLD | NEW |
| 1 Sky's Run Loop | 1 Sky's Run Loop |
| 2 ============== | 2 ============== |
| 3 | 3 |
| 4 Sky has three task queues, named idle, frame, and nextFrame. | 4 Sky has three task queues, named idle, frame, and nextFrame. |
| 5 | 5 |
| 6 When a task is run, it has a time budget, and if the time budget is | 6 When a task is run, it has a time budget, and if the time budget is |
| 7 exceeded, then a catchable DeadlineExceededException exception is | 7 exceeded, then a catchable DeadlineExceededException exception is |
| 8 fired. | 8 fired. |
| 9 | 9 |
| 10 ```dart | 10 ```dart |
| 11 class DeadlineExceededException implements Exception { } | 11 class DeadlineExceededException implements Exception { } |
| 12 ``` | 12 ``` |
| 13 | 13 |
| 14 There is a method you can use that guards your code against these |
| 15 exceptions: |
| 16 |
| 17 ```dart |
| 18 typedef void Callback(); |
| 19 external guardAgainstDeadlineExceptions(Callback callback); |
| 20 // runs callback. |
| 21 // if the time budget for the _task_ expires while the callback is |
| 22 // running, the callback isn't interrupted, but the method will throw |
| 23 // an exception once the callback returns. |
| 24 ``` |
| 25 |
| 14 When Sky is to *process a task queue until a particular time*, with a | 26 When Sky is to *process a task queue until a particular time*, with a |
| 15 queue *relevant task queue*, bits *filter bits*, a time | 27 queue *relevant task queue*, bits *filter bits*, a time |
| 16 *particular time*, and an *idle rule* which is either "sleep" or | 28 *particular time*, and an *idle rule* which is either "sleep" or |
| 17 "abort", it must run the following steps: | 29 "abort", it must run the following steps: |
| 18 | 30 |
| 19 1. Let *remaining time* be the time until the given *particular time*. | 31 1. Let *remaining time* be the time until the given *particular time*. |
| 20 2. If *remaining time* is less than or equal to zero, exit this | 32 2. If *remaining time* is less than or equal to zero, exit this |
| 21 algorithm. | 33 algorithm. |
| 22 3. Let *task list* be the list of tasks in the *relevant task queue* | 34 3. Let *task list* be the list of tasks in the *relevant task queue* |
| 23 that have bits that, when 'and'ed with *filter bits*, are equal to | 35 that have bits that, when 'and'ed with *filter bits*, are equal to |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 int IdleKind = 0x01; // tasks that should run during the idle loop | 135 int IdleKind = 0x01; // tasks that should run during the idle loop |
| 124 int LayoutKind = 0x02; // tasks that should run during layout | 136 int LayoutKind = 0x02; // tasks that should run during layout |
| 125 int TouchSafeKind = 0x04; // tasks that should keep running while there is a poi
nter down | 137 int TouchSafeKind = 0x04; // tasks that should keep running while there is a poi
nter down |
| 126 int idleTaskBits = IdleKind; // tasks must have all these bits to run during idl
e loop | 138 int idleTaskBits = IdleKind; // tasks must have all these bits to run during idl
e loop |
| 127 int layoutTaskBits = LayoutKind; // tasks must have all these bits to run during
layout | 139 int layoutTaskBits = LayoutKind; // tasks must have all these bits to run during
layout |
| 128 | 140 |
| 129 // possible frame queue task bits | 141 // possible frame queue task bits |
| 130 // (there are none at this time) | 142 // (there are none at this time) |
| 131 int frameTaskBits = 0x00; // tasks must have all these bits to run during the fr
ame loop | 143 int frameTaskBits = 0x00; // tasks must have all these bits to run during the fr
ame loop |
| 132 ``` | 144 ``` |
| OLD | NEW |