Search code examples
windowschromium-embedded

Customize CEF build and remove unused Chromium features


I need to compile cef3 with minimal features. I don't need print/media/devtools etc features. How can I disable it during the build? Using cef3 without disabling other features consumes ~100MB memory for single instance so it's not usable if the application is intended for multiple instances.

I want to reduce the memory usage of cef3.

I looked into BUILD.gn and gni files but could not locate a place for disabling features.


Solution

  • I don't think it will be easy to disable the mentioned features. But here are a few things you can try:

    1) run python automate-git.py --help to give you a list of options on how to make the build run faster

    2) check the file cef\tests\shared\common\client_switches.cc for some of the supported command line switches. I'll quote from that file:

    // CEF and Chromium support a wide range of command-line switches. This file
    // only contains command-line switches specific to the cefclient application.
    // View CEF/Chromium documentation or search for *_switches.cc files in the
    // Chromium source code to identify other existing command-line switches.
    // Below is a partial listing of relevant *_switches.cc files:
    //   base/base_switches.cc
    //   cef/libcef/common/cef_switches.cc
    //   chrome/common/chrome_switches.cc (not all apply)
    //   content/public/common/content_switches.cc
    

    3) see List of Chromium Command Line Switches - You'll find many useful CLI switches like --disable-extensions

    4) I also found Electron - Supported Chrome Command Line Switches which mentions --disable-http2 and according to this stackoverflow post it actually works.

    P.S. I don't think you can easily remove features during the build process.