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

Side by Side Diff: ipc/ipc_channel_common.cc

Issue 2473993003: Delete IPC::ChannelPosix, IPC::ChannelWin and IPC::AttachmentBroker. (Closed)
Patch Set: Created 4 years, 1 month 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 | « ipc/ipc_channel.h ('k') | 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 #include "ipc/ipc_channel_mojo.h"
8 #include "mojo/public/cpp/system/message_pipe.h" 8 #include "mojo/public/cpp/system/message_pipe.h"
9 9
10 namespace IPC { 10 namespace IPC {
11 11
12 #if defined(OS_LINUX)
13
14 namespace {
15 int g_global_pid = 0;
16 }
17
18 // static
19 void Channel::SetGlobalPid(int pid) {
20 g_global_pid = pid;
21 }
22
23 // static
24 int Channel::GetGlobalPid() {
25 return g_global_pid;
26 }
27
28 #endif // defined(OS_LINUX)
29
12 // static 30 // static
13 std::unique_ptr<Channel> Channel::CreateClient( 31 std::unique_ptr<Channel> Channel::CreateClient(
14 const IPC::ChannelHandle& channel_handle, 32 const IPC::ChannelHandle& channel_handle,
15 Listener* listener, 33 Listener* listener,
16 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 34 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
17 if (channel_handle.mojo_handle.is_valid()) { 35 #if defined(OS_NACL_SFI)
18 return ChannelMojo::Create(
19 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
20 Channel::MODE_CLIENT, listener, ipc_task_runner);
21 }
22 return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener); 36 return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener);
37 #else
38 DCHECK(channel_handle.is_mojo_channel_handle());
39 return ChannelMojo::Create(
40 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
41 Channel::MODE_CLIENT, listener, ipc_task_runner);
42 #endif
23 } 43 }
24 44
25 // static 45 // static
26 std::unique_ptr<Channel> Channel::CreateNamedServer(
27 const IPC::ChannelHandle& channel_handle,
28 Listener* listener) {
29 return Channel::Create(channel_handle, Channel::MODE_NAMED_SERVER, listener);
30 }
31
32 // static
33 std::unique_ptr<Channel> Channel::CreateNamedClient(
34 const IPC::ChannelHandle& channel_handle,
35 Listener* listener) {
36 return Channel::Create(channel_handle, Channel::MODE_NAMED_CLIENT, listener);
37 }
38
39 // static
40 std::unique_ptr<Channel> Channel::CreateServer( 46 std::unique_ptr<Channel> Channel::CreateServer(
41 const IPC::ChannelHandle& channel_handle, 47 const IPC::ChannelHandle& channel_handle,
42 Listener* listener, 48 Listener* listener,
43 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 49 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
44 if (channel_handle.mojo_handle.is_valid()) { 50 #if defined(OS_NACL_SFI)
45 return ChannelMojo::Create(
46 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
47 Channel::MODE_SERVER, listener, ipc_task_runner);
48 }
49 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener); 51 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener);
52 #else
53 DCHECK(channel_handle.is_mojo_channel_handle());
54 return ChannelMojo::Create(
55 mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
56 Channel::MODE_SERVER, listener, ipc_task_runner);
57 #endif
50 } 58 }
51 59
52 // static 60 // static
53 void Channel::GenerateMojoChannelHandlePair( 61 void Channel::GenerateMojoChannelHandlePair(
54 const std::string& name_postfix, 62 const std::string& name_postfix,
55 IPC::ChannelHandle* handle0, 63 IPC::ChannelHandle* handle0,
56 IPC::ChannelHandle* handle1) { 64 IPC::ChannelHandle* handle1) {
57 DCHECK_NE(handle0, handle1); 65 DCHECK_NE(handle0, handle1);
58 mojo::MessagePipe message_pipe; 66 mojo::MessagePipe message_pipe;
59 *handle0 = ChannelHandle(message_pipe.handle0.release()); 67 *handle0 = ChannelHandle(message_pipe.handle0.release());
(...skipping 15 matching lines...) Expand all
75 83
76 void Channel::OnSetAttachmentBrokerEndpoint() { 84 void Channel::OnSetAttachmentBrokerEndpoint() {
77 CHECK(!did_start_connect_); 85 CHECK(!did_start_connect_);
78 } 86 }
79 87
80 void Channel::WillConnect() { 88 void Channel::WillConnect() {
81 did_start_connect_ = true; 89 did_start_connect_ = true;
82 } 90 }
83 91
84 } // namespace IPC 92 } // namespace IPC
85
OLDNEW
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_channel_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698