Unify symbol visibility settings for the COMPONENT_EXPORT macro
Moderate
提交哈希:
edf57482697bfb2777c28ab56977f5c448fa5c2d
提交时间: 2025-05-06 21:23:23+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接:
查看上游审核 🔗
📋 摘要
This submission unifies the modification of all COMPONENT_EXPORT-related header files in Chromium, changing the export symbol visibility from conditional export to always set as visible on non-Windows platforms. Specifically, the change removes the checks for component implementation macros (such as REMOTE_COCOA_APP_SHIM_IMPLEMENTATION, REMOTE_COCOA_BROWSER_IMPLEMENTATION, etc.) on non-Windows platforms, so that all component build export symbols are set to __attribute__((visibility("default"))). This change involves 157 header files, including remote_cocoa, and aims to avoid linker deduplication issues caused by identical symbols being defined in multiple components but only one being visible.
🎯 影响分析
This change has a significant but positive impact on WebView2Mac. Prior to the change, symbol export for Remote Cocoa depended on whether specific implementation macros (REMOTE_COCOA_APP_SHIM_IMPLEMENTATION and REMOTE_COCOA_BROWSER_IMPLEMENTATION) were defined at compile time. After the change, all Remote Cocoa-related symbols will have default visibility during component builds, which means: 1) improved consistency and reliability of symbol linking, reducing runtime issues caused by inconsistent symbol visibility; 2) simplified symbol management for downstream WebView2Mac code, eliminating concerns about whether implementation macros are correctly defined; 3) enhanced compatibility with upstream Remote Cocoa code, reducing integration issues caused by differences in symbol visibility. This change also resolves the new clang -Wunique-object-duplication warning, improving code quality. For WebView2Mac, this is a positive change that will enhance its stability and maintainability.
受影响的类:
REMOTE_COCOA_APP_SHIM_EXPORT
REMOTE_COCOA_BROWSER_EXPORT
COMPONENT_EXPORT_ANNOTATION
COMPONENT_IMPORT_ANNOTATION