Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for prerendering #3846

Open
magreenblatt opened this issue Nov 28, 2024 · 0 comments
Open

Add support for prerendering #3846

magreenblatt opened this issue Nov 28, 2024 · 0 comments
Labels
enhancement Enhancement request

Comments

@magreenblatt
Copy link
Collaborator

magreenblatt commented Nov 28, 2024

Prerendering is a feature in Chromium where certain URLs can be annotated for loading before they become visible (active) in the browser. We have disabled this feature in CEF because it doesn't currently work with CEF's frame tracking model (see #3664).

To re-enable this functionality we will first need to address the points at #3664 (comment).

The client-facing changes can be summarized as:

  • Prerendering and bfcache'd frames have a CefFrame object where the current state is not active. Add a new CefFrame::GetLifecycleState method to retrieve the current state.
  • CefFrames that are not active will receive OnFrameCreated/OnFrameDestroyed callbacks but not OnFrameAttached/OnFrameDetached callbacks [1]. Load-related callbacks may still occur for prerendering frames that are not active (to the extent that they are loaded during prerendering).
  • CefFrame objects can only communicate with the renderer process (send LoadRequest, SendProcessMessage, GetSource, etc) while active [1]. This requirement will become more explicit and easier to determine by the client.
  • CefFrame objects transition to/from active state via navigation [1]. Add a new CefFrameHandler::OnFrameStateChanged callback (like RenderFrameHostStateChanged) to report the transition between states.
  • The existing OnMainFrameChanged callback is only be called for changes to the current (active) main frame [1]. Maybe rename to something more specific (like OnActiveMainFrameChanged) or remove completely in favor of a frame->IsMain() && frame->GetLifecycleState() == CEF_LS_ACTIVE check in OnFrameStateChanged.

[1] This is already the case for temporary and bfcache'd frames after completion of #3664.

@magreenblatt magreenblatt added the enhancement Enhancement request label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement request
Projects
None yet
Development

No branches or pull requests

1 participant