Plumb the refresh rate change to ExternalBeginFrameSourceMac via IPC

提交: f5df2996 | 2026-04-30 17:52:10

← 返回列表

Plumb the refresh rate change to ExternalBeginFrameSourceMac via IPC

Moderate
提交哈希: f5df2996766bb4af356663ae173765e157ba089b
提交时间: 2026-04-30 17:52:10
影响等级: Moderate
生成工具: chromium-watcher
上游审核链接: 查看上游审核 🔗

📋 摘要

This commit lays groundwork for CADisplayLink performance optimization on macOS. Due to GPU sandbox restrictions, NSApplicationDidChangeScreenParametersNotification cannot be used in the GPU process, so the Browser process now listens for refresh rate changes and propagates them to the GPU process via DisplayPrivate Mojo IPC. Key changes:
1. Adds RefreshRateChangedOnSameDisplay() to DisplayPrivate mojom
2. RecyclableCompositorMac::UpdateSurface() gains a new bool refresh_rate_changed_on_same_display parameter
3. BrowserCompositorMac::UpdateSurfaceFromNSView() gains the same parameter
4. NativeWidgetMacNSWindowHost::OnWindowDisplayChanged() adds refresh rate change detection logic
5. ScreenInfo mojom gains a display_frequency field with float precision on macOS
6. DisplayChangeNotifier adds DISPLAY_METRIC_REFRESH_RATE change detection

🎯 影响分析

Moderate impact on WebView2Mac. Key risk areas:
1. RecyclableCompositorMac::UpdateSurface() signature change — downstream Edge code in NativeWidgetMacNSWindowHost calls this method in both UpdateCompositorProperties() and OnWindowDisplayChanged(), requiring all call sites to pass the new parameter during merge.
2. NativeWidgetMacNSWindowHost::OnWindowDisplayChanged() logic change — this method now detects refresh rate changes before updating display_, which may cause merge conflicts if downstream has modifications to this method.
3. ScreenInfo mojom gains a display_frequency field — if WebView2 transmits ScreenInfo across processes, serialization compatibility must be verified.
4. ui::Compositor gains RefreshRateChangedOnSameDisplay() and RootCompositorFrameSinkImpl implements the corresponding interface — this is purely additive and does not affect existing call paths.
5. BrowserCompositorMac::UpdateSurfaceFromNSView() signature change affects callers in RenderWidgetHostViewMac; any downstream customization to RWHV must adapt.
Overall, the signature changes are compile-time detectable, and the functionality is additive — it does not alter existing rendering behavior.

受影响的类:

NativeWidgetMacNSWindowHost RecyclableCompositorMac BrowserCompositorMac ui::Compositor RootCompositorFrameSinkImpl ExternalBeginFrameSourceMac display::ScreenInfo