Remove main runner abstractions (see #3685)

Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
This commit is contained in:
Marshall Greenblatt
2024-07-02 13:27:09 -04:00
parent 231701d98b
commit c0a3c897cf
11 changed files with 323 additions and 464 deletions

View File

@@ -7,32 +7,30 @@
#define CEF_LIBCEF_BROWSER_MAIN_RUNNER_H_
#pragma once
#include <memory>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_app.h"
#include "cef/libcef/common/main_runner_delegate.h"
#include "cef/libcef/common/main_runner_handler.h"
#include "cef/libcef/browser/ui_thread.h"
#include "cef/libcef/common/chrome/chrome_main_delegate_cef.h"
#include "chrome/common/profiler/main_thread_stack_sampling_profiler.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "content/public/app/content_main_runner.h"
#include "content/public/browser/browser_main_runner.h"
namespace base {
class WaitableEvent;
}
namespace content {
class ContentMainRunner;
} // namespace content
class CefUIThread;
// Manages the main process lifespan and related objects.
class CefMainRunner : public CefMainRunnerHandler {
class CefMainRunner final {
public:
CefMainRunner(bool multi_threaded_message_loop, bool external_message_pump);
CefMainRunner(const CefMainRunner&) = delete;
CefMainRunner& operator=(const CefMainRunner&) = delete;
~CefMainRunner() override;
// Called from CefContext::Initialize.
bool Initialize(CefSettings* settings,
CefRefPtr<CefApp> application,
@@ -56,6 +54,10 @@ class CefMainRunner : public CefMainRunnerHandler {
CefRefPtr<CefApp> application,
void* windows_sandbox_info);
// Called from ChromeMainDelegateCef.
void PreBrowserMain();
int RunMainProcess(content::MainFunctionParams main_function_params);
private:
// Called from Initialize().
int ContentMainInitialize(const CefMainArgs& args,
@@ -63,9 +65,8 @@ class CefMainRunner : public CefMainRunnerHandler {
int* no_sandbox);
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
// CefMainRunnerHandler methods:
void PreBrowserMain() override;
int RunMainProcess(content::MainFunctionParams main_function_params) override;
static void BeforeMainInitialize(const CefMainArgs& args);
bool HandleMainMessageLoopQuit();
// Create the UI thread when running with multi-threaded message loop mode.
bool CreateUIThread(base::OnceClosure setup_callback);
@@ -81,10 +82,12 @@ class CefMainRunner : public CefMainRunnerHandler {
// thread RunLoop has stopped and before running exit callbacks.
void FinishShutdownOnUIThread();
void BeforeUIThreadInitialize();
void BeforeUIThreadShutdown();
const bool multi_threaded_message_loop_;
const bool external_message_pump_;
std::unique_ptr<CefMainRunnerDelegate> main_delegate_;
std::unique_ptr<content::ContentMainRunner> main_runner_;
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
@@ -94,6 +97,14 @@ class CefMainRunner : public CefMainRunnerHandler {
base::OnceClosure quit_callback_;
int exit_code_ = -1;
std::unique_ptr<ChromeMainDelegateCef> main_delegate_;
std::unique_ptr<MainThreadStackSamplingProfiler> sampling_profiler_;
std::unique_ptr<ScopedKeepAlive> keep_alive_;
raw_ptr<CefSettings> settings_ = nullptr;
CefRefPtr<CefApp> application_;
};
#endif // CEF_LIBCEF_BROWSER_MAIN_RUNNER_H_