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

Side by Side Diff: ipc/ipc_channel.h

Issue 1184523003: attachment broker wip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comments. Created 5 years, 6 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 | « ipc/ipc.gypi ('k') | ipc/ipc_channel_common.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef IPC_IPC_CHANNEL_H_ 5 #ifndef IPC_IPC_CHANNEL_H_
6 #define IPC_IPC_CHANNEL_H_ 6 #define IPC_IPC_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
11 #include <sys/types.h> 11 #include <sys/types.h>
12 #endif 12 #endif
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "ipc/ipc_channel_handle.h" 17 #include "ipc/ipc_channel_handle.h"
18 #include "ipc/ipc_message.h" 18 #include "ipc/ipc_message.h"
19 #include "ipc/ipc_sender.h" 19 #include "ipc/ipc_sender.h"
20 20
21 namespace IPC { 21 namespace IPC {
22 22
23 class AttachmentBroker;
23 class Listener; 24 class Listener;
24 25
25 //------------------------------------------------------------------------------ 26 //------------------------------------------------------------------------------
26 // See 27 // See
27 // http://www.chromium.org/developers/design-documents/inter-process-communicati on 28 // http://www.chromium.org/developers/design-documents/inter-process-communicati on
28 // for overview of IPC in Chromium. 29 // for overview of IPC in Chromium.
29 30
30 // Channels are implemented using named pipes on Windows, and 31 // Channels are implemented using named pipes on Windows, and
31 // socket pairs (or in some special cases unix domain sockets) on POSIX. 32 // socket pairs (or in some special cases unix domain sockets) on POSIX.
32 // On Windows we access pipes in various processes by name. 33 // On Windows we access pipes in various processes by name.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // - An "open" named server: It accepts connections from ANY client. 112 // - An "open" named server: It accepts connections from ANY client.
112 // The caller must then implement their own access-control based on the 113 // The caller must then implement their own access-control based on the
113 // client process' user Id. 114 // client process' user Id.
114 // - Client and named client: In these mode, the Channel merely 115 // - Client and named client: In these mode, the Channel merely
115 // connects to the already established IPC object. 116 // connects to the already established IPC object.
116 // 117 //
117 // Each mode has its own Create*() API to create the Channel object. 118 // Each mode has its own Create*() API to create the Channel object.
118 // 119 //
119 // TODO(morrita): Replace CreateByModeForProxy() with one of above Create*(). 120 // TODO(morrita): Replace CreateByModeForProxy() with one of above Create*().
120 // 121 //
121 static scoped_ptr<Channel> Create( 122 static scoped_ptr<Channel> Create(const IPC::ChannelHandle& channel_handle,
122 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener); 123 Mode mode,
124 Listener* listener,
125 AttachmentBroker* broker);
123 126
124 static scoped_ptr<Channel> CreateClient( 127 static scoped_ptr<Channel> CreateClient(
125 const IPC::ChannelHandle &channel_handle, Listener* listener); 128 const IPC::ChannelHandle& channel_handle,
129 Listener* listener,
130 AttachmentBroker* broker);
126 131
127 // Channels on Windows are named by default and accessible from other 132 // Channels on Windows are named by default and accessible from other
128 // processes. On POSIX channels are anonymous by default and not accessible 133 // processes. On POSIX channels are anonymous by default and not accessible
129 // from other processes. Named channels work via named unix domain sockets. 134 // from other processes. Named channels work via named unix domain sockets.
130 // On Windows MODE_NAMED_SERVER is equivalent to MODE_SERVER and 135 // On Windows MODE_NAMED_SERVER is equivalent to MODE_SERVER and
131 // MODE_NAMED_CLIENT is equivalent to MODE_CLIENT. 136 // MODE_NAMED_CLIENT is equivalent to MODE_CLIENT.
132 static scoped_ptr<Channel> CreateNamedServer( 137 static scoped_ptr<Channel> CreateNamedServer(
133 const IPC::ChannelHandle &channel_handle, Listener* listener); 138 const IPC::ChannelHandle& channel_handle,
139 Listener* listener,
140 AttachmentBroker* broker);
134 static scoped_ptr<Channel> CreateNamedClient( 141 static scoped_ptr<Channel> CreateNamedClient(
135 const IPC::ChannelHandle &channel_handle, Listener* listener); 142 const IPC::ChannelHandle& channel_handle,
143 Listener* listener,
144 AttachmentBroker* broker);
136 #if defined(OS_POSIX) 145 #if defined(OS_POSIX)
137 // An "open" named server accepts connections from ANY client. 146 // An "open" named server accepts connections from ANY client.
138 // The caller must then implement their own access-control based on the 147 // The caller must then implement their own access-control based on the
139 // client process' user Id. 148 // client process' user Id.
140 static scoped_ptr<Channel> CreateOpenNamedServer( 149 static scoped_ptr<Channel> CreateOpenNamedServer(
141 const IPC::ChannelHandle &channel_handle, Listener* listener); 150 const IPC::ChannelHandle& channel_handle,
151 Listener* listener,
152 AttachmentBroker* broker);
142 #endif 153 #endif
143 static scoped_ptr<Channel> CreateServer( 154 static scoped_ptr<Channel> CreateServer(
144 const IPC::ChannelHandle &channel_handle, Listener* listener); 155 const IPC::ChannelHandle& channel_handle,
156 Listener* listener,
157 AttachmentBroker* broker);
145 158
146 ~Channel() override; 159 ~Channel() override;
147 160
148 // Connect the pipe. On the server side, this will initiate 161 // Connect the pipe. On the server side, this will initiate
149 // waiting for connections. On the client, it attempts to 162 // waiting for connections. On the client, it attempts to
150 // connect to a pre-existing pipe. Note, calling Connect() 163 // connect to a pre-existing pipe. Note, calling Connect()
151 // will not block the calling thread and may complete 164 // will not block the calling thread and may complete
152 // asynchronously. 165 // asynchronously.
153 virtual bool Connect() WARN_UNUSED_RESULT = 0; 166 virtual bool Connect() WARN_UNUSED_RESULT = 0;
154 167
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 247
235 #if defined(OS_POSIX) 248 #if defined(OS_POSIX)
236 // SocketPair() creates a pair of socket FDs suitable for using with 249 // SocketPair() creates a pair of socket FDs suitable for using with
237 // IPC::Channel. 250 // IPC::Channel.
238 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); 251 IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
239 #endif 252 #endif
240 253
241 } // namespace IPC 254 } // namespace IPC
242 255
243 #endif // IPC_IPC_CHANNEL_H_ 256 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « ipc/ipc.gypi ('k') | ipc/ipc_channel_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698