Skip to content
Permalink
Browse files

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/+/1948385
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721310}
  • Loading branch information
jkim-julie authored and Commit Bot committed Dec 4, 2019
1 parent 70b40e5 commit 69604f6ff84ed2211acda71a3443e32258b417ff
@@ -27,7 +27,9 @@ interface Channel {
Receive(Message message);

// 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.
@@ -23,6 +23,7 @@
#include "ipc/ipc_message_macros.h"
#include "ipc/message_filter.h"
#include "ipc/message_filter_router.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"

namespace IPC {

@@ -607,7 +608,8 @@ void ChannelProxy::GetGenericRemoteAssociatedInterface(
mojo::ScopedInterfaceEndpointHandle handle) {
DCHECK(did_init_);
context()->thread_safe_channel().GetAssociatedInterface(
name, mojom::GenericInterfaceAssociatedRequest(std::move(handle)));
name, mojo::PendingAssociatedReceiver<mojom::GenericInterface>(
std::move(handle)));
}

void ChannelProxy::ClearIPCTaskRunner() {
@@ -74,7 +74,8 @@ void MessagePipeReader::GetRemoteInterface(
if (!sender_.is_bound())
return;
sender_->GetAssociatedInterface(
name, mojom::GenericInterfaceAssociatedRequest(std::move(handle)));
name, mojo::PendingAssociatedReceiver<mojom::GenericInterface>(
std::move(handle)));
}

void MessagePipeReader::SetPeerPid(int32_t peer_pid) {
@@ -109,10 +110,10 @@ void MessagePipeReader::Receive(MessageView message_view) {

void MessagePipeReader::GetAssociatedInterface(
const std::string& name,
mojom::GenericInterfaceAssociatedRequest request) {
mojo::PendingAssociatedReceiver<mojom::GenericInterface> receiver) {
DCHECK(thread_checker_.CalledOnValidThread());
if (delegate_)
delegate_->OnAssociatedInterfaceRequest(name, request.PassHandle());
delegate_->OnAssociatedInterfaceRequest(name, receiver.PassHandle());
}

void MessagePipeReader::OnPipeError(MojoResult error) {
@@ -99,7 +99,8 @@ class COMPONENT_EXPORT(IPC) MessagePipeReader : public mojom::Channel {
void Receive(MessageView message_view) override;
void GetAssociatedInterface(
const std::string& name,
mojom::GenericInterfaceAssociatedRequest request) override;
mojo::PendingAssociatedReceiver<mojom::GenericInterface> receiver)
override;

// |delegate_| is null once the message pipe is closed.
Delegate* delegate_;
@@ -85,7 +85,8 @@ class PeerPidReceiver : public IPC::mojom::Channel {

void GetAssociatedInterface(
const std::string& name,
IPC::mojom::GenericInterfaceAssociatedRequest request) override {}
mojo::PendingAssociatedReceiver<IPC::mojom::GenericInterface> receiver)
override {}

int32_t peer_pid() const { return peer_pid_; }

0 comments on commit 69604f6

Please sign in to comment.
You can’t perform that action at this time.