mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Set enable_alloy_bootstrap=false to build with Alloy bootstrap code removed. Extension API is documented as deprecated in comments but not compiled out with this arg.
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/alloy/alloy_main_runner_delegate.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/chrome/chrome_main_runner_delegate.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
@@ -47,29 +46,39 @@
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
#include "libcef/common/alloy/alloy_main_runner_delegate.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
enum class RuntimeType {
|
||||
UNINITIALIZED,
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
ALLOY,
|
||||
#endif
|
||||
CHROME,
|
||||
};
|
||||
RuntimeType g_runtime_type = RuntimeType::UNINITIALIZED;
|
||||
|
||||
std::unique_ptr<CefMainRunnerDelegate> MakeDelegate(
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
RuntimeType type,
|
||||
#endif
|
||||
CefMainRunnerHandler* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application) {
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
if (type == RuntimeType::ALLOY) {
|
||||
g_runtime_type = RuntimeType::ALLOY;
|
||||
return std::make_unique<AlloyMainRunnerDelegate>(runner, settings,
|
||||
application);
|
||||
} else {
|
||||
g_runtime_type = RuntimeType::CHROME;
|
||||
return std::make_unique<ChromeMainRunnerDelegate>(runner, settings,
|
||||
application);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_runtime_type = RuntimeType::CHROME;
|
||||
return std::make_unique<ChromeMainRunnerDelegate>(runner, settings,
|
||||
application);
|
||||
}
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
@@ -258,10 +267,18 @@ bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
void* windows_sandbox_info,
|
||||
bool* initialized,
|
||||
base::OnceClosure context_initialized) {
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
LOG_IF(WARNING, !settings->chrome_runtime)
|
||||
<< "Alloy bootstrap is deprecated and will be removed in ~M127. See "
|
||||
"https://github.com/chromiumembedded/cef/issues/3685";
|
||||
#endif
|
||||
|
||||
DCHECK(!main_delegate_);
|
||||
main_delegate_ = MakeDelegate(
|
||||
settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY, this,
|
||||
settings, application);
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY,
|
||||
#endif
|
||||
this, settings, application);
|
||||
|
||||
exit_code_ =
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
|
||||
@@ -373,11 +390,13 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto runtime_type = command_line.HasSwitch(switches::kEnableChromeRuntime)
|
||||
? RuntimeType::CHROME
|
||||
: RuntimeType::ALLOY;
|
||||
auto main_delegate = MakeDelegate(runtime_type, /*runner=*/nullptr,
|
||||
/*settings=*/nullptr, application);
|
||||
auto main_delegate = MakeDelegate(
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
command_line.HasSwitch(switches::kEnableChromeRuntime)
|
||||
? RuntimeType::CHROME
|
||||
: RuntimeType::ALLOY,
|
||||
#endif
|
||||
/*runner=*/nullptr, /*settings=*/nullptr, application);
|
||||
main_delegate->BeforeExecuteProcess(args);
|
||||
|
||||
int result;
|
||||
@@ -584,9 +603,11 @@ void CefMainRunner::FinishShutdownOnUIThread() {
|
||||
// From libcef/features/runtime.h:
|
||||
namespace cef {
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool IsAlloyRuntimeEnabled() {
|
||||
return g_runtime_type == RuntimeType::ALLOY;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IsChromeRuntimeEnabled() {
|
||||
return g_runtime_type == RuntimeType::CHROME;
|
||||
|
Reference in New Issue
Block a user