electron/shell/app/electron_main_delegate.h
trop[bot] 8b3f2c5d7c
fix: trace-startup crashing child process on macOS (#44276)
* fix: trace-startup crashing child process on macOS

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: disable test on linux arm

* chore: also disable on linux arm64

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-10-17 22:23:30 -04:00

76 lines
2.6 KiB
C++

// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#include <memory>
#include <string>
#include <string_view>
#include "content/public/app/content_main_delegate.h"
namespace content {
class Client;
}
namespace tracing {
class TracingSamplerProfiler;
}
namespace electron {
std::string LoadResourceBundle(const std::string& locale);
class ElectronMainDelegate : public content::ContentMainDelegate {
public:
static const char* const kNonWildcardDomainNonPortSchemes[];
static const size_t kNonWildcardDomainNonPortSchemesSize;
ElectronMainDelegate();
~ElectronMainDelegate() override;
// disable copy
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
#if BUILDFLAG(IS_MAC)
void OverrideChildProcessPath();
void OverrideFrameworkBundlePath();
void SetUpBundleOverrides();
#endif
protected:
// content::ContentMainDelegate:
std::string_view GetBrowserV8SnapshotFilename() override;
std::optional<int> BasicStartupComplete() override;
void PreSandboxStartup() override;
void SandboxInitialized(const std::string& process_type) override;
std::optional<int> PreBrowserMain() override;
content::ContentClient* CreateContentClient() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentGpuClient* CreateContentGpuClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
content::ContentUtilityClient* CreateContentUtilityClient() override;
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;
bool ShouldCreateFeatureList(InvokedIn invoked_in) override;
bool ShouldInitializeMojo(InvokedIn invoked_in) override;
bool ShouldLockSchemeRegistry() override;
#if BUILDFLAG(IS_LINUX)
void ZygoteForked() override;
#endif
private:
std::unique_ptr<content::ContentBrowserClient> browser_client_;
std::unique_ptr<content::ContentClient> content_client_;
std::unique_ptr<content::ContentGpuClient> gpu_client_;
std::unique_ptr<content::ContentRendererClient> renderer_client_;
std::unique_ptr<content::ContentUtilityClient> utility_client_;
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
};
} // namespace electron
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_