Unify symbol visibility settings for the COMPONENT_EXPORT macro
Moderate
Commit Hash:
edf57482697bfb2777c28ab56977f5c448fa5c2d
Commit Time: 2025-05-06 21:23:23+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
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.
🎯 Impact Analysis
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.
Impacted Classes:
REMOTE_COCOA_APP_SHIM_EXPORT
REMOTE_COCOA_BROWSER_EXPORT
COMPONENT_EXPORT_ANNOTATION
COMPONENT_IMPORT_ANNOTATION