#ifndef CONTENT_PUBLIC_BROWSER_SERVICE_PROCESS_INFO_H_
#define CONTENT_PUBLIC_BROWSER_SERVICE_PROCESS_INFO_H_
#include <stdint.h>
#include <optional>
#include <string>
#include "base/process/process.h"
#include "base/types/id_type.h"
#include "content/common/content_export.h"
#include "url/gurl.h"
namespace content {
namespace internal {
struct CONTENT_EXPORT ServiceProcessIdTypeMarker {};
}
using ServiceProcessId =
base::IdType<internal::ServiceProcessIdTypeMarker, uint64_t, 0u>;
class CONTENT_EXPORT ServiceProcessInfo {
public:
ServiceProcessInfo(const std::string& name,
const std::optional<GURL>& site,
const ServiceProcessId& id,
base::Process process);
ServiceProcessInfo(const ServiceProcessInfo&) = delete;
ServiceProcessInfo(ServiceProcessInfo&&);
ServiceProcessInfo& operator=(const ServiceProcessInfo&) = delete;
ServiceProcessInfo& operator=(ServiceProcessInfo&&);
~ServiceProcessInfo();
template <typename Interface>
bool IsService() const {
return service_interface_name_ == Interface::Name_;
}
ServiceProcessInfo Duplicate() const;
const ServiceProcessId service_process_id() const {
return service_process_id_;
}
const std::string service_interface_name() const {
return service_interface_name_;
}
const std::optional<GURL>& site() const { return site_; }
const base::Process& GetProcess() const { return process_; }
std::optional<bool> crashed_pre_ipc() const { return crashed_pre_ipc_; }
void set_crashed_pre_ipc(bool crashed_pre_ipc) {
crashed_pre_ipc_ = crashed_pre_ipc;
}
private:
std::string service_interface_name_;
std::optional<GURL> site_;
ServiceProcessId service_process_id_;
base::Process process_;
std::optional<bool> crashed_pre_ipc_;
};
}
#endif