Migrate frame.mojom to the new Mojo types
Convert the implementation and all users of the content::mojom::Frame,
FrameBindingsControl, FrameFactory, KeepAliveHandle and FrameHost
interfaces.
Bug: 955171
Change-Id: I46cf976922f67cdce6b27bc9b3c21583f25fd375
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798346
Commit-Queue: Henrique Ferreiro <[email protected]>
Reviewed-by: Oksana Zhuravlova <[email protected]>
Reviewed-by: Emily Stark <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#701092}
diff --git a/content/browser/frame_host/keep_alive_handle_factory.cc b/content/browser/frame_host/keep_alive_handle_factory.cc
index 70b5ad3..9d702d0 100644
--- a/content/browser/frame_host/keep_alive_handle_factory.cc
+++ b/content/browser/frame_host/keep_alive_handle_factory.cc
@@ -4,16 +4,20 @@
#include "content/browser/frame_host/keep_alive_handle_factory.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/task/post_task.h"
+#include "content/common/frame.mojom.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_features.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding_set.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/unique_receiver_set.h"
namespace content {
@@ -44,9 +48,9 @@
timeout);
}
- void AddBinding(std::unique_ptr<mojom::KeepAliveHandle> impl,
- mojom::KeepAliveHandleRequest request) {
- binding_set_.AddBinding(std::move(impl), std::move(request));
+ void AddReceiver(std::unique_ptr<mojom::KeepAliveHandle> impl,
+ mojo::PendingReceiver<mojom::KeepAliveHandle> receiver) {
+ receiver_set_.Add(std::move(impl), std::move(receiver));
}
base::WeakPtr<Context> AsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); }
@@ -55,7 +59,7 @@
friend class base::RefCounted<Context>;
~Context() { Detach(); }
- mojo::StrongBindingSet<mojom::KeepAliveHandle> binding_set_;
+ mojo::UniqueReceiverSet<mojom::KeepAliveHandle> receiver_set_;
const int process_id_;
bool detached_ = false;
@@ -85,7 +89,8 @@
context_->DetachLater(timeout_);
}
-void KeepAliveHandleFactory::Create(mojom::KeepAliveHandleRequest request) {
+void KeepAliveHandleFactory::Create(
+ mojo::PendingReceiver<mojom::KeepAliveHandle> receiver) {
scoped_refptr<Context> context;
if (context_) {
context = context_.get();
@@ -94,8 +99,8 @@
context_ = context->AsWeakPtr();
}
- context->AddBinding(std::make_unique<KeepAliveHandleImpl>(context),
- std::move(request));
+ context->AddReceiver(std::make_unique<KeepAliveHandleImpl>(context),
+ std::move(receiver));
}
void KeepAliveHandleFactory::SetTimeout(base::TimeDelta timeout) {
diff --git a/content/browser/frame_host/keep_alive_handle_factory.h b/content/browser/frame_host/keep_alive_handle_factory.h
index d5eb453..746ae50 100644
--- a/content/browser/frame_host/keep_alive_handle_factory.h
+++ b/content/browser/frame_host/keep_alive_handle_factory.h
@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "content/common/frame.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace content {
@@ -25,7 +26,7 @@
explicit KeepAliveHandleFactory(RenderProcessHost* process_host);
~KeepAliveHandleFactory();
- void Create(mojom::KeepAliveHandleRequest request);
+ void Create(mojo::PendingReceiver<mojom::KeepAliveHandle> receiver);
// Sets the timeout after which all created handles will be invalidated.
void SetTimeout(base::TimeDelta timeout);
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 86c5db3..5d7c757 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -117,6 +117,7 @@
#include "content/common/accessibility_messages.h"
#include "content/common/associated_interfaces.mojom.h"
#include "content/common/content_security_policy/content_security_policy.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
#include "content/common/input/input_handler.mojom.h"
@@ -146,6 +147,7 @@
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/webvr_service_provider.h"
+#include "content/public/common/bind_interface_helpers.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_features.h"
@@ -170,6 +172,8 @@
#include "media/mojo/services/media_interface_provider.h"
#include "media/mojo/services/media_metrics_provider.h"
#include "media/mojo/services/video_decode_perf_history.h"
+#include "mojo/public/cpp/bindings/associated_receiver.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
@@ -848,7 +852,6 @@
has_selection_(false),
is_audible_(false),
last_navigation_previews_state_(PREVIEWS_UNSPECIFIED),
- frame_host_associated_binding_(this),
waiting_for_init_(renderer_initiated_creation),
has_focused_editable_element_(false),
push_messaging_manager_(
@@ -4195,7 +4198,7 @@
}
void RenderFrameHostImpl::IssueKeepAliveHandle(
- mojom::KeepAliveHandleRequest request) {
+ mojo::PendingReceiver<mojom::KeepAliveHandle> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (GetProcess()->IsKeepAliveRefCountDisabled())
return;
@@ -4209,7 +4212,7 @@
std::make_unique<KeepAliveHandleFactory>(GetProcess());
keep_alive_handle_factory_->SetTimeout(keep_alive_timeout_);
}
- keep_alive_handle_factory_->Create(std::move(request));
+ keep_alive_handle_factory_->Create(std::move(receiver));
}
// TODO(ahemery): Move checks to mojo bad message reporting.
@@ -5497,12 +5500,13 @@
associated_registry_ = std::make_unique<blink::AssociatedInterfaceRegistry>();
registry_ = std::make_unique<service_manager::BinderRegistry>();
- auto make_binding = [](RenderFrameHostImpl* impl,
- mojom::FrameHostAssociatedRequest request) {
- impl->frame_host_associated_binding_.Bind(std::move(request));
- };
+ auto bind_frame_host_receiver =
+ [](RenderFrameHostImpl* impl,
+ mojo::PendingAssociatedReceiver<mojom::FrameHost> receiver) {
+ impl->frame_host_associated_receiver_.Bind(std::move(receiver));
+ };
associated_registry_->AddInterface(
- base::BindRepeating(make_binding, base::Unretained(this)));
+ base::BindRepeating(bind_frame_host_receiver, base::Unretained(this)));
associated_registry_->AddInterface(base::BindRepeating(
[](RenderFrameHostImpl* self,
@@ -5512,9 +5516,10 @@
base::Unretained(this)));
RegisterMojoInterfaces();
- mojom::FrameFactoryPtr frame_factory;
+ mojo::PendingRemote<mojom::FrameFactory> frame_factory;
BindInterface(GetProcess(), &frame_factory);
- frame_factory->CreateFrame(routing_id_, MakeRequest(&frame_));
+ mojo::Remote<mojom::FrameFactory>(std::move(frame_factory))
+ ->CreateFrame(routing_id_, frame_.BindNewPipeAndPassReceiver());
service_manager::mojom::InterfaceProviderPtr remote_interfaces;
frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces));
@@ -5530,7 +5535,7 @@
frame_.reset();
frame_bindings_control_.reset();
- frame_host_associated_binding_.Close();
+ frame_host_associated_receiver_.reset();
navigation_control_.reset();
frame_input_handler_.reset();
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 2ed48ec..b69cb64 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -57,6 +57,7 @@
#include "content/public/common/previews_state.h"
#include "content/public/common/transferrable_url_loader.mojom.h"
#include "media/mojo/mojom/interface_factory.mojom.h"
+#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
@@ -885,8 +886,9 @@
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>);
// Exposed so that tests can swap out the implementation and intercept calls.
- mojo::AssociatedBinding<mojom::FrameHost>& frame_host_binding_for_testing() {
- return frame_host_associated_binding_;
+ mojo::AssociatedReceiver<mojom::FrameHost>&
+ frame_host_receiver_for_testing() {
+ return frame_host_associated_receiver_;
}
mojo::Binding<service_manager::mojom::InterfaceProvider>&
@@ -1407,7 +1409,8 @@
CreatePortalCallback callback) override;
void AdoptPortal(const base::UnguessableToken& portal_token,
AdoptPortalCallback callback) override;
- void IssueKeepAliveHandle(mojom::KeepAliveHandleRequest request) override;
+ void IssueKeepAliveHandle(
+ mojo::PendingReceiver<mojom::KeepAliveHandle> receiver) override;
void DidCommitProvisionalLoad(
std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params>
validated_params,
@@ -2166,9 +2169,10 @@
bool has_committed_any_navigation_ = false;
bool render_process_has_died_ = false;
- mojo::AssociatedBinding<mojom::FrameHost> frame_host_associated_binding_;
- mojom::FramePtr frame_;
- mojom::FrameBindingsControlAssociatedPtr frame_bindings_control_;
+ mojo::AssociatedReceiver<mojom::FrameHost> frame_host_associated_receiver_{
+ this};
+ mojo::Remote<mojom::Frame> frame_;
+ mojo::AssociatedRemote<mojom::FrameBindingsControl> frame_bindings_control_;
mojo::AssociatedRemote<mojom::FrameNavigationControl> navigation_control_;
// If this is true then this object was created in response to a renderer
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc
index 025b88712..43c21e3f 100644
--- a/content/browser/navigation_browsertest.cc
+++ b/content/browser/navigation_browsertest.cc
@@ -858,11 +858,11 @@
if (IsPerNavigationMojoInterfaceEnabled()) {
auto navigation_client_receiver =
navigation_client.InitWithNewEndpointAndPassReceiver();
- rfh->frame_host_binding_for_testing().impl()->BeginNavigation(
+ rfh->frame_host_receiver_for_testing().impl()->BeginNavigation(
std::move(common_params), std::move(begin_params), mojo::NullRemote(),
std::move(navigation_client), mojo::NullRemote());
} else {
- rfh->frame_host_binding_for_testing().impl()->BeginNavigation(
+ rfh->frame_host_receiver_for_testing().impl()->BeginNavigation(
std::move(common_params), std::move(begin_params), mojo::NullRemote(),
mojo::NullAssociatedRemote(), mojo::NullRemote());
}
diff --git a/content/browser/portal/portal_browsertest.cc b/content/browser/portal/portal_browsertest.cc
index 5faf3de..93c420d 100644
--- a/content/browser/portal/portal_browsertest.cc
+++ b/content/browser/portal/portal_browsertest.cc
@@ -166,12 +166,12 @@
public:
explicit PortalCreatedObserver(RenderFrameHostImpl* render_frame_host_impl)
: render_frame_host_impl_(render_frame_host_impl) {
- old_impl_ = render_frame_host_impl_->frame_host_binding_for_testing()
+ old_impl_ = render_frame_host_impl_->frame_host_receiver_for_testing()
.SwapImplForTesting(this);
}
~PortalCreatedObserver() override {
- render_frame_host_impl_->frame_host_binding_for_testing()
+ render_frame_host_impl_->frame_host_receiver_for_testing()
.SwapImplForTesting(old_impl_);
}
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index a6fda4b..b2633f3 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -7979,7 +7979,7 @@
test_callback)
: render_frame_host_(render_frame_host),
test_callback_(std::move(test_callback)) {
- render_frame_host_->frame_host_binding_for_testing().SwapImplForTesting(
+ render_frame_host_->frame_host_receiver_for_testing().SwapImplForTesting(
this);
}
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index 9ab40d6..f0d9cafc 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -271,7 +271,7 @@
// Implemented by a service that provides implementations of the Frame
// interface. (e.g. renderer processes).
interface FrameFactory {
- CreateFrame(int32 frame_routing_id, Frame& frame);
+ CreateFrame(int32 frame_routing_id, pending_receiver<Frame> frame);
};
struct CreateNewWindowParams {
@@ -385,7 +385,7 @@
mojo_base.mojom.UnguessableToken devtools_frame_token);
// Creates and returns a KeepAliveHandle.
- IssueKeepAliveHandle(KeepAliveHandle& keep_alive_handle);
+ IssueKeepAliveHandle(pending_receiver<KeepAliveHandle> keep_alive_handle);
// Sent by the renderer when a navigation commits in the frame.
diff --git a/content/renderer/loader/web_url_loader_impl.cc b/content/renderer/loader/web_url_loader_impl.cc
index 651c7c3e..2c6cf18 100644
--- a/content/renderer/loader/web_url_loader_impl.cc
+++ b/content/renderer/loader/web_url_loader_impl.cc
@@ -29,6 +29,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/child/child_thread_impl.h"
+#include "content/common/frame.mojom.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_features.h"
#include "content/public/common/navigation_policy.h"
@@ -40,6 +41,7 @@
#include "content/renderer/loader/resource_dispatcher.h"
#include "content/renderer/loader/sync_load_response.h"
#include "content/renderer/loader/web_url_request_util.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/data_url.h"
#include "net/base/filename_util.h"
#include "net/base/host_port_pair.h"
@@ -373,7 +375,7 @@
ResourceDispatcher* resource_dispatcher,
std::unique_ptr<WebResourceLoadingTaskRunnerHandle> task_runner_handle,
scoped_refptr<network::SharedURLLoaderFactory> factory,
- mojom::KeepAliveHandlePtr keep_alive_handle);
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle);
ResourceDispatcher* resource_dispatcher() { return resource_dispatcher_; }
int request_id() const { return request_id_; }
@@ -438,7 +440,7 @@
ResourceDispatcher* resource_dispatcher_;
std::unique_ptr<WebResourceLoadingTaskRunnerHandle> task_runner_handle_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- mojom::KeepAliveHandlePtr keep_alive_handle_;
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle_;
enum DeferState { NOT_DEFERRING, SHOULD_DEFER };
DeferState defers_loading_;
int request_id_;
@@ -557,14 +559,14 @@
ResourceDispatcher* resource_dispatcher,
std::unique_ptr<WebResourceLoadingTaskRunnerHandle> task_runner_handle,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
- mojom::KeepAliveHandlePtr keep_alive_handle_ptr)
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle)
: loader_(loader),
report_raw_headers_(false),
client_(nullptr),
resource_dispatcher_(resource_dispatcher),
task_runner_handle_(std::move(task_runner_handle)),
task_runner_(task_runner_handle_->GetTaskRunner()),
- keep_alive_handle_(std::move(keep_alive_handle_ptr)),
+ keep_alive_handle_(std::move(keep_alive_handle)),
defers_loading_(NOT_DEFERRING),
request_id_(-1),
url_loader_factory_(std::move(url_loader_factory)) {
@@ -1012,13 +1014,13 @@
: WebURLLoaderImpl(resource_dispatcher,
std::move(task_runner_handle),
std::move(url_loader_factory),
- nullptr) {}
+ mojo::NullRemote()) {}
WebURLLoaderImpl::WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
std::unique_ptr<WebResourceLoadingTaskRunnerHandle> task_runner_handle,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
- mojom::KeepAliveHandlePtr keep_alive_handle)
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle)
: context_(new Context(this,
resource_dispatcher,
std::move(task_runner_handle),
diff --git a/content/renderer/loader/web_url_loader_impl.h b/content/renderer/loader/web_url_loader_impl.h
index c5b97159..6c28739 100644
--- a/content/renderer/loader/web_url_loader_impl.h
+++ b/content/renderer/loader/web_url_loader_impl.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "content/common/frame.mojom.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
@@ -60,7 +61,7 @@
std::unique_ptr<blink::scheduler::WebResourceLoadingTaskRunnerHandle>
task_runner_handle,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
- mojom::KeepAliveHandlePtr keep_alive_handle);
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle);
~WebURLLoaderImpl() override;
static void PopulateURLResponse(const blink::WebURL& url,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index a81eb70..2a675b5 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -53,6 +53,7 @@
#include "content/common/content_security_policy/content_security_policy.h"
#include "content/common/content_security_policy_header.h"
#include "content/common/edit_command.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
#include "content/common/frame_replication_state.h"
@@ -146,7 +147,11 @@
#include "content/renderer/web_ui_extension_data.h"
#include "content/renderer/worker/dedicated_worker_host_factory_client.h"
#include "crypto/sha2.h"
+#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/data_url.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -1146,10 +1151,10 @@
// This should not be called if the frame is detached.
DCHECK(frame_);
- mojom::KeepAliveHandlePtr keep_alive_handle;
+ mojo::PendingRemote<mojom::KeepAliveHandle> keep_alive_handle;
if (request.GetKeepalive()) {
frame_->GetFrameHost()->IssueKeepAliveHandle(
- mojo::MakeRequest(&keep_alive_handle));
+ keep_alive_handle.InitWithNewPipeAndPassReceiver());
}
return std::make_unique<WebURLLoaderImpl>(
RenderThreadImpl::current()->resource_dispatcher(),
@@ -1869,8 +1874,6 @@
pepper_last_mouse_event_target_(nullptr),
#endif
autoplay_configuration_binding_(this),
- frame_binding_(this),
- frame_bindings_control_binding_(this),
frame_navigation_control_receiver_(this),
fullscreen_binding_(this),
mhtml_file_writer_binding_(this),
@@ -2354,16 +2357,16 @@
void RenderFrameImpl::BindFrame(
const service_manager::BindSourceInfo& browser_info,
- mojom::FrameRequest request) {
+ mojo::PendingReceiver<mojom::Frame> receiver) {
browser_info_ = browser_info;
- frame_binding_.Bind(std::move(request),
- GetTaskRunner(blink::TaskType::kInternalIPC));
+ frame_receiver_.Bind(std::move(receiver),
+ GetTaskRunner(blink::TaskType::kInternalIPC));
}
void RenderFrameImpl::BindFrameBindingsControl(
- mojom::FrameBindingsControlAssociatedRequest request) {
- frame_bindings_control_binding_.Bind(
- std::move(request), GetTaskRunner(blink::TaskType::kInternalIPC));
+ mojo::PendingAssociatedReceiver<mojom::FrameBindingsControl> receiver) {
+ frame_bindings_control_receiver_.Bind(
+ std::move(receiver), GetTaskRunner(blink::TaskType::kInternalIPC));
}
void RenderFrameImpl::BindFrameNavigationControl(
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 1708222..5deef72 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -67,6 +67,7 @@
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "ppapi/buildflags/buildflags.h"
@@ -889,13 +890,13 @@
// Binds to the FrameHost in the browser.
void BindFrame(const service_manager::BindSourceInfo& browser_info,
- mojom::FrameRequest request);
+ mojo::PendingReceiver<mojom::Frame> receiver);
// Virtual so that a TestRenderFrame can mock out the interface.
virtual mojom::FrameHost* GetFrameHost();
void BindFrameBindingsControl(
- mojom::FrameBindingsControlAssociatedRequest request);
+ mojo::PendingAssociatedReceiver<mojom::FrameBindingsControl> receiver);
void BindFrameNavigationControl(
mojo::PendingAssociatedReceiver<mojom::FrameNavigationControl> receiver);
// Only used when PerNavigationMojoInterface is enabled.
@@ -1665,9 +1666,9 @@
mojo::AssociatedBinding<blink::mojom::AutoplayConfigurationClient>
autoplay_configuration_binding_;
- mojo::Binding<mojom::Frame> frame_binding_;
- mojo::AssociatedBinding<mojom::FrameBindingsControl>
- frame_bindings_control_binding_;
+ mojo::Receiver<mojom::Frame> frame_receiver_{this};
+ mojo::AssociatedReceiver<mojom::FrameBindingsControl>
+ frame_bindings_control_receiver_{this};
mojo::AssociatedReceiver<mojom::FrameNavigationControl>
frame_navigation_control_receiver_;
mojo::AssociatedBinding<mojom::FullscreenVideoElementHandler>
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ac9ff1dc..5c652ff 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -63,6 +63,7 @@
#include "content/child/thread_safe_sender.h"
#include "content/common/buildflags.h"
#include "content/common/content_constants_internal.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
#include "content/common/view_messages.h"
@@ -122,8 +123,9 @@
#include "media/media_buildflags.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "net/base/net_errors.h"
#include "net/base/port_util.h"
@@ -312,8 +314,9 @@
private:
// mojom::FrameFactory:
- void CreateFrame(int32_t frame_routing_id,
- mojom::FrameRequest frame_request) override {
+ void CreateFrame(
+ int32_t frame_routing_id,
+ mojo::PendingReceiver<mojom::Frame> frame_receiver) override {
// TODO(morrita): This is for investigating http://crbug.com/415059 and
// should be removed once it is fixed.
CHECK_LT(routing_id_highmark_, frame_routing_id);
@@ -326,11 +329,11 @@
// we want.
if (!frame) {
RenderThreadImpl::current()->RegisterPendingFrameCreate(
- source_info_, frame_routing_id, std::move(frame_request));
+ source_info_, frame_routing_id, std::move(frame_receiver));
return;
}
- frame->BindFrame(source_info_, std::move(frame_request));
+ frame->BindFrame(source_info_, std::move(frame_receiver));
}
private:
@@ -338,10 +341,10 @@
int32_t routing_id_highmark_;
};
-void CreateFrameFactory(mojom::FrameFactoryRequest request,
+void CreateFrameFactory(mojo::PendingReceiver<mojom::FrameFactory> receiver,
const service_manager::BindSourceInfo& source_info) {
- mojo::MakeStrongBinding(std::make_unique<FrameFactoryImpl>(source_info),
- std::move(request));
+ mojo::MakeSelfOwnedReceiver(std::make_unique<FrameFactoryImpl>(source_info),
+ std::move(receiver));
}
scoped_refptr<viz::ContextProviderCommandBuffer> CreateOffscreenContext(
@@ -1076,7 +1079,7 @@
frame->GetTaskRunner(blink::TaskType::kInternalNavigationAssociated));
scoped_refptr<PendingFrameCreate> create(it->second);
- frame->BindFrame(it->second->browser_info(), it->second->TakeFrameRequest());
+ frame->BindFrame(it->second->browser_info(), it->second->TakeFrameReceiver());
pending_frame_creates_.erase(it);
}
@@ -1088,11 +1091,12 @@
void RenderThreadImpl::RegisterPendingFrameCreate(
const service_manager::BindSourceInfo& browser_info,
int routing_id,
- mojom::FrameRequest frame_request) {
+ mojo::PendingReceiver<mojom::Frame> frame_receiver) {
std::pair<PendingFrameCreateMap::iterator, bool> result =
pending_frame_creates_.insert(std::make_pair(
- routing_id, base::MakeRefCounted<PendingFrameCreate>(
- browser_info, routing_id, std::move(frame_request))));
+ routing_id,
+ base::MakeRefCounted<PendingFrameCreate>(browser_info, routing_id,
+ std::move(frame_receiver))));
CHECK(result.second) << "Inserting a duplicate item.";
}
@@ -2367,10 +2371,10 @@
RenderThreadImpl::PendingFrameCreate::PendingFrameCreate(
const service_manager::BindSourceInfo& browser_info,
int routing_id,
- mojom::FrameRequest frame_request)
+ mojo::PendingReceiver<mojom::Frame> frame_receiver)
: browser_info_(browser_info),
routing_id_(routing_id),
- frame_request_(std::move(frame_request)) {}
+ frame_receiver_(std::move(frame_receiver)) {}
RenderThreadImpl::PendingFrameCreate::~PendingFrameCreate() {
}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 7cd7d03..5ed2fca 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -425,7 +425,7 @@
void RegisterPendingFrameCreate(
const service_manager::BindSourceInfo& source_info,
int routing_id,
- mojom::FrameRequest frame);
+ mojo::PendingReceiver<mojom::Frame> frame);
mojom::RendererHost* GetRendererHost();
@@ -657,12 +657,14 @@
public:
PendingFrameCreate(const service_manager::BindSourceInfo& source_info,
int routing_id,
- mojom::FrameRequest frame_request);
+ mojo::PendingReceiver<mojom::Frame> frame_receiver);
const service_manager::BindSourceInfo& browser_info() const {
return browser_info_;
}
- mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); }
+ mojo::PendingReceiver<mojom::Frame> TakeFrameReceiver() {
+ return std::move(frame_receiver_);
+ }
private:
friend class base::RefCounted<PendingFrameCreate>;
@@ -674,7 +676,7 @@
service_manager::BindSourceInfo browser_info_;
int routing_id_;
- mojom::FrameRequest frame_request_;
+ mojo::PendingReceiver<mojom::Frame> frame_receiver_;
};
using PendingFrameCreateMap =
diff --git a/content/test/frame_host_interceptor.cc b/content/test/frame_host_interceptor.cc
index 155890a..21b7a7ae 100644
--- a/content/test/frame_host_interceptor.cc
+++ b/content/test/frame_host_interceptor.cc
@@ -8,9 +8,11 @@
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/common/frame.mojom-test-utils.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "mojo/public/cpp/bindings/associated_receiver.h"
namespace content {
@@ -22,18 +24,18 @@
FrameAgent(FrameHostInterceptor* interceptor, RenderFrameHost* rfh)
: interceptor_(interceptor),
rfhi_(static_cast<RenderFrameHostImpl*>(rfh)),
- impl_(binding().SwapImplForTesting(this)) {}
+ impl_(receiver().SwapImplForTesting(this)) {}
~FrameAgent() override {
- auto* old_impl = binding().SwapImplForTesting(impl_);
+ auto* old_impl = receiver().SwapImplForTesting(impl_);
// TODO(https://crbug.com/729021): Investigate the scenario where
// |old_impl| can be nullptr if the renderer process is killed.
DCHECK_EQ(this, old_impl);
}
protected:
- mojo::AssociatedBinding<mojom::FrameHost>& binding() {
- return rfhi_->frame_host_binding_for_testing();
+ mojo::AssociatedReceiver<mojom::FrameHost>& receiver() {
+ return rfhi_->frame_host_receiver_for_testing();
}
// mojom::FrameHostInterceptorForTesting:
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc
index 8d40b98..e5606bd 100644
--- a/content/test/navigation_simulator_impl.cc
+++ b/content/test/navigation_simulator_impl.cc
@@ -1128,14 +1128,14 @@
navigation_client_remote;
navigation_client_receiver_ =
navigation_client_remote.InitWithNewEndpointAndPassReceiver();
- render_frame_host_->frame_host_binding_for_testing()
+ render_frame_host_->frame_host_receiver_for_testing()
.impl()
->BeginNavigation(std::move(common_params), std::move(begin_params),
mojo::NullRemote(),
std::move(navigation_client_remote),
mojo::NullRemote());
} else {
- render_frame_host_->frame_host_binding_for_testing()
+ render_frame_host_->frame_host_receiver_for_testing()
.impl()
->BeginNavigation(std::move(common_params), std::move(begin_params),
mojo::NullRemote(), mojo::NullAssociatedRemote(),
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index e7fbc41e..b433a9d0 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
+#include "content/common/frame.mojom.h"
#include "content/common/frame_messages.h"
#include "content/common/navigation_params.h"
#include "content/common/navigation_params.mojom.h"
@@ -150,7 +151,8 @@
base::UnguessableToken());
}
- void IssueKeepAliveHandle(mojom::KeepAliveHandleRequest request) override {}
+ void IssueKeepAliveHandle(
+ mojo::PendingReceiver<mojom::KeepAliveHandle> receiver) override {}
void DidCommitSameDocumentNavigation(
std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params)