#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include <memory>
#include "base/containers/contains.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "base/state_transitions.h"
#include "base/supports_user_data.h"
#include "base/task/single_thread_task_runner.h"
#include "content/browser/bad_message.h"
#include "content/browser/renderer_host/agent_scheduling_group_host_factory.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/agent_scheduling_group.mojom.h"
#include "content/common/renderer.mojom.h"
#include "content/public/browser/render_process_host.h"
#include "ipc/ipc_channel_mojo.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message.h"
#include "third_party/blink/public/mojom/shared_storage/shared_storage_worklet_service.mojom.h"
#include "third_party/blink/public/mojom/worker/worklet_global_scope_creation_params.mojom.h"
#if BUILDFLAG(CONTENT_ENABLE_LEGACY_IPC)
#include "content/public/browser/browser_message_filter.h"
#endif
namespace content {
namespace {
ChannelMojo;
ChannelProxy;
Listener;
AssociatedReceiver;
AssociatedRemote;
PendingAssociatedReceiver;
PendingAssociatedRemote;
PendingReceiver;
PendingRemote;
Receiver;
Remote;
static constexpr char kAgentSchedulingGroupHostDataKey[] = …;
AgentSchedulingGroupHostFactory* g_agent_scheduling_group_host_factory_ = …;
struct AgentSchedulingGroupHostUserData : public base::SupportsUserData::Data { … };
static features::MBIMode GetMBIMode() { … }
}
AgentSchedulingGroupHost* AgentSchedulingGroupHost::GetOrCreate(
const SiteInstanceGroup& site_instance_group,
RenderProcessHost& process) { … }
int32_t AgentSchedulingGroupHost::GetNextID() { … }
AgentSchedulingGroupHost::AgentSchedulingGroupHost(RenderProcessHost& process)
: … { … }
AgentSchedulingGroupHost::~AgentSchedulingGroupHost() { … }
void AgentSchedulingGroupHost::RenderProcessExited(
RenderProcessHost* host,
const ChildProcessTerminationInfo& info) { … }
void AgentSchedulingGroupHost::RenderProcessHostDestroyed(
RenderProcessHost* host) { … }
bool AgentSchedulingGroupHost::OnMessageReceived(const IPC::Message& message) { … }
void AgentSchedulingGroupHost::OnBadMessageReceived(
const IPC::Message& message) { … }
void AgentSchedulingGroupHost::OnAssociatedInterfaceRequest(
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle handle) { … }
#if BUILDFLAG(CONTENT_ENABLE_LEGACY_IPC)
void AgentSchedulingGroupHost::AddFilter(BrowserMessageFilter* filter) {
DCHECK(filter);
if (GetMBIMode() == features::MBIMode::kLegacy) {
process_->AddFilter(filter);
return;
}
channel_->AddFilter(filter->GetFilter());
}
#endif
RenderProcessHost* AgentSchedulingGroupHost::GetProcess() { … }
bool AgentSchedulingGroupHost::Init() { … }
base::SafeRef<AgentSchedulingGroupHost> AgentSchedulingGroupHost::GetSafeRef()
const { … }
ChannelProxy* AgentSchedulingGroupHost::GetChannel() { … }
bool AgentSchedulingGroupHost::Send(IPC::Message* message) { … }
void AgentSchedulingGroupHost::AddRoute(int32_t routing_id,
Listener* listener) { … }
void AgentSchedulingGroupHost::RemoveRoute(int32_t routing_id) { … }
mojom::RouteProvider* AgentSchedulingGroupHost::GetRemoteRouteProvider() { … }
void AgentSchedulingGroupHost::CreateFrame(mojom::CreateFrameParamsPtr params) { … }
void AgentSchedulingGroupHost::CreateView(mojom::CreateViewParamsPtr params) { … }
void AgentSchedulingGroupHost::CreateSharedStorageWorkletService(
mojo::PendingReceiver<blink::mojom::SharedStorageWorkletService> receiver,
blink::mojom::WorkletGlobalScopeCreationParamsPtr
global_scope_creation_params) { … }
void AgentSchedulingGroupHost::
set_agent_scheduling_group_host_factory_for_testing(
AgentSchedulingGroupHostFactory* asgh_factory) { … }
AgentSchedulingGroupHostFactory* AgentSchedulingGroupHost::
get_agent_scheduling_group_host_factory_for_testing() { … }
void AgentSchedulingGroupHost::DidUnloadRenderFrame(
const blink::LocalFrameToken& frame_token) { … }
void AgentSchedulingGroupHost::ResetIPC() { … }
void AgentSchedulingGroupHost::SetUpIPC() { … }
void AgentSchedulingGroupHost::SetState(
AgentSchedulingGroupHost::LifecycleState state) { … }
std::ostream& operator<<(std::ostream& os,
AgentSchedulingGroupHost::LifecycleState state) { … }
Listener* AgentSchedulingGroupHost::GetListener(int32_t routing_id) { … }
}