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

Side by Side Diff: ipc/ipc_channel.h

Issue 1309003003: ipc: Add the inner class OutputElement to Channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_add_header3
Patch Set: Rebase to fix compile errors. Created 5 years, 3 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.cc » ('j') | ipc/ipc_channel.cc » ('J')
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 static void SetGlobalPid(int pid); 233 static void SetGlobalPid(int pid);
234 #endif 234 #endif
235 235
236 #if defined(OS_ANDROID) 236 #if defined(OS_ANDROID)
237 // Most tests are single process and work the same on all platforms. However 237 // Most tests are single process and work the same on all platforms. However
238 // in some cases we want to test multi-process, and Android differs in that it 238 // in some cases we want to test multi-process, and Android differs in that it
239 // can't 'exec' after forking. This callback resets any data in the forked 239 // can't 'exec' after forking. This callback resets any data in the forked
240 // process such that it acts similar to if it was exec'd, for tests. 240 // process such that it acts similar to if it was exec'd, for tests.
241 static void NotifyProcessForkedForTesting(); 241 static void NotifyProcessForkedForTesting();
242 #endif 242 #endif
243
244 protected:
245 // An OutputElement is a wrapper around a Message or raw buffer while it is
246 // waiting to be passed to the system's underlying IPC mechanism.
247 class OutputElement {
248 public:
249 // Takes ownership of message.
250 OutputElement(Message* message);
251 // Takes ownership of the buffer.
Tom Sepez 2015/09/10 15:41:05 add note: buffer is free via system free, must be
erikchen 2015/09/10 18:43:59 Done.
252 OutputElement(void* buffer, size_t length);
253 ~OutputElement();
254 size_t size() const;
255 const void* data() const;
256 const Message* get_message() const { return message_.get(); }
257
258 private:
259 scoped_ptr<const Message> message_;
260 void* buffer_;
261 size_t length_;
262 };
243 }; 263 };
244 264
245 #if defined(OS_POSIX) 265 #if defined(OS_POSIX)
246 // SocketPair() creates a pair of socket FDs suitable for using with 266 // SocketPair() creates a pair of socket FDs suitable for using with
247 // IPC::Channel. 267 // IPC::Channel.
248 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); 268 IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
249 #endif 269 #endif
250 270
251 } // namespace IPC 271 } // namespace IPC
252 272
253 #endif // IPC_IPC_CHANNEL_H_ 273 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel.cc » ('j') | ipc/ipc_channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698