Skip to content

Conversation

@borongc
Copy link
Contributor

@borongc borongc commented Nov 4, 2025

Prevent CobaltWebContentsObserver and CobaltWebContentsDelegate from
attaching to the splash screen WebContents. The splash screen does not
require the full suite of Cobalt-specific browser event handling or
delegation, ensuring resources are allocated only where necessary.

Issue: 441738743

@borongc
Copy link
Contributor Author

borongc commented Nov 4, 2025

/generate-commit-message

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🤖 Gemini Suggested Commit Message


cobalt: Only observe WebContents on main app

Prevent CobaltWebContentsObserver and CobaltWebContentsDelegate from
attaching to the splash screen WebContents. The splash screen does not
require the full suite of Cobalt-specific browser event handling or
delegation, ensuring resources are allocated only where necessary.

@borongc
Copy link
Contributor Author

borongc commented Nov 4, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to optimize resource usage by preventing observers from attaching to the splash screen's WebContents. However, the current implementation has a critical flaw: it checks for the splash screen by inspecting the main frame's name within the OnWebContentsCreated callback, but at this stage of the WebContents lifecycle, the main frame has not yet been created. This means the check will always fail, and the optimization will not be effective. I have provided a critical review comment detailing this issue and suggesting a more robust solution using the WebContentsUserData pattern, which is standard practice in Chromium for such cases. Additionally, I've noted an inconsistency where the logic is unnecessarily restricted to Android, which would prevent the optimization from working on other platforms.

@johnxwork johnxwork merged commit c3f3108 into youtube:26.android Nov 4, 2025
201 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants