Consumes the current scheduling hints and returns the next browser yield decision.
(&self, now_ms: f64)
| 165 | |
| 166 | /// Consumes the current scheduling hints and returns the next browser yield decision. |
| 167 | fn take_yield_decision(&self, now_ms: f64) -> YieldDecision { |
| 168 | let mut state = self.0.borrow_mut(); |
| 169 | if state.paint_requested { |
| 170 | state.paint_requested = false; |
| 171 | YieldDecision::Paint |
| 172 | } else if (now_ms - state.last_host_yield_ms) >= Self::MAX_INTERVAL_MILLIS { |
| 173 | YieldDecision::Fairness |
| 174 | } else { |
| 175 | YieldDecision::Continue |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | #[async_trait(?Send)] |