cefsimple: Minor code and docs cleanup

This commit is contained in:
Marshall Greenblatt 2024-01-17 17:44:33 -05:00
parent fbb8dbbc80
commit b98db30da2
4 changed files with 23 additions and 21 deletions

View File

@ -15,13 +15,11 @@
namespace { namespace {
int XErrorHandlerImpl(Display* display, XErrorEvent* event) { int XErrorHandlerImpl(Display* display, XErrorEvent* event) {
LOG(WARNING) << "X error received: " LOG(WARNING) << "X error received: " << "type " << event->type << ", "
<< "type " << event->type << ", " << "serial " << event->serial << ", " << "error_code "
<< "serial " << event->serial << ", " << static_cast<int>(event->error_code) << ", " << "request_code "
<< "error_code " << static_cast<int>(event->error_code) << ", " << static_cast<int>(event->request_code) << ", " << "minor_code "
<< "request_code " << static_cast<int>(event->request_code) << static_cast<int>(event->minor_code);
<< ", "
<< "minor_code " << static_cast<int>(event->minor_code);
return 0; return 0;
} }
@ -60,8 +58,11 @@ int main(int argc, char* argv[]) {
// Specify CEF global settings here. // Specify CEF global settings here.
CefSettings settings; CefSettings settings;
// Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via
// the command-line. Otherwise, use the CEF Alloy runtime. For more
// information about CEF runtimes see
// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
if (command_line->HasSwitch("enable-chrome-runtime")) { if (command_line->HasSwitch("enable-chrome-runtime")) {
// Enable experimental Chrome runtime. See issue #2969 for details.
settings.chrome_runtime = true; settings.chrome_runtime = true;
} }

View File

@ -139,11 +139,11 @@ int main(int argc, char* argv[]) {
// Specify CEF global settings here. // Specify CEF global settings here.
CefSettings settings; CefSettings settings;
const bool with_chrome_runtime = // Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via
command_line->HasSwitch("enable-chrome-runtime"); // the command-line. Otherwise, use the CEF Alloy runtime. For more
// information about CEF runtimes see
if (with_chrome_runtime) { // https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
// Enable experimental Chrome runtime. See issue #2969 for details. if (command_line->HasSwitch("enable-chrome-runtime")) {
settings.chrome_runtime = true; settings.chrome_runtime = true;
} }

View File

@ -74,8 +74,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
// Specify CEF global settings here. // Specify CEF global settings here.
CefSettings settings; CefSettings settings;
// Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via
// the command-line. Otherwise, use the CEF Alloy runtime. For more
// information about CEF runtimes see
// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
if (command_line->HasSwitch("enable-chrome-runtime")) { if (command_line->HasSwitch("enable-chrome-runtime")) {
// Enable experimental Chrome runtime. See issue #2969 for details.
settings.chrome_runtime = true; settings.chrome_runtime = true;
} }

View File

@ -151,11 +151,9 @@ void SimpleHandler::CloseAllBrowsers(bool force_close) {
// static // static
bool SimpleHandler::IsChromeRuntimeEnabled() { bool SimpleHandler::IsChromeRuntimeEnabled() {
static int value = -1; static bool enabled = []() {
if (value == -1) { return CefCommandLine::GetGlobalCommandLine()->HasSwitch(
CefRefPtr<CefCommandLine> command_line = "enable-chrome-runtime");
CefCommandLine::GetGlobalCommandLine(); }();
value = command_line->HasSwitch("enable-chrome-runtime") ? 1 : 0; return enabled;
}
return value == 1;
} }