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

alloy: Delete Alloy bootstrap (M128) #3685

Closed
magreenblatt opened this issue Apr 22, 2024 · 17 comments
Closed

alloy: Delete Alloy bootstrap (M128) #3685

magreenblatt opened this issue Apr 22, 2024 · 17 comments
Labels
alloy Related to the Alloy runtime task Task to be performed

Comments

@magreenblatt
Copy link
Collaborator

magreenblatt commented Apr 22, 2024

Starting with M125 the CEF Alloy runtime has been split into separate style and bootstrap components. Both Chrome style and Alloy style browsers/windows can now be created while using the Chrome bootstrap. The Alloy bootstrap is considered deprecated and has been removed starting with the M128 release.

Background

CEF currently supports two bootstraps, the Chrome bootstrap and the Alloy bootstrap. Alloy bootstrap usage has been required up to this point for use cases such as external (native) parent and windowless (off-screen) rendering. Starting with M125 it is now possible to create Alloy style browsers for these use cases while running with the Chrome bootstrap. The final step of this migration process is the removal of Alloy bootstrap code in current master (M128 release).

Running with the Alloy bootstrap (CefSettings.chrome_runtime = false) will generate a warning message starting with M125. The message looks like this:

[WARNING:main_runner.cc(272)] Alloy bootstrap is deprecated and will be removed in ~M127. See https://github.com/chromiumembedded/cef/issues/3685

Testing

The CEF Sample Application (cefclient on Windows/MacOS, cefsimple on Linux) is available for download here and supports the Chrome and Alloy bootstraps as specified below. Additional test applications, including CEF unit tests (ceftests), can be built and run using the Standard Distribution.

  • Chrome bootstrap is supported but default disabled in cefclient & cefsimple versions 125.0.11 and older. To test the Chrome bootstrap in these versions add the --enable-chrome-runtime command-line flag.
  • Chrome bootstrap is default enabled in cefclient & cefsimple versions 125.0.14 and newer. To test the Alloy bootstrap in these versions add the --disable-chrome-runtime command-line flag.

Chrome bootstrap + Chrome style is supported in all recent versions (add --enable-chrome-runtime if required). Modes supported with Chrome bootstrap + Chrome style:

  • Views framework: Enabled by default (cefclient & cefsimple)
  • External (native) parent: Add --use-native (cefclient only & Windows/Linux only)
  • Fully styled Chrome UI window: Add --use-native (cefsimple only)

Chrome bootstrap + Alloy style is supported but default disabled in versions 125.0.8 and newer (add --use-alloy-style to enable, and --enable-chrome-runtime if required). Modes supported with Chrome bootstrap + Alloy style:

  • Views framework: Enabled by default with cefclient, add --use-views with cefsimple
  • Windowless (off-screen) rendering: Add --off-screen-rendering-enabled (cefclient only)
  • External (native) parent: Enabled by default with cefsimple, add --use-native with cefclient

See here for additional testing instructions including various runtime modes and unit test commands.

Migration Route

Windowed applications using Alloy style may wish to use Chrome style as it provides substantially more default functionality (details here). To switch a windowed application from Alloy style to Chrome style simply set CefSettings.chrome_runtime = true before calling CefInitialize.

Migrating an application from the Alloy bootstrap to the Chrome bootstrap while keeping Alloy style is a bit more involved. Here are the steps:

  1. Set CefSettings.chrome_runtime = true before calling CefInitialize.
  2. Make the following changes depending on your Alloy usage:
    • With external parent: Set CefWindowInfo.runtime_style = CEF_RUNTIME_STYLE_ALLOY before calling CefBrowserHost::CreateBrowser.
    • With windowless rendering: Alloy style is used by default.
    • With the Views framework: Return CEF_RUNTIME_STYLE_ALLOY from CefWindowDelegate::GetWindowRuntimeStyle and CefBrowserViewDelegate::GetBrowserRuntimeStyle.

What's Different

Chrome bootstrap + Alloy style behavior differs from Alloy bootstrap in the following significant ways:

  • Supports Chrome error pages by default.
  • DevTools popups are Chrome style only (cannot be windowless).
  • The Alloy extension API is not supported (has been removed in M128). The Chrome extension API is supported with Chrome style browsers/windows only.

Known issues specific to Chrome bootstrap + Alloy style:

  • DevTools popups don't load successfully in combination with windowless rendering. Use windowed rendering or remote debugging as a workaround. (fixed in 99c85e3)

Reporting Issues

If you run into any additional issues while migrating your application to the Chrome bootstrap please let us know by posting on the CEF Forum or filing a bug in the CEF issue tracker.

@magreenblatt magreenblatt added enhancement Enhancement request alloy Related to the Alloy runtime labels Apr 22, 2024
@magreenblatt
Copy link
Collaborator Author

Decide how to handle features that are currently default-disabled with Alloy bootstrap.

  • CalculateNativeWinOcclusion should be disabled for browsers with Alloy style windowless rendering or native parent.
  • BackForwardCache can be enabled by default with Chrome runtime + Alloy style.
  • DocumentPictureInPictureAPI should be disabled for all browsers with Alloy style.

@magreenblatt magreenblatt added task Task to be performed and removed enhancement Enhancement request labels Apr 22, 2024
magreenblatt added a commit that referenced this issue May 1, 2024
Set enable_alloy_bootstrap=false to build with Alloy bootstrap code
removed. Extension API is documented as deprecated in comments but
not compiled out with this arg.
magreenblatt added a commit that referenced this issue May 1, 2024
Include cef_config.h from base/cef_build.h and fix detection of
args.gn changes so that defines are available everywhere by default.

Fix include configuration for chrome_elf_set and sandbox targets.
@magreenblatt
Copy link
Collaborator Author

magreenblatt commented May 2, 2024

CalculateNativeWinOcclusion should be disabled for browsers with Alloy style windowless rendering or native parent.

We can leave this as the default (enabled) for now, until/unless anyone spots issues related to it. It can also be disabled globally be passing --disable-features=CalculateNativeWinOcclusion on the command-line.

@magreenblatt
Copy link
Collaborator Author

magreenblatt commented May 2, 2024

DocumentPictureInPictureAPI should be disabled for all browsers with Alloy style.

Unfortunately document PiP can't be disabled on a per-browser basis. There are two way to handle this currently with Alloy style (in OnBeforePopup when target_disposition == CEF_WOD_NEW_PICTURE_IN_PICTURE):

  1. Return true. This will cause document PiP to fail with DOMException: Failed to execute 'requestWindow' on 'DocumentPictureInPicture': Internal error: no window
  2. Use default handling (current cefclient implementation). This will cause the document PiP window to open with default Alloy styling.

Document PiP can also be disabled globally be passing --disable-features=DocumentPictureInPictureAPI on the command-line, resulting in ReferenceError: documentPictureInPicture is not defined.

See issue #3448 for reproduction steps.

@magreenblatt
Copy link
Collaborator Author

magreenblatt commented May 2, 2024

Verify that Chrome bootstrap supports all CefSettings.

The following CefSettings parameters are not yet implemented for Chrome bootstrap:

  • browser_subprocess_path (DONE)
  • framework_dir_path (DONE)
  • main_bundle_path (DONE)
  • persist_user_preferences (will be removed; always enabled with Chrome bootstrap)
  • log_file (DONE) (--log-file is already supported)
  • log_severity (DONE) (--log-level is already supported)
  • log_items (DONE)
  • resources_dir_path (DONE)
  • locales_dir_path (DONE)
  • pack_loading_disabled (will be removed; unsupported)

@magreenblatt
Copy link
Collaborator Author

magreenblatt commented May 2, 2024

Also need to add Chrome bootstrap support for CefResourceBundleHandler (by passing CefResourceBundleDelegate to InitSharedInstanceWithLocale here and here). This would also potentially allow us to support pack_loading_disabled, if we disabled resource-related code in those locations and moved it to ChromeMainDelegateCef.

magreenblatt added a commit that referenced this issue May 3, 2024
Also enables logging by default for Release builds (previously
required the `--enable-logging` flag). Logging can still be
disabled by passing the `--disable-logging` flag.
magreenblatt added a commit that referenced this issue May 3, 2024
Alloy bootstrap is deprecated and will be removed in ~M127.
@magreenblatt
Copy link
Collaborator Author

magreenblatt commented May 3, 2024

All prep work is now complete (in current master) for the removal of Alloy bootstrap in ~127.

magreenblatt added a commit that referenced this issue May 3, 2024
The Alloy extension API is deprecated and these tests have not been
supported for some time.
magreenblatt added a commit that referenced this issue May 3, 2024
Now that args.gn is an input to the make_config_header target we
don't want to invalidate the build unnecessarily by modifying the
file if the contents are unchanged.
@magreenblatt magreenblatt changed the title alloy: Delete Alloy bootstrap alloy: Delete Alloy bootstrap (~M127) May 3, 2024
@magreenblatt
Copy link
Collaborator Author

@magreenblatt magreenblatt changed the title alloy: Delete Alloy bootstrap (~M127) alloy: Delete Alloy bootstrap (M128) Jul 2, 2024
@magreenblatt
Copy link
Collaborator Author

Would it be possible to update the issue to explicitly say which version alloy will be removed in?

Sure. The changes have landed in current master, so the first impacted release branch will be M128.

@amaitland
Copy link
Contributor

Thank you!

magreenblatt added a commit that referenced this issue Jul 5, 2024
Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
magreenblatt added a commit that referenced this issue Jul 5, 2024
After Alloy bootstrap deletion the remaining functions are no longer
related to extensions. This change is a functional no-op.
magreenblatt added a commit that referenced this issue Jul 5, 2024
Use more specific file naming. This change is a functional no-op.
magreenblatt added a commit that referenced this issue Jul 5, 2024
Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
magreenblatt added a commit that referenced this issue Jul 5, 2024
- Add CEF info to existing chrome://version WebUI.
- Move chrome://license handling to WebUI.
- Remove chrome://webui-hosts; use chrome://chrome-urls instead.
- Remove chrome://extension-support; navigate to docs directly instead.
magreenblatt added a commit that referenced this issue Jul 5, 2024
Use BUILDFLAG(ENABLE_CEF) exclusively in patch files.
@magreenblatt
Copy link
Collaborator Author

The Architecture Wiki page has been updated for Alloy bootstrap removal.

magreenblatt added a commit to chromiumembedded/cef-project that referenced this issue Aug 2, 2024
Enable Chrome bootstrap and update command-line flags. Views and
Chrome style are now enabled by default.

- Add `--use-alloy-style` to use Alloy style.
- Add `--use-native` to use a native parent window.

See chromiumembedded/cef#3685 for details
on the Alloy bootstrap removal.
@JCYang
Copy link
Contributor

JCYang commented Aug 8, 2024

  • locales_dir_path
    Hi, in the post 'locales_dir_path' and 'resource_dir_path' are marked as 'DONE', but I've tested the 128.0.6613.18 preview build from https://cef-builds.spotifycdn.com/index.html#linux64 lately, it doesn't work, not yet contained in this build?

more accurately speaking, it is 'resource_dir_path' not working as expected.

@magreenblatt
Copy link
Collaborator Author

more accurately speaking, it is 'resource_dir_path' not working as expected.

See #3749

@ybj1998
Copy link

ybj1998 commented Sep 19, 2024

Is windowless rendering still support since M128?

@amaitland
Copy link
Contributor

Is windowless rendering still support since M128?

Yes, with alloy styling.

@rygo6
Copy link

rygo6 commented Nov 11, 2024

I am trying to upgrade a CEF 126 application to the newest CEF which uses these setting:

.cef_window_info_t.windowless_rendering_enabled = true
.cef_window_info_t.shared_texture_enabled = true

Your comment here:

With windowless rendering: Alloy style is used by default.

Makes me believe this should just work and automatically use the correct defaults?
But that doesn't seem to be the case.

Previously I was doing this to bootstrap the browser:

    assert(cef_currently_on(TID_UI));
    cef_browser_t* browser = cef_browser_host_create_browser_sync(&window_info, (struct _cef_client_t*) &client, &cef_url, &browser_settings, NULL, NULL);
    cef_browser_host_t* browser_host = browser->get_host(browser);

However now it asserts a failure of the main method not being on the TID_UI thread. Is there some way to get the main method to be on the TID_UI thread again?

However, I also tried initializing an alternative route by calling cef_browser_host_create_browser and continuing setup in cef_render_process_handler_t.on_browser_created.

Unfortunately, that seems to not work either, on_browser_created never gets called.

Is there some additional step to make this new chrome runtime work with windowless shared texture applications that I am missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alloy Related to the Alloy runtime task Task to be performed
Projects
None yet
Development

No branches or pull requests

6 participants