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

Side by Side Diff: ipc/ipc_channel_common.cc

Issue 2047233002: Support using a Mojo message pipe in a ChannelHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-handle-attachemnt-public-api
Patch Set: comments Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | ipc/ipc_channel_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 #include "ipc/ipc_channel.h" 6 #include "ipc/ipc_channel.h"
7 #include "ipc/ipc_channel_mojo.h"
7 8
8 namespace IPC { 9 namespace IPC {
9 10
10 // static 11 // static
11 std::unique_ptr<Channel> Channel::CreateClient( 12 std::unique_ptr<Channel> Channel::CreateClient(
12 const IPC::ChannelHandle& channel_handle, 13 const IPC::ChannelHandle& channel_handle,
13 Listener* listener) { 14 Listener* listener) {
15 if (channel_handle.mojo_handle.is_valid()) {
16 return ChannelMojo::Create(
17 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
18 Channel::MODE_CLIENT, listener);
19 }
14 return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener); 20 return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener);
15 } 21 }
16 22
17 // static 23 // static
18 std::unique_ptr<Channel> Channel::CreateNamedServer( 24 std::unique_ptr<Channel> Channel::CreateNamedServer(
19 const IPC::ChannelHandle& channel_handle, 25 const IPC::ChannelHandle& channel_handle,
20 Listener* listener) { 26 Listener* listener) {
21 return Channel::Create(channel_handle, Channel::MODE_NAMED_SERVER, listener); 27 return Channel::Create(channel_handle, Channel::MODE_NAMED_SERVER, listener);
22 } 28 }
23 29
(...skipping 11 matching lines...) Expand all
35 Listener* listener) { 41 Listener* listener) {
36 return Channel::Create(channel_handle, Channel::MODE_OPEN_NAMED_SERVER, 42 return Channel::Create(channel_handle, Channel::MODE_OPEN_NAMED_SERVER,
37 listener); 43 listener);
38 } 44 }
39 #endif 45 #endif
40 46
41 // static 47 // static
42 std::unique_ptr<Channel> Channel::CreateServer( 48 std::unique_ptr<Channel> Channel::CreateServer(
43 const IPC::ChannelHandle& channel_handle, 49 const IPC::ChannelHandle& channel_handle,
44 Listener* listener) { 50 Listener* listener) {
51 if (channel_handle.mojo_handle.is_valid()) {
52 return ChannelMojo::Create(
53 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
54 Channel::MODE_SERVER, listener);
55 }
45 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener); 56 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener);
46 } 57 }
47 58
48 Channel::~Channel() { 59 Channel::~Channel() {
49 } 60 }
50 61
51 bool Channel::IsSendThreadSafe() const { 62 bool Channel::IsSendThreadSafe() const {
52 return false; 63 return false;
53 } 64 }
54 65
55 void Channel::OnSetAttachmentBrokerEndpoint() { 66 void Channel::OnSetAttachmentBrokerEndpoint() {
56 CHECK(!did_start_connect_); 67 CHECK(!did_start_connect_);
57 } 68 }
58 69
59 void Channel::WillConnect() { 70 void Channel::WillConnect() {
60 did_start_connect_ = true; 71 did_start_connect_ = true;
61 } 72 }
62 73
63 } // namespace IPC 74 } // namespace IPC
64 75
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698