cefsimple: Minor code and docs cleanup

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

View File

@ -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<int>(event->error_code) << ", "
<< "request_code " << static_cast<int>(event->request_code)
<< ", "
<< "minor_code " << static_cast<int>(event->minor_code);
LOG(WARNING) << "X error received: " << "type " << event->type << ", "
<< "serial " << event->serial << ", " << "error_code "
<< static_cast<int>(event->error_code) << ", " << "request_code "
<< static_cast<int>(event->request_code) << ", " << "minor_code "
<< static_cast<int>(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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -151,11 +151,9 @@ void SimpleHandler::CloseAllBrowsers(bool force_close) {
// static
bool SimpleHandler::IsChromeRuntimeEnabled() {
static int value = -1;
if (value == -1) {
CefRefPtr<CefCommandLine> 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;
}