| 13726 | } |
| 13727 | |
| 13728 | function addRootToSchedule(root, expirationTime) { |
| 13729 | // Add the root to the schedule. |
| 13730 | // Check if this root is already part of the schedule. |
| 13731 | if (root.nextScheduledRoot === null) { |
| 13732 | // This root is not already scheduled. Add it. |
| 13733 | root.remainingExpirationTime = expirationTime; |
| 13734 | if (lastScheduledRoot === null) { |
| 13735 | firstScheduledRoot = lastScheduledRoot = root; |
| 13736 | root.nextScheduledRoot = root; |
| 13737 | } else { |
| 13738 | lastScheduledRoot.nextScheduledRoot = root; |
| 13739 | lastScheduledRoot = root; |
| 13740 | lastScheduledRoot.nextScheduledRoot = firstScheduledRoot; |
| 13741 | } |
| 13742 | } else { |
| 13743 | // This root is already scheduled, but its priority may have increased. |
| 13744 | var remainingExpirationTime = root.remainingExpirationTime; |
| 13745 | if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) { |
| 13746 | // Update the priority. |
| 13747 | root.remainingExpirationTime = expirationTime; |
| 13748 | } |
| 13749 | } |
| 13750 | } |
| 13751 | |
| 13752 | function findHighestPriorityRoot() { |
| 13753 | var highestPriorityWork = NoWork; |