【发布时间】:2018-06-04 20:14:57
【问题描述】:
我需要编译具有最少功能的 cef3。我不需要打印/媒体/开发工具等功能。如何在构建期间禁用它?在不禁用其他功能的情况下使用 cef3 会为单个实例消耗约 100MB 内存,因此如果应用程序用于多个实例,则它不可用。
我想减少cef3的内存使用。
我查看了 BUILD.gn 和 gni 文件,但找不到禁用功能的位置。
【问题讨论】:
我需要编译具有最少功能的 cef3。我不需要打印/媒体/开发工具等功能。如何在构建期间禁用它?在不禁用其他功能的情况下使用 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 提到了--disable-http2 并且根据this stackoverflow post 它确实有效。
附:我不认为您可以在构建过程中轻松删除功能。
【讨论】: