How Chromium Tab Freezing Pauses Timers and Animations
This article explains the technical mechanisms behind Chromium's Tab Freezing feature, focusing on how the browser suspends CPU-intensive timers and animations after five minutes of background inactivity. By transitioning inactive tabs into a frozen lifecycle state, Chromium halts JavaScript execution, pauses rendering pipelines, and suspends task queues to significantly reduce CPU usage and battery drain without losing the user's current page state or requiring a full page reload upon return.
The Five-Minute Inactivity Trigger
When you switch away from a tab in a Chromium-based browser, the tab immediately enters a "Hidden" state. At this point, the browser applies standard background throttling, which limits how often JavaScript timers can fire.
Simultaneously, Chromium starts an internal five-minute countdown. If the tab remains in the background and stays completely inactive for those five minutes, the browser initiates the Tab Freezing process. This process is governed by the Page Lifecycle API, which transitions the tab from a "Hidden" state to a "Frozen" state.
The freeze Event
Execution
Right before Chromium suspends the tab's processes, it dispatches a
freeze event to the document. This gives the webpage a tiny
fraction of a second to execute final synchronous tasks. Developers use
this event to preserve user data to localStorage, close
open IndexedDB transactions, or cleanly disconnect from servers before
the CPU access is entirely cut off. Once the freeze event
finishes executing, the suspension begins.
Suspending CPU Timers
In Chromium, a webpage's activities are managed by the Blink
Scheduler, which organizes work into different task queues on the main
thread. CPU timers—specifically JavaScript functions like
setTimeout() and setInterval()—rely on these
task queues to execute their callbacks at specified times.
When the five-minute mark is reached and the tab freezes, the Blink Scheduler pauses the task queues associated with that specific tab's frame.
- Timer Queue Suspension: Any pending
setTimeoutorsetIntervalcallbacks are locked in place. The internal clock for these timers stops ticking, and the browser refuses to push these tasks to the CPU for execution. - Zero CPU Allocation: Because the task queues are paused at the scheduler level, the tab's renderer process consumes zero CPU cycles for script execution.
- Queue Preservation: The tasks are not deleted; they are simply held in memory. When you eventually return to the tab, the queues are unpaused, and expired timers will fire immediately.
Halting Animations
Animations on the web are generally driven by two mechanisms:
JavaScript's requestAnimationFrame() and CSS
transitions/animations. Chromium handles both to ensure a frozen tab
does not waste system resources rendering invisible graphics.
- JavaScript Animations: The
requestAnimationFrame()API is designed to sync with the display's refresh rate. Chromium actually pausesrequestAnimationFrame()callbacks almost immediately when a tab is hidden. However, Tab Freezing guarantees that any fallback timer-based animations (developers usingsetIntervalto move elements) are also completely stopped at the five-minute mark. - CSS and Web Animations: CSS animations often run on
the browser's compositor thread rather than the main JavaScript thread.
When a tab is frozen, Chromium stops sending
BeginFramesignals to the tab's renderer process. Without these signals, the compositor thread halts all rendering updates, freezing CSS animations and WebGL contexts on their exact current frame.
Exceptions to Tab Freezing
Chromium will not freeze a background tab at the five-minute mark if the tab is actively performing critical background work that the user relies on. A tab is exempt from freezing if it is:
- Playing audio or video.
- Using WebRTC for real-time communication (like a voice or video call).
- Connected to an external device via WebUSB, WebBluetooth, or WebHID.
- Holding a Web Lock or an active IndexedDB transaction (to prevent stops that would block other active tabs from accessing the same database).
- Capturing the screen, window, or microphone.
Resuming the Tab
The moment a user clicks on a frozen tab, bringing it back to the
foreground, Chromium immediately unpauses the Blink Scheduler's task
queues and resumes sending BeginFrame signals. The browser
fires a resume event on the document, delayed CPU timers
execute, and animations continue seamlessly from where they left
off.