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

Side by Side Diff: ipc/ipc_message.h

Issue 583473002: IPC: Get rid of FileDescriptor usage from FileDescriptorSet and Message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_message.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_MESSAGE_H_ 5 #ifndef IPC_IPC_MESSAGE_H_
6 #define IPC_IPC_MESSAGE_H_ 6 #define IPC_IPC_MESSAGE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/files/file.h"
12 #include "base/pickle.h" 13 #include "base/pickle.h"
13 #include "ipc/ipc_export.h" 14 #include "ipc/ipc_export.h"
14 15
15 #if !defined(NDEBUG) 16 #if !defined(NDEBUG)
16 #define IPC_MESSAGE_LOG_ENABLED 17 #define IPC_MESSAGE_LOG_ENABLED
17 #endif 18 #endif
18 19
19 #if defined(OS_POSIX) 20 #if defined(OS_POSIX)
20 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
21 #endif 22 #endif
22 23
23 namespace base {
24 struct FileDescriptor;
25 }
26
27 class FileDescriptorSet; 24 class FileDescriptorSet;
28 25
29 namespace IPC { 26 namespace IPC {
30 27
31 //------------------------------------------------------------------------------ 28 //------------------------------------------------------------------------------
32 29
33 struct LogData; 30 struct LogData;
34 31
35 class IPC_EXPORT Message : public Pickle { 32 class IPC_EXPORT Message : public Pickle {
36 public: 33 public:
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // if the entire message is not found in the given data range. 168 // if the entire message is not found in the given data range.
172 static const char* FindNext(const char* range_start, const char* range_end) { 169 static const char* FindNext(const char* range_start, const char* range_end) {
173 return Pickle::FindNext(sizeof(Header), range_start, range_end); 170 return Pickle::FindNext(sizeof(Header), range_start, range_end);
174 } 171 }
175 172
176 #if defined(OS_POSIX) 173 #if defined(OS_POSIX)
177 // On POSIX, a message supports reading / writing FileDescriptor objects. 174 // On POSIX, a message supports reading / writing FileDescriptor objects.
178 // This is used to pass a file descriptor to the peer of an IPC channel. 175 // This is used to pass a file descriptor to the peer of an IPC channel.
179 176
180 // Add a descriptor to the end of the set. Returns false if the set is full. 177 // Add a descriptor to the end of the set. Returns false if the set is full.
181 bool WriteFileDescriptor(const base::FileDescriptor& descriptor); 178 bool WriteFile(base::ScopedFD descriptor);
179 bool WriteBorrowingFile(const base::PlatformFile& descriptor);
182 180
183 // Get a file descriptor from the message. Returns false on error. 181 // Get a file descriptor from the message. Returns false on error.
184 // iter: a Pickle iterator to the current location in the message. 182 // iter: a Pickle iterator to the current location in the message.
185 bool ReadFileDescriptor(PickleIterator* iter, 183 bool ReadFile(PickleIterator* iter, base::ScopedFD* file) const;
186 base::FileDescriptor* descriptor) const;
187 184
188 // Returns true if there are any file descriptors in this message. 185 // Returns true if there are any file descriptors in this message.
189 bool HasFileDescriptors() const; 186 bool HasFileDescriptors() const;
190 #endif 187 #endif
191 188
192 #ifdef IPC_MESSAGE_LOG_ENABLED 189 #ifdef IPC_MESSAGE_LOG_ENABLED
193 // Adds the outgoing time from Time::Now() at the end of the message and sets 190 // Adds the outgoing time from Time::Now() at the end of the message and sets
194 // a bit to indicate that it's been added. 191 // a bit to indicate that it's been added.
195 void set_sent_time(int64 time); 192 void set_sent_time(int64 time);
196 int64 sent_time() const; 193 int64 sent_time() const;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 MSG_ROUTING_NONE = -2, 284 MSG_ROUTING_NONE = -2,
288 285
289 // indicates a general message not sent to a particular tab. 286 // indicates a general message not sent to a particular tab.
290 MSG_ROUTING_CONTROL = kint32max, 287 MSG_ROUTING_CONTROL = kint32max,
291 }; 288 };
292 289
293 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies 290 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies
294 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging 291 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging
295 292
296 #endif // IPC_IPC_MESSAGE_H_ 293 #endif // IPC_IPC_MESSAGE_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698