Skip to content

Cherry pick PR #8928: Implement basic application preload functionality.#9232

Open
cobalt-github-releaser-bot wants to merge 2 commits intomainfrom
cherry-pick-main-8928
Open

Cherry pick PR #8928: Implement basic application preload functionality.#9232
cobalt-github-releaser-bot wants to merge 2 commits intomainfrom
cherry-pick-main-8928

Conversation

@cobalt-github-releaser-bot
Copy link
Collaborator

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.

  • 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

@cobalt-github-releaser-bot

This comment was marked as resolved.

@github-actions

This comment was marked as duplicate.

@jellefoks jellefoks force-pushed the cherry-pick-main-8928 branch from e1a7e99 to 1fb409b Compare February 26, 2026 18:20
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)
@jellefoks jellefoks force-pushed the cherry-pick-main-8928 branch from 1fb409b to 752144e Compare February 26, 2026 21:52
@jellefoks jellefoks marked this pull request as ready for review February 27, 2026 00:03
@jellefoks jellefoks requested review from a team as code owners February 27, 2026 00:03
@jellefoks jellefoks enabled auto-merge (squash) February 27, 2026 00:03
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 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 kSbEventTypePreload event is handled to initiate a hidden startup.
  • The concept of visibility is plumbed through the browser initialization stack, from CobaltMainDelegate down to the ShellPlatformDelegate.
  • Platform-specific delegates (aura, views) are updated to defer native window and widget creation until a kSbEventTypeReveal event 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 common ShellTestBase for 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.

@datadog-cobalt-youtube
Copy link

datadog-cobalt-youtube bot commented Feb 27, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

🧪 1 Test failed

UnknownTest from UnknownSuite (Datadog) (Fix with Cursor)
Test crashed

No crash detected in test log.

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 85a29b4 | Docs | Was this helpful? Give us feedback!

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