Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: mojo/system/message_pipe_dispatcher.cc

Issue 588193004: Mojo: Have |ProxyMessagePipeEndpoint|s constructed with a |ChannelEndpoint|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/message_pipe_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/message_pipe_dispatcher.cc
diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
index 85c0d38b6cfc92f871fa05e7c4d83f134a326f07..94aceb0e054c641d57036bea705114720b9ef2f2 100644
--- a/mojo/system/message_pipe_dispatcher.cc
+++ b/mojo/system/message_pipe_dispatcher.cc
@@ -83,14 +83,15 @@ Dispatcher::Type MessagePipeDispatcher::GetType() const {
}
// static
-std::pair<scoped_refptr<MessagePipeDispatcher>, scoped_refptr<MessagePipe> >
-MessagePipeDispatcher::CreateRemoteMessagePipe() {
- scoped_refptr<MessagePipe> message_pipe(MessagePipe::CreateLocalProxy());
+scoped_refptr<MessagePipeDispatcher>
+MessagePipeDispatcher::CreateRemoteMessagePipe(
+ scoped_refptr<ChannelEndpoint>* channel_endpoint) {
+ scoped_refptr<MessagePipe> message_pipe(
+ MessagePipe::CreateLocalProxy(channel_endpoint));
scoped_refptr<MessagePipeDispatcher> dispatcher(
new MessagePipeDispatcher(MessagePipeDispatcher::kDefaultCreateOptions));
dispatcher->Init(message_pipe, 0);
-
- return std::make_pair(dispatcher, message_pipe);
+ return dispatcher;
}
// static
@@ -103,8 +104,9 @@ scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
return scoped_refptr<MessagePipeDispatcher>();
}
- std::pair<scoped_refptr<MessagePipeDispatcher>, scoped_refptr<MessagePipe> >
- remote_message_pipe = CreateRemoteMessagePipe();
+ scoped_refptr<ChannelEndpoint> channel_endpoint;
+ scoped_refptr<MessagePipeDispatcher> dispatcher =
+ CreateRemoteMessagePipe(&channel_endpoint);
MessageInTransit::EndpointId remote_id =
static_cast<const SerializedMessagePipeDispatcher*>(source)->endpoint_id;
@@ -117,8 +119,7 @@ scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
return scoped_refptr<MessagePipeDispatcher>();
}
MessageInTransit::EndpointId local_id =
- channel->AttachEndpoint(make_scoped_refptr(
- new ChannelEndpoint(remote_message_pipe.second.get(), 1)));
+ channel->AttachEndpoint(channel_endpoint);
if (local_id == MessageInTransit::kInvalidEndpointId) {
LOG(ERROR) << "Failed to deserialize message pipe dispatcher (failed to "
"attach; remote ID = " << remote_id << ")";
@@ -135,7 +136,7 @@ scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
// TODO(vtl): FIXME -- Need some error handling here.
channel->RunRemoteMessagePipeEndpoint(local_id, remote_id);
- return remote_message_pipe.first;
+ return dispatcher;
}
MessagePipeDispatcher::~MessagePipeDispatcher() {
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/message_pipe_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698