Cherry pick PR #8928: Implement basic application preload functionality.#9232
Open
cobalt-github-releaser-bot wants to merge 2 commits intomainfrom
Open
Cherry pick PR #8928: Implement basic application preload functionality.#9232cobalt-github-releaser-bot wants to merge 2 commits intomainfrom
cobalt-github-releaser-bot wants to merge 2 commits intomainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
e1a7e99 to
1fb409b
Compare
Implement background preloading support for instantaneous application launching. This feature allows Cobalt to initialize in a hidden state, deferring heavy resource creation until the application is revealed to the foreground. To further minimize footprint, the splash screen creation is skipped entirely during preloading. - Support starting Cobalt in a background/hidden state via the kSbEventTypePreload signal. - Defer creation of native windows and UI widgets until the application is revealed, minimizing initial memory and CPU footprint. - Skip creation of splash screen WebContents when preloaded to further reduce background resource usage. - Handle kSbEventTypeReveal events to transition the application from a background to a visible state and initialize deferred UI components. - Ensure standard Web APIs (document.visibilityState, document.hidden) correctly reflect the application's hidden state during preloading and its revealed state. - Standardize on visibility state propagation throughout the browser initialization chain (MainDelegate, BrowserClient, MainParts), keeping "preload" logic encapsulated at the Starboard entry point. - Consolidate window creation logic into a private internal helper to ensure consistent initialization for both normal and preloaded startups. - Refactor shell unit tests into a reusable ShellTestBase and extract common mock infrastructure into shell_test_support.h. - Add comprehensive unit tests: - LifecycleTest: Verifies startup states, revelation, and signal idempotency. - SplashScreenTest: Verifies that splash screen is skipped during preloading. - Add a comprehensive automated integration test (test_preload.sh) to verify preloading, revelation, and clean shutdown. - Add detailed documentation for developers, device manufacturers, and web designers in cobalt/doc/preload.md. - Enhanced developer tools with usage examples and captured test output. Bug: 447660888 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> (cherry picked from commit 97ca4ee)
1fb409b to
752144e
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request is a cherry-pick that implements application preloading. This allows Cobalt to start in a hidden background state and defer resource-intensive UI initialization until the application is brought to the foreground, enabling a near-instantaneous startup experience for the user.
The changes are comprehensive and well-executed:
- A new
kSbEventTypePreloadevent is handled to initiate a hidden startup. - The concept of visibility is plumbed through the browser initialization stack, from
CobaltMainDelegatedown to theShellPlatformDelegate. - Platform-specific delegates (
aura,views) are updated to defer native window and widget creation until akSbEventTypeRevealevent is received. - Splash screen creation is correctly skipped during a preload.
- New unit tests (
LifecycleTest) and integration tests (test_preload.sh) have been added to verify the new lifecycle states and visibility transitions. - Existing tests (
SplashScreenTest) have been updated and refactored into a commonShellTestBasefor better reusability. - Detailed documentation for the preload feature has been added.
The implementation appears robust and correct. I have reviewed the changes and found no issues. The code adheres to the project's style and structure.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refer to the original PR: #8928
Implement background preloading support for instantaneous application launching.
This feature allows Cobalt to initialize in a hidden state, deferring heavy resource
creation until the application is revealed to the foreground. To further minimize
footprint, the splash screen creation is skipped entirely during preloading.
minimizing initial memory and CPU footprint.
background resource usage.
to a visible state and initialize deferred UI components.
reflect the application's hidden state during preloading and its revealed state.
chain (MainDelegate, BrowserClient, MainParts), keeping "preload" logic encapsulated
at the Starboard entry point.
consistent initialization for both normal and preloaded startups.
infrastructure into shell_test_support.h.
preloading, revelation, and clean shutdown.
designers in cobalt/doc/preload.md.
Bug: 447660888