#include "content/browser/interest_group/auction_process_manager.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_process_host_observer.h"
#include "content/public/browser/service_process_host.h"
#include "content/public/browser/site_instance.h"
#include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "url/origin.h"
namespace content {
constexpr size_t AuctionProcessManager::kMaxBidderProcesses = …;
constexpr size_t AuctionProcessManager::kMaxSellerProcesses = …;
class AuctionProcessManager::WorkletProcess
: public base::RefCounted<WorkletProcess>,
public RenderProcessHostObserver { … };
AuctionProcessManager::ProcessHandle::ProcessHandle() = default;
AuctionProcessManager::ProcessHandle::~ProcessHandle() { … }
auction_worklet::mojom::AuctionWorkletService*
AuctionProcessManager::ProcessHandle::GetService() { … }
RenderProcessHost*
AuctionProcessManager::ProcessHandle::GetRenderProcessHostForTesting() { … }
std::optional<base::ProcessId> AuctionProcessManager::ProcessHandle::GetPid(
base::OnceCallback<void(base::ProcessId)> callback) { … }
void AuctionProcessManager::ProcessHandle::AssignProcess(
scoped_refptr<WorkletProcess> worklet_process) { … }
void AuctionProcessManager::ProcessHandle::OnBaseProcessLaunched(
const base::Process& process) const { … }
void AuctionProcessManager::ProcessHandle::InvokeCallback() { … }
AuctionProcessManager::~AuctionProcessManager() { … }
bool AuctionProcessManager::RequestWorkletService(
WorkletType worklet_type,
const url::Origin& origin,
scoped_refptr<SiteInstance> frame_site_instance,
ProcessHandle* process_handle,
base::OnceClosure callback) { … }
bool AuctionProcessManager::TryCreateOrGetProcessForHandle(
ProcessHandle* process_handle) { … }
AuctionProcessManager::AuctionProcessManager() = default;
std::string AuctionProcessManager::ComputeDisplayName(
WorkletType worklet_type,
const url::Origin& origin) { … }
void AuctionProcessManager::RemovePendingProcessHandle(
ProcessHandle* process_handle) { … }
void AuctionProcessManager::OnWorkletProcessUnusable(
WorkletProcess* worklet_process) { … }
AuctionProcessManager::PendingRequestQueue*
AuctionProcessManager::GetPendingRequestQueue(WorkletType worklet_type) { … }
AuctionProcessManager::ProcessMap* AuctionProcessManager::Processes(
WorkletType worklet_type) { … }
AuctionProcessManager::PendingRequestMap*
AuctionProcessManager::GetPendingRequestMap(WorkletType worklet_type) { … }
bool AuctionProcessManager::HasAvailableProcessSlot(
WorkletType worklet_type) const { … }
DedicatedAuctionProcessManager::DedicatedAuctionProcessManager() = default;
DedicatedAuctionProcessManager::~DedicatedAuctionProcessManager() = default;
RenderProcessHost* DedicatedAuctionProcessManager::LaunchProcess(
mojo::PendingReceiver<auction_worklet::mojom::AuctionWorkletService>
auction_worklet_service_receiver,
const ProcessHandle* process_handle,
const std::string& display_name) { … }
scoped_refptr<SiteInstance>
DedicatedAuctionProcessManager::MaybeComputeSiteInstance(
SiteInstance* frame_site_instance,
const url::Origin& worklet_origin) { … }
bool DedicatedAuctionProcessManager::TryUseSharedProcess(
ProcessHandle* process_handle) { … }
InRendererAuctionProcessManager::InRendererAuctionProcessManager() = default;
InRendererAuctionProcessManager::~InRendererAuctionProcessManager() = default;
RenderProcessHost* InRendererAuctionProcessManager::LaunchProcess(
mojo::PendingReceiver<auction_worklet::mojom::AuctionWorkletService>
auction_worklet_service_receiver,
const ProcessHandle* process_handle,
const std::string& display_name) { … }
scoped_refptr<SiteInstance>
InRendererAuctionProcessManager::MaybeComputeSiteInstance(
SiteInstance* frame_site_instance,
const url::Origin& worklet_origin) { … }
bool InRendererAuctionProcessManager::TryUseSharedProcess(
ProcessHandle* process_handle) { … }
RenderProcessHost* InRendererAuctionProcessManager::LaunchInSiteInstance(
SiteInstance* site_instance,
mojo::PendingReceiver<auction_worklet::mojom::AuctionWorkletService>
auction_worklet_service_receiver) { … }
}