#ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_
#define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_
#include <memory>
#include <string>
#include "base/environment.h"
#include "base/functional/callback.h"
#include "base/process/kill.h"
#include "base/process/process.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/child_process_termination_info.h"
#include "content/public/common/process_type.h"
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
#if BUILDFLAG(IS_APPLE)
#include "base/process/port_provider_mac.h"
#endif
namespace base {
class CommandLine;
class PersistentMemoryAllocator;
}
namespace content {
class BrowserChildProcessHostDelegate;
class SandboxedProcessLauncherDelegate;
struct ChildProcessData;
class CONTENT_EXPORT BrowserChildProcessHost {
public:
static std::unique_ptr<BrowserChildProcessHost> Create(
content::ProcessType process_type,
BrowserChildProcessHostDelegate* delegate);
static BrowserChildProcessHost* FromID(int child_process_id);
virtual ~BrowserChildProcessHost() = default;
virtual void Launch(
std::unique_ptr<SandboxedProcessLauncherDelegate> delegate,
std::unique_ptr<base::CommandLine> cmd_line) = 0;
virtual const ChildProcessData& GetData() = 0;
virtual ChildProcessHost* GetHost() = 0;
virtual ChildProcessTerminationInfo GetTerminationInfo(bool known_dead) = 0;
virtual std::unique_ptr<base::PersistentMemoryAllocator>
TakeMetricsAllocator() = 0;
virtual void SetName(const std::u16string& name) = 0;
virtual void SetMetricsName(const std::string& metrics_name) = 0;
#if BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_IOS_TVOS)
static base::PortProvider* GetPortProvider();
#endif
using BindHostReceiverInterceptor =
base::RepeatingCallback<void(BrowserChildProcessHost* process_host,
mojo::GenericPendingReceiver* receiver)>;
static void InterceptBindHostReceiverForTesting(
BindHostReceiverInterceptor callback);
};
}
#endif