void PageThrottler::setThrottled(bool isThrottled) { if (isThrottled) { m_throttleState = PageWaitingToThrottleState; startThrottleHysteresisTimer(); } else { unthrottlePage(); stopThrottleHysteresisTimer(); } }
void PageThrottler::preventThrottling() { // If we've already got events that block throttling we can increment // and return early if (m_activeThrottleBlockers++) return; if (m_throttleState == PageNotThrottledState) return; if (m_throttleState == PageThrottledState) unthrottlePage(); m_throttleState = PageWaitingToThrottleState; stopThrottleHysteresisTimer(); }
void PageThrottler::addActivityToken(PageActivityAssertionToken* token) { ASSERT(token && !m_activityTokens.contains(token)); m_activityTokens.add(token); // If we've already got events that block throttling we can return early if (m_activityTokens.size() > 1) return; if (m_throttleState == PageNotThrottledState) return; if (m_throttleState == PageThrottledState) unthrottlePage(); m_throttleState = PageWaitingToThrottleState; stopThrottleHysteresisTimer(); }