Remove redundant state from NativeWidgetNSWindowBridge, move deduplication to Host side

提交: afae3985 | 2026-04-30 15:06:08

← 返回列表

Remove redundant state from NativeWidgetNSWindowBridge, move deduplication to Host side

Moderate
提交哈希: afae3985c9367b6c46046930d11139d695b5d558
提交时间: 2026-04-30 15:06:08
影响等级: Moderate
生成工具: chromium-watcher
上游审核链接: 查看上游审核 🔗

📋 摘要

This commit removes three state variables (window_on_active_space_, window_zoomed_, visible_on_all_spaces_) from NativeWidgetNSWindowBridge that were used to avoid sending redundant IPCs. The responsibility for skipping redundant updates is moved entirely to NativeWidgetMacNSWindowHost. The Bridge no longer caches these states for comparison and always forwards notifications via host_->. The Host side gains early-out checks in OnVisibilityChanged, OnSpaceActivationChanged, OnWindowMiniaturizedChanged, and OnWindowZoomedChanged. This is a preparatory step toward removing window_visible_ to enable asynchronous visibility changes.

🎯 影响分析

This change has moderate impact on WebView2Mac. NativeWidgetNSWindowBridge is a high-risk dependency for WebView2Mac, and removal of its member variables will cause merge conflicts downstream. The Edge downstream currently retains window_on_active_space_, window_zoomed_, and visible_on_all_spaces_ in the Bridge header, and the Host-side callbacks (OnVisibilityChanged, OnSpaceActivationChanged, OnWindowMiniaturizedChanged, OnWindowZoomedChanged) lack the early-out deduplication guards. When merging, both sides must be updated in sync: remove Bridge-side state variables and add Host-side guards. Since the Mojo interface itself is unchanged, there are no new API incompatibilities—this is purely an internal implementation refactor. However, this commit is part of a larger effort to remove window_visible_ and make visibility changes asynchronous, so follow-up commits may have greater impact.

受影响的类:

remote_cocoa::NativeWidgetNSWindowBridge NativeWidgetMacNSWindowHost