
This field is: * Unsafe in presence of Oilpan (see https://crbug.com/40261265) * Not actually used - there are no callers of `AgentGroupScheduler::GetBrowserInterfaceBroker`. This method was added in https://crrev.com/c/2677585 and AFAICT no callers have ever been added later - for example this command finds no other commits: `git log -S AgentSched -- content/browser/browser_interface_binders.cc` Removing this field also helps to make progress on https://crbug.com/41482945 - this field is related to 1 out of 5 callers of `BrowserInterfaceBrokerProxy::Bind` and the linked bug requires passing `ContextLifecycleNotifier` to `HeapMojoRemote`. I note that `AgentGroupSchedulerImpl::BindInterfaceBroker` seems to be the only caller of `BrowserInterfaceBrokerProxy::Bind` which doesn't have a 1:1 relationship with a `ContextLifecycleNotifier` (which IIUC roughly corresponds to the `ExecutionContext`). The other callers are 1) constructor of `WorkerGlobalScope`, 2) constructor of `content::RenderFrameImpl`, 3) `MojoBindingContext::SetMojoJSInterfaceBroker` (we ignore here `GetEmptyBrowserInterfaceBroker` which doesn't actually need to bind an actual mojo remote). Fixed: 40261265 Bug: 41482945 Change-Id: Id07826bb008bea6157a30868a56ad05ad3bbc675 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5646657 Reviewed-by: Francois Pierre Doray <fdoray@chromium.org> Reviewed-by: Dave Tapuska <dtapuska@chromium.org> Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by: Emily Stark <estark@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by: Scott Haseley <shaseley@chromium.org> Cr-Commit-Position: refs/heads/main@{#1319775}
66 lines
2.3 KiB
C++
66 lines
2.3 KiB
C++
// Copyright 2020 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "content/renderer/mock_agent_scheduling_group.h"
|
|
|
|
#include <tuple>
|
|
|
|
#include "content/renderer/render_thread_impl.h"
|
|
|
|
namespace {
|
|
|
|
static features::MBIMode GetMBIMode() {
|
|
return base::FeatureList::IsEnabled(features::kMBIMode)
|
|
? features::kMBIModeParam.Get()
|
|
: features::MBIMode::kLegacy;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
namespace content {
|
|
|
|
// static
|
|
std::unique_ptr<MockAgentSchedulingGroup> MockAgentSchedulingGroup::Create(
|
|
RenderThread& render_thread) {
|
|
auto agent_scheduling_group =
|
|
(GetMBIMode() == features::MBIMode::kLegacy)
|
|
? std::make_unique<MockAgentSchedulingGroup>(
|
|
base::PassKey<MockAgentSchedulingGroup>(), render_thread,
|
|
mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup>())
|
|
: std::make_unique<MockAgentSchedulingGroup>(
|
|
base::PassKey<MockAgentSchedulingGroup>(), render_thread,
|
|
mojo::PendingReceiver<IPC::mojom::ChannelBootstrap>());
|
|
agent_scheduling_group->Init();
|
|
return agent_scheduling_group;
|
|
}
|
|
|
|
MockAgentSchedulingGroup::MockAgentSchedulingGroup(
|
|
base::PassKey<MockAgentSchedulingGroup> pass_key,
|
|
RenderThread& render_thread,
|
|
mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup>
|
|
pending_receiver)
|
|
: AgentSchedulingGroup(render_thread, std::move(pending_receiver)) {}
|
|
|
|
MockAgentSchedulingGroup::MockAgentSchedulingGroup(
|
|
base::PassKey<MockAgentSchedulingGroup> pass_key,
|
|
RenderThread& render_thread,
|
|
mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> pending_receiver)
|
|
: AgentSchedulingGroup(render_thread, std::move(pending_receiver)) {}
|
|
|
|
void MockAgentSchedulingGroup::Init() {
|
|
mojo::AssociatedRemote<mojom::AgentSchedulingGroupHost>
|
|
agent_scheduling_group_host;
|
|
std::ignore =
|
|
agent_scheduling_group_host.BindNewEndpointAndPassDedicatedReceiver();
|
|
mojo::AssociatedRemote<mojom::RouteProvider> browser_route_provider;
|
|
std::ignore =
|
|
browser_route_provider.BindNewEndpointAndPassDedicatedReceiver();
|
|
|
|
BindAssociatedInterfaces(
|
|
agent_scheduling_group_host.Unbind(),
|
|
mojo::PendingAssociatedReceiver<mojom::RouteProvider>());
|
|
}
|
|
|
|
} // namespace content
|