summaryrefslogtreecommitdiffstats
path: root/mojo/embedder/embedder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/embedder/embedder.cc')
-rw-r--r--mojo/embedder/embedder.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/mojo/embedder/embedder.cc b/mojo/embedder/embedder.cc
index 5b2478a..ca9bcd7 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 {