Commit 69604f6f authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert ipc::mojom::GenericInterface to new Mojo types

This CL converts ipc::mojom::GenericInterface to new Mojo types
with PendingAssociatedReceiver instead of
GenericInterfaceAssociatedRequest.

It also updates GetAssociatedInterface() with
pending_associated_receiver from ipc/ipc.mojom.

Bug: 955171
Change-Id: I92ebbb25e51b1bbf5fba0417413d66455d277744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948385Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721310}
parent 70b40e51
...@@ -27,7 +27,9 @@ interface Channel { ...@@ -27,7 +27,9 @@ interface Channel {
Receive(Message message); Receive(Message message);
// Requests a Channel-associated interface. // Requests a Channel-associated interface.
GetAssociatedInterface(string name, associated GenericInterface& request); GetAssociatedInterface(
string name,
pending_associated_receiver<GenericInterface> receiver);
}; };
// A strictly nominal interface used to identify Channel bootstrap requests. // A strictly nominal interface used to identify Channel bootstrap requests.
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "ipc/message_filter.h" #include "ipc/message_filter.h"
#include "ipc/message_filter_router.h" #include "ipc/message_filter_router.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
namespace IPC { namespace IPC {
...@@ -607,7 +608,8 @@ void ChannelProxy::GetGenericRemoteAssociatedInterface( ...@@ -607,7 +608,8 @@ void ChannelProxy::GetGenericRemoteAssociatedInterface(
mojo::ScopedInterfaceEndpointHandle handle) { mojo::ScopedInterfaceEndpointHandle handle) {
DCHECK(did_init_); DCHECK(did_init_);
context()->thread_safe_channel().GetAssociatedInterface( context()->thread_safe_channel().GetAssociatedInterface(
name, mojom::GenericInterfaceAssociatedRequest(std::move(handle))); name, mojo::PendingAssociatedReceiver<mojom::GenericInterface>(
std::move(handle)));
} }
void ChannelProxy::ClearIPCTaskRunner() { void ChannelProxy::ClearIPCTaskRunner() {
......
...@@ -74,7 +74,8 @@ void MessagePipeReader::GetRemoteInterface( ...@@ -74,7 +74,8 @@ void MessagePipeReader::GetRemoteInterface(
if (!sender_.is_bound()) if (!sender_.is_bound())
return; return;
sender_->GetAssociatedInterface( sender_->GetAssociatedInterface(
name, mojom::GenericInterfaceAssociatedRequest(std::move(handle))); name, mojo::PendingAssociatedReceiver<mojom::GenericInterface>(
std::move(handle)));
} }
void MessagePipeReader::SetPeerPid(int32_t peer_pid) { void MessagePipeReader::SetPeerPid(int32_t peer_pid) {
...@@ -109,10 +110,10 @@ void MessagePipeReader::Receive(MessageView message_view) { ...@@ -109,10 +110,10 @@ void MessagePipeReader::Receive(MessageView message_view) {
void MessagePipeReader::GetAssociatedInterface( void MessagePipeReader::GetAssociatedInterface(
const std::string& name, const std::string& name,
mojom::GenericInterfaceAssociatedRequest request) { mojo::PendingAssociatedReceiver<mojom::GenericInterface> receiver) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
if (delegate_) if (delegate_)
delegate_->OnAssociatedInterfaceRequest(name, request.PassHandle()); delegate_->OnAssociatedInterfaceRequest(name, receiver.PassHandle());
} }
void MessagePipeReader::OnPipeError(MojoResult error) { void MessagePipeReader::OnPipeError(MojoResult error) {
......
...@@ -99,7 +99,8 @@ class COMPONENT_EXPORT(IPC) MessagePipeReader : public mojom::Channel { ...@@ -99,7 +99,8 @@ class COMPONENT_EXPORT(IPC) MessagePipeReader : public mojom::Channel {
void Receive(MessageView message_view) override; void Receive(MessageView message_view) override;
void GetAssociatedInterface( void GetAssociatedInterface(
const std::string& name, const std::string& name,
mojom::GenericInterfaceAssociatedRequest request) override; mojo::PendingAssociatedReceiver<mojom::GenericInterface> receiver)
override;
// |delegate_| is null once the message pipe is closed. // |delegate_| is null once the message pipe is closed.
Delegate* delegate_; Delegate* delegate_;
......
...@@ -85,7 +85,8 @@ class PeerPidReceiver : public IPC::mojom::Channel { ...@@ -85,7 +85,8 @@ class PeerPidReceiver : public IPC::mojom::Channel {
void GetAssociatedInterface( void GetAssociatedInterface(
const std::string& name, const std::string& name,
IPC::mojom::GenericInterfaceAssociatedRequest request) override {} mojo::PendingAssociatedReceiver<IPC::mojom::GenericInterface> receiver)
override {}
int32_t peer_pid() const { return peer_pid_; } int32_t peer_pid() const { return peer_pid_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment