perf(web-surface): adapt shell tick cadence

This commit is contained in:
2026-05-15 23:42:48 -04:00
parent 225a998642
commit 06e947f43e
6 changed files with 115 additions and 28 deletions
+10 -1
View File
@@ -1,4 +1,5 @@
use std::{collections::BTreeMap, time::Instant};
use std::collections::BTreeMap;
use std::time::{Duration, Instant};
use ely_domain::{BrowserTab, TabId};
use gpui::{Bounds, Pixels, Point};
@@ -7,6 +8,7 @@ use crate::services::ProfileDataMode;
use super::web_surface_metadata::WebSurfacePageMetadata;
use super::{
web_surface_cadence::IDLE_POLL_INTERVAL,
web_surface_frame::WebSurfaceFrame,
web_surface_geometry::{WebSurfaceClickPoint, WebSurfaceScrollDelta, WebSurfaceSize},
web_surface_permissions::WebSurfaceSitePermission,
@@ -149,6 +151,13 @@ impl WebSurfaceStore {
result
}
pub(super) fn next_tick_delay(&self, visible_tab_ids: &[TabId]) -> Duration {
self.runtime
.next_poll_delay(visible_tab_ids, Instant::now())
.unwrap_or(IDLE_POLL_INTERVAL)
.min(IDLE_POLL_INTERVAL)
}
pub(super) fn retain_tabs(&mut self, open_tab_ids: &[TabId]) {
let stale_tab_ids = self
.surfaces