perf(app): skip unchanged software web frames

This commit is contained in:
2026-05-16 04:36:49 -04:00
parent 91df575cf8
commit 654f661237
5 changed files with 134 additions and 43 deletions
@@ -9,7 +9,9 @@ use super::{
web_surface_geometry::{
WebSurfaceClickPoint, WebSurfaceScrollDelta, WebSurfaceScrollOffset, WebSurfaceSize,
},
web_surface_metadata::WebSurfacePageMetadata,
web_surface_permissions::WebSurfaceSitePermission,
web_surface_runtime::WebSurfaceUrlChange,
};
pub(super) struct WebSurfaceScrollState {
@@ -101,6 +103,13 @@ pub(super) enum WebSurfaceState {
Failed { message: String },
}
#[derive(Default)]
pub(super) struct WebSurfaceTickResult {
pub(super) changed: bool,
pub(super) url_changes: Vec<WebSurfaceUrlChange>,
pub(super) page_metadata: Vec<WebSurfacePageMetadata>,
}
/// All per-tab surface invariants in one owner.
///
/// Replaces the previous 11 parallel `BTreeMap<TabId, _>` fields on
@@ -179,6 +188,13 @@ impl PerTabSurface {
self.last_ensure_key = Some(key);
}
pub(super) fn matches_ready(&self, frame: &WebSurfaceFrame) -> bool {
match self.state.as_ref() {
Some(WebSurfaceState::Ready(current)) => current.has_same_software_render_as(frame),
_ => false,
}
}
fn has_pending_input(&self) -> bool {
self.hover_point.is_some()
|| self.click_point.is_some()