自定义 CEF 构建并删除未使用的 Chromium 功能

Customize CEF build and remove unused Chromium features

我需要编译具有最少功能的cef3。我不需要 print/media/devtools 等功能。如何在构建期间禁用它?在不禁用其他功能的情况下使用 cef3 会为单个实例消耗约 100MB 内存,因此如果应用程序用于多个实例,则它不可用。

我想减少cef3的内存占用。

我查看了 BUILD.gn 和 gni 文件,但找不到禁用功能的地方。

我认为禁用上述功能并不容易。但这里有一些您可以尝试的事情:

1) 运行 python automate-git.py --help 为您提供有关如何使构建 运行 更快的选项列表

2) 检查文件 cef\tests\shared\common\client_switches.cc 以了解一些受支持的命令行开关。我将从该文件中引用:

// 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) 请参阅 List of Chromium Command Line Switches - 您会发现许多有用的 CLI 开关,例如 --disable-extensions

4) 我还发现 Electron - Supported Chrome Command Line Switches which mentions --disable-http2 and according to 它确实有效。

P.S。我不认为您可以在构建过程中轻松删除功能。