| 13633 | } |
| 13634 | |
| 13635 | function addRootToSchedule(root, expirationTime) { |
| 13636 | // Add the root to the schedule. |
| 13637 | // Check if this root is already part of the schedule. |
| 13638 | if (root.nextScheduledRoot === null) { |
| 13639 | // This root is not already scheduled. Add it. |
| 13640 | root.remainingExpirationTime = expirationTime; |
| 13641 | if (lastScheduledRoot === null) { |
| 13642 | firstScheduledRoot = lastScheduledRoot = root; |
| 13643 | root.nextScheduledRoot = root; |
| 13644 | } else { |
| 13645 | lastScheduledRoot.nextScheduledRoot = root; |
| 13646 | lastScheduledRoot = root; |
| 13647 | lastScheduledRoot.nextScheduledRoot = firstScheduledRoot; |
| 13648 | } |
| 13649 | } else { |
| 13650 | // This root is already scheduled, but its priority may have increased. |
| 13651 | var remainingExpirationTime = root.remainingExpirationTime; |
| 13652 | if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) { |
| 13653 | // Update the priority. |
| 13654 | root.remainingExpirationTime = expirationTime; |
| 13655 | } |
| 13656 | } |
| 13657 | } |
| 13658 | |
| 13659 | function findHighestPriorityRoot() { |
| 13660 | var highestPriorityWork = NoWork; |