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

Unified Diff: mojo/embedder/embedder.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 | « no previous file | mojo/system/channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/embedder/embedder.cc
diff --git a/mojo/embedder/embedder.cc b/mojo/embedder/embedder.cc
index 5b2478ab0dd503f3751dfd0623df98d9bb2d4f83..ca9bcd7d7ae932b56db28c721e201aa74340258b 100644
--- a/mojo/embedder/embedder.cc
+++ b/mojo/embedder/embedder.cc
@@ -14,7 +14,6 @@
#include "mojo/system/core.h"
#include "mojo/system/entrypoints.h"
#include "mojo/system/message_in_transit.h"
-#include "mojo/system/message_pipe.h"
#include "mojo/system/message_pipe_dispatcher.h"
#include "mojo/system/platform_handle_dispatcher.h"
#include "mojo/system/raw_channel.h"
@@ -42,7 +41,7 @@ namespace {
scoped_refptr<system::Channel> MakeChannel(
system::Core* core,
ScopedPlatformHandle platform_handle,
- scoped_refptr<system::MessagePipe> message_pipe) {
+ scoped_refptr<system::ChannelEndpoint> channel_endpoint) {
DCHECK(platform_handle.is_valid());
// Create and initialize a |system::Channel|.
@@ -58,9 +57,9 @@ scoped_refptr<system::Channel> MakeChannel(
// Once |Init()| has succeeded, we have to return |channel| (since
// |Shutdown()| will have to be called on it).
- // Attach the message pipe endpoint.
- system::MessageInTransit::EndpointId endpoint_id = channel->AttachEndpoint(
- make_scoped_refptr(new system::ChannelEndpoint(message_pipe.get(), 1)));
+ // Attach the endpoint.
+ system::MessageInTransit::EndpointId endpoint_id =
+ channel->AttachEndpoint(channel_endpoint);
if (endpoint_id == system::MessageInTransit::kInvalidEndpointId) {
// This means that, e.g., the other endpoint of the message pipe was closed
// first. But it's not necessarily an error per se.
@@ -83,11 +82,11 @@ void CreateChannelHelper(
system::Core* core,
ScopedPlatformHandle platform_handle,
scoped_ptr<ChannelInfo> channel_info,
- scoped_refptr<system::MessagePipe> message_pipe,
+ scoped_refptr<system::ChannelEndpoint> channel_endpoint,
DidCreateChannelCallback callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
channel_info->channel =
- MakeChannel(core, platform_handle.Pass(), message_pipe);
+ MakeChannel(core, platform_handle.Pass(), channel_endpoint);
// Hand the channel back to the embedder.
if (callback_thread_task_runner.get()) {
@@ -111,18 +110,18 @@ ScopedMessagePipeHandle CreateChannelOnIOThread(
DCHECK(platform_handle.is_valid());
DCHECK(channel_info);
- std::pair<scoped_refptr<system::MessagePipeDispatcher>,
- scoped_refptr<system::MessagePipe> > remote_message_pipe =
- system::MessagePipeDispatcher::CreateRemoteMessagePipe();
+ scoped_refptr<system::ChannelEndpoint> channel_endpoint;
+ scoped_refptr<system::MessagePipeDispatcher> dispatcher =
+ system::MessagePipeDispatcher::CreateRemoteMessagePipe(&channel_endpoint);
system::Core* core = system::entrypoints::GetCore();
DCHECK(core);
ScopedMessagePipeHandle rv(
- MessagePipeHandle(core->AddDispatcher(remote_message_pipe.first)));
+ MessagePipeHandle(core->AddDispatcher(dispatcher)));
*channel_info = new ChannelInfo();
(*channel_info)->channel =
- MakeChannel(core, platform_handle.Pass(), remote_message_pipe.second);
+ MakeChannel(core, platform_handle.Pass(), channel_endpoint);
return rv.Pass();
}
@@ -134,14 +133,14 @@ ScopedMessagePipeHandle CreateChannel(
scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
DCHECK(platform_handle.is_valid());
- std::pair<scoped_refptr<system::MessagePipeDispatcher>,
- scoped_refptr<system::MessagePipe> > remote_message_pipe =
- system::MessagePipeDispatcher::CreateRemoteMessagePipe();
+ scoped_refptr<system::ChannelEndpoint> channel_endpoint;
+ scoped_refptr<system::MessagePipeDispatcher> dispatcher =
+ system::MessagePipeDispatcher::CreateRemoteMessagePipe(&channel_endpoint);
system::Core* core = system::entrypoints::GetCore();
DCHECK(core);
ScopedMessagePipeHandle rv(
- MessagePipeHandle(core->AddDispatcher(remote_message_pipe.first)));
+ MessagePipeHandle(core->AddDispatcher(dispatcher)));
scoped_ptr<ChannelInfo> channel_info(new ChannelInfo());
channel_info->io_thread_task_runner = io_thread_task_runner;
@@ -152,7 +151,7 @@ ScopedMessagePipeHandle CreateChannel(
base::Unretained(core),
base::Passed(&platform_handle),
base::Passed(&channel_info),
- remote_message_pipe.second,
+ channel_endpoint,
callback,
callback_thread_task_runner));
} else {
« no previous file with comments | « no previous file | mojo/system/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698