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