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

Side by Side Diff: ipc/ipc_channel.h

Issue 1258323004: Reland #1: Clean up interface of attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/attachment_broker_unprivileged.cc ('k') | ipc/ipc_channel_nacl.h » ('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)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 AttachmentBroker* broker); 158 AttachmentBroker* broker);
159 #endif 159 #endif
160 // TODO(erikchen): Remove default parameter for |broker|. It exists only to 160 // TODO(erikchen): Remove default parameter for |broker|. It exists only to
161 // make the upcoming refactor decomposable into smaller CLs. 161 // make the upcoming refactor decomposable into smaller CLs.
162 // http://crbug.com/493414. 162 // http://crbug.com/493414.
163 static scoped_ptr<Channel> CreateServer( 163 static scoped_ptr<Channel> CreateServer(
164 const IPC::ChannelHandle& channel_handle, 164 const IPC::ChannelHandle& channel_handle,
165 Listener* listener, 165 Listener* listener,
166 AttachmentBroker* broker = nullptr); 166 AttachmentBroker* broker = nullptr);
167 167
168 Channel() : attachment_broker_endpoint_(false) {}
168 ~Channel() override; 169 ~Channel() override;
169 170
170 // Connect the pipe. On the server side, this will initiate 171 // Connect the pipe. On the server side, this will initiate
171 // waiting for connections. On the client, it attempts to 172 // waiting for connections. On the client, it attempts to
172 // connect to a pre-existing pipe. Note, calling Connect() 173 // connect to a pre-existing pipe. Note, calling Connect()
173 // will not block the calling thread and may complete 174 // will not block the calling thread and may complete
174 // asynchronously. 175 // asynchronously.
175 virtual bool Connect() WARN_UNUSED_RESULT = 0; 176 virtual bool Connect() WARN_UNUSED_RESULT = 0;
176 177
177 // Close this Channel explicitly. May be called multiple times. 178 // Close this Channel explicitly. May be called multiple times.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 #endif 246 #endif
246 247
247 #if defined(OS_ANDROID) 248 #if defined(OS_ANDROID)
248 // Most tests are single process and work the same on all platforms. However 249 // Most tests are single process and work the same on all platforms. However
249 // in some cases we want to test multi-process, and Android differs in that it 250 // in some cases we want to test multi-process, and Android differs in that it
250 // can't 'exec' after forking. This callback resets any data in the forked 251 // can't 'exec' after forking. This callback resets any data in the forked
251 // process such that it acts similar to if it was exec'd, for tests. 252 // process such that it acts similar to if it was exec'd, for tests.
252 static void NotifyProcessForkedForTesting(); 253 static void NotifyProcessForkedForTesting();
253 #endif 254 #endif
254 255
256 void set_attachment_broker_endpoint(bool is_endpoint) {
257 attachment_broker_endpoint_ = is_endpoint;
258 }
259
260 protected:
261 bool is_attachment_broker_endpoint() { return attachment_broker_endpoint_; }
262
263 private:
264 // Whether this channel is used as an endpoint for sending and receiving
265 // brokerable attachment messages to/from the broker process.
266 bool attachment_broker_endpoint_;
255 }; 267 };
256 268
257 #if defined(OS_POSIX) 269 #if defined(OS_POSIX)
258 // SocketPair() creates a pair of socket FDs suitable for using with 270 // SocketPair() creates a pair of socket FDs suitable for using with
259 // IPC::Channel. 271 // IPC::Channel.
260 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); 272 IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
261 #endif 273 #endif
262 274
263 } // namespace IPC 275 } // namespace IPC
264 276
265 #endif // IPC_IPC_CHANNEL_H_ 277 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « ipc/attachment_broker_unprivileged.cc ('k') | ipc/ipc_channel_nacl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698