From b98db30da24de6400fa4409e46879dddcf3531d7 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 17 Jan 2024 17:44:33 -0500 Subject: [PATCH] cefsimple: Minor code and docs cleanup --- tests/cefsimple/cefsimple_linux.cc | 17 +++++++++-------- tests/cefsimple/cefsimple_mac.mm | 10 +++++----- tests/cefsimple/cefsimple_win.cc | 5 ++++- tests/cefsimple/simple_handler.cc | 12 +++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/tests/cefsimple/cefsimple_linux.cc b/tests/cefsimple/cefsimple_linux.cc index 0b3fe1c97..10a784d24 100644 --- a/tests/cefsimple/cefsimple_linux.cc +++ b/tests/cefsimple/cefsimple_linux.cc @@ -15,13 +15,11 @@ namespace { int XErrorHandlerImpl(Display* display, XErrorEvent* event) { - LOG(WARNING) << "X error received: " - << "type " << event->type << ", " - << "serial " << event->serial << ", " - << "error_code " << static_cast(event->error_code) << ", " - << "request_code " << static_cast(event->request_code) - << ", " - << "minor_code " << static_cast(event->minor_code); + LOG(WARNING) << "X error received: " << "type " << event->type << ", " + << "serial " << event->serial << ", " << "error_code " + << static_cast(event->error_code) << ", " << "request_code " + << static_cast(event->request_code) << ", " << "minor_code " + << static_cast(event->minor_code); return 0; } @@ -60,8 +58,11 @@ int main(int argc, char* argv[]) { // Specify CEF global settings here. 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")) { - // Enable experimental Chrome runtime. See issue #2969 for details. settings.chrome_runtime = true; } diff --git a/tests/cefsimple/cefsimple_mac.mm b/tests/cefsimple/cefsimple_mac.mm index f6fbe74db..2fb0b8620 100644 --- a/tests/cefsimple/cefsimple_mac.mm +++ b/tests/cefsimple/cefsimple_mac.mm @@ -139,11 +139,11 @@ int main(int argc, char* argv[]) { // Specify CEF global settings here. CefSettings settings; - const bool with_chrome_runtime = - command_line->HasSwitch("enable-chrome-runtime"); - - if (with_chrome_runtime) { - // Enable experimental Chrome runtime. See issue #2969 for details. + // 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")) { settings.chrome_runtime = true; } diff --git a/tests/cefsimple/cefsimple_win.cc b/tests/cefsimple/cefsimple_win.cc index 62fe9b653..68119382d 100644 --- a/tests/cefsimple/cefsimple_win.cc +++ b/tests/cefsimple/cefsimple_win.cc @@ -74,8 +74,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance, // Specify CEF global settings here. 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")) { - // Enable experimental Chrome runtime. See issue #2969 for details. settings.chrome_runtime = true; } diff --git a/tests/cefsimple/simple_handler.cc b/tests/cefsimple/simple_handler.cc index e7d977f5e..0a36b3314 100644 --- a/tests/cefsimple/simple_handler.cc +++ b/tests/cefsimple/simple_handler.cc @@ -151,11 +151,9 @@ void SimpleHandler::CloseAllBrowsers(bool force_close) { // static bool SimpleHandler::IsChromeRuntimeEnabled() { - static int value = -1; - if (value == -1) { - CefRefPtr command_line = - CefCommandLine::GetGlobalCommandLine(); - value = command_line->HasSwitch("enable-chrome-runtime") ? 1 : 0; - } - return value == 1; + static bool enabled = []() { + return CefCommandLine::GetGlobalCommandLine()->HasSwitch( + "enable-chrome-runtime"); + }(); + return enabled; }