summaryrefslogtreecommitdiffstats
path: root/ipc/mojo/ipc_channel_mojo.h
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/mojo/ipc_channel_mojo.h')
-rw-r--r--ipc/mojo/ipc_channel_mojo.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h
index c1b659a..a996790 100644
--- a/ipc/mojo/ipc_channel_mojo.h
+++ b/ipc/mojo/ipc_channel_mojo.h
@@ -26,9 +26,8 @@ namespace IPC {
// Mojo-based IPC::Channel implementation over a Mojo message pipe.
//
-// ChannelMojo builds a Mojo MessagePipe using the provided message pipe
-// |handle| and builds an associated interface for each direction on the
-// channel.
+// ChannelMojo builds a Mojo MessagePipe using the provided token and builds an
+// associated interface for each direction on the channel.
//
// TODO(morrita): Add APIs to create extra MessagePipes to let
// Mojo-based objects talk over this Channel.
@@ -41,8 +40,8 @@ class IPC_MOJO_EXPORT ChannelMojo
// True if ChannelMojo should be used regardless of the flag.
static bool ShouldBeUsed();
- // Creates a ChannelMojo.
- static scoped_ptr<ChannelMojo> Create(mojo::ScopedMessagePipeHandle handle,
+ // Create ChannelMojo. A bootstrap channel is created as well.
+ static scoped_ptr<ChannelMojo> Create(const std::string& token,
Mode mode,
Listener* listener);
@@ -50,10 +49,10 @@ class IPC_MOJO_EXPORT ChannelMojo
// The factory is used to create Mojo-based ChannelProxy family.
// |host| must not be null.
static scoped_ptr<ChannelFactory> CreateServerFactory(
- mojo::ScopedMessagePipeHandle handle);
+ const std::string& token);
static scoped_ptr<ChannelFactory> CreateClientFactory(
- mojo::ScopedMessagePipeHandle handle);
+ const std::string& token);
~ChannelMojo() override;
@@ -72,11 +71,11 @@ class IPC_MOJO_EXPORT ChannelMojo
// These access protected API of IPC::Message, which has ChannelMojo
// as a friend class.
static MojoResult WriteToMessageAttachmentSet(
- mojo::Array<mojom::SerializedHandlePtr> handle_buffer,
+ mojo::Array<mojo::ScopedHandle> handle_buffer,
Message* message);
static MojoResult ReadFromMessageAttachmentSet(
Message* message,
- mojo::Array<mojom::SerializedHandlePtr>* handles);
+ mojo::Array<mojo::ScopedHandle>* handles);
// MojoBootstrapDelegate implementation
void OnPipesAvailable(mojom::ChannelAssociatedPtrInfo send_channel,
@@ -90,21 +89,27 @@ class IPC_MOJO_EXPORT ChannelMojo
void OnPipeError(internal::MessagePipeReader* reader) override;
private:
- ChannelMojo(mojo::ScopedMessagePipeHandle handle,
+ ChannelMojo(const std::string& token,
Mode mode,
Listener* listener);
void InitMessageReader(mojom::ChannelAssociatedPtrInfo sender,
- mojom::ChannelAssociatedRequest receiver,
- base::ProcessId peer_pid);
+ mojom::ChannelAssociatedRequest receiver);
+
+ void set_peer_pid(base::ProcessId pid) { peer_pid_ = pid; }
// ChannelMojo needs to kill its MessagePipeReader in delayed manner
// because the channel wants to kill these readers during the
// notifications invoked by them.
typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter;
+ scoped_ptr<internal::MessagePipeReader, ReaderDeleter> CreateMessageReader(
+ mojom::ChannelAssociatedPtrInfo sender,
+ mojom::ChannelAssociatedRequest receiver);
+
scoped_ptr<MojoBootstrap> bootstrap_;
Listener* listener_;
+ base::ProcessId peer_pid_;
scoped_ptr<internal::MessagePipeReader, ReaderDeleter> message_reader_;
std::vector<scoped_ptr<Message>> pending_messages_;