Add base/notreached.h header to files using NOTREACHED (IWYU)
Minor
Commit Hash:
f22815ca430343edd031fb2c4de7f64acafa8456
Commit Time: 2025-12-06 02:32:25+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This commit is an IWYU (Include What You Use) refactoring that explicitly adds #include "base/notreached.h" to 57 files that use the NOTREACHED() macro. These changes are in preparation for an upcoming //mojo change that will remove certain transitive includes, which would break the build for these files if notreached.h is not explicitly included.
In Remote Cocoa related changes, only one file is affected: components/remote_cocoa/common/font_mojom_traits.h. This file adds #include "base/notreached.h" because its ToMojom() method's switch statement uses the NOTREACHED() macro. Additionally, the file fixes an extra space in the #endif comment (from "// COMPONENTS_" to "// COMPONENTS_").
In Remote Cocoa related changes, only one file is affected: components/remote_cocoa/common/font_mojom_traits.h. This file adds #include "base/notreached.h" because its ToMojom() method's switch statement uses the NOTREACHED() macro. Additionally, the file fixes an extra space in the #endif comment (from "// COMPONENTS_" to "// COMPONENTS_").
🎯 Impact Analysis
This change has minimal impact on WebView2Mac and is purely a build dependency maintenance effort with no functional logic changes:
1. **Header Dependency Update**: components/remote_cocoa/common/font_mojom_traits.h is a Mojo traits file used for converting between gfx::Font, gfx::PlatformFontMac::SystemFontType, gfx::Font::Weight and their corresponding Mojo types. Adding notreached.h only satisfies compilation dependencies without changing any runtime behavior.
2. **Impact on WebView2Mac**: Although WebView2Mac uses font-related Mojo interfaces through Remote Cocoa for cross-process communication (e.g., handling font settings for windows and views in HostingNSWindowBridge), this change:
- Does not modify any Mojo interface definitions
- Does not alter the conversion logic of EnumTraits or StructTraits
- Does not affect any public APIs of Remote Cocoa
- Only ensures the code will continue to compile after future Mojo refactoring
3. **Compatibility**: This change is backward compatible and will not break existing downstream code. WebView2Mac's Remote Cocoa integration requires no adjustments.
4. **Code Quality Improvement**: Fixing the #endif comment format is a minor code style improvement that conforms to Chromium coding standards.
1. **Header Dependency Update**: components/remote_cocoa/common/font_mojom_traits.h is a Mojo traits file used for converting between gfx::Font, gfx::PlatformFontMac::SystemFontType, gfx::Font::Weight and their corresponding Mojo types. Adding notreached.h only satisfies compilation dependencies without changing any runtime behavior.
2. **Impact on WebView2Mac**: Although WebView2Mac uses font-related Mojo interfaces through Remote Cocoa for cross-process communication (e.g., handling font settings for windows and views in HostingNSWindowBridge), this change:
- Does not modify any Mojo interface definitions
- Does not alter the conversion logic of EnumTraits or StructTraits
- Does not affect any public APIs of Remote Cocoa
- Only ensures the code will continue to compile after future Mojo refactoring
3. **Compatibility**: This change is backward compatible and will not break existing downstream code. WebView2Mac's Remote Cocoa integration requires no adjustments.
4. **Code Quality Improvement**: Fixing the #endif comment format is a minor code style improvement that conforms to Chromium coding standards.
Impacted Classes:
remote_cocoa::mojom::FontDataView
remote_cocoa::mojom::SystemFont
remote_cocoa::mojom::FontWeight
gfx::Font (Mojo traits)
gfx::PlatformFontMac::SystemFontType (Mojo traits)