OLD | NEW |
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/files/file.h" |
13 #include "base/pickle.h" | 13 #include "base/pickle.h" |
14 #include "ipc/ipc_export.h" | 14 #include "ipc/ipc_export.h" |
15 | 15 |
16 #if !defined(NDEBUG) | 16 #if !defined(NDEBUG) |
17 #define IPC_MESSAGE_LOG_ENABLED | 17 #define IPC_MESSAGE_LOG_ENABLED |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(OS_POSIX) | 20 #if defined(OS_POSIX) |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #endif | 22 #endif |
23 | 23 |
24 class FileDescriptorSet; | |
25 | |
26 namespace IPC { | 24 namespace IPC { |
27 | 25 |
28 //------------------------------------------------------------------------------ | 26 //------------------------------------------------------------------------------ |
29 | 27 |
30 struct LogData; | 28 struct LogData; |
| 29 class MessageAttachmentSet; |
31 | 30 |
32 class IPC_EXPORT Message : public Pickle { | 31 class IPC_EXPORT Message : public Pickle { |
33 public: | 32 public: |
34 enum PriorityValue { | 33 enum PriorityValue { |
35 PRIORITY_LOW = 1, | 34 PRIORITY_LOW = 1, |
36 PRIORITY_NORMAL, | 35 PRIORITY_NORMAL, |
37 PRIORITY_HIGH | 36 PRIORITY_HIGH |
38 }; | 37 }; |
39 | 38 |
40 // Bit values used in the flags field. | 39 // Bit values used in the flags field. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 242 } |
244 const Header* header() const { | 243 const Header* header() const { |
245 return headerT<Header>(); | 244 return headerT<Header>(); |
246 } | 245 } |
247 | 246 |
248 void Init(); | 247 void Init(); |
249 | 248 |
250 // Used internally to support IPC::Listener::OnBadMessageReceived. | 249 // Used internally to support IPC::Listener::OnBadMessageReceived. |
251 mutable bool dispatch_error_; | 250 mutable bool dispatch_error_; |
252 | 251 |
253 #if defined(OS_POSIX) | |
254 // The set of file descriptors associated with this message. | 252 // The set of file descriptors associated with this message. |
255 scoped_refptr<FileDescriptorSet> file_descriptor_set_; | 253 scoped_refptr<MessageAttachmentSet> attachment_set_; |
256 | 254 |
257 // Ensure that a FileDescriptorSet is allocated | 255 // Ensure that a MessageAttachmentSet is allocated |
258 void EnsureFileDescriptorSet(); | 256 void EnsureMessageAttachmentSet(); |
259 | 257 |
260 FileDescriptorSet* file_descriptor_set() { | 258 MessageAttachmentSet* attachment_set() { |
261 EnsureFileDescriptorSet(); | 259 EnsureMessageAttachmentSet(); |
262 return file_descriptor_set_.get(); | 260 return attachment_set_.get(); |
263 } | 261 } |
264 const FileDescriptorSet* file_descriptor_set() const { | 262 const MessageAttachmentSet* attachment_set() const { |
265 return file_descriptor_set_.get(); | 263 return attachment_set_.get(); |
266 } | 264 } |
267 #endif | |
268 | 265 |
269 #ifdef IPC_MESSAGE_LOG_ENABLED | 266 #ifdef IPC_MESSAGE_LOG_ENABLED |
270 // Used for logging. | 267 // Used for logging. |
271 mutable int64 received_time_; | 268 mutable int64 received_time_; |
272 mutable std::string output_params_; | 269 mutable std::string output_params_; |
273 mutable LogData* log_data_; | 270 mutable LogData* log_data_; |
274 mutable bool dont_log_; | 271 mutable bool dont_log_; |
275 #endif | 272 #endif |
276 }; | 273 }; |
277 | 274 |
278 //------------------------------------------------------------------------------ | 275 //------------------------------------------------------------------------------ |
279 | 276 |
280 } // namespace IPC | 277 } // namespace IPC |
281 | 278 |
282 enum SpecialRoutingIDs { | 279 enum SpecialRoutingIDs { |
283 // indicates that we don't have a routing ID yet. | 280 // indicates that we don't have a routing ID yet. |
284 MSG_ROUTING_NONE = -2, | 281 MSG_ROUTING_NONE = -2, |
285 | 282 |
286 // indicates a general message not sent to a particular tab. | 283 // indicates a general message not sent to a particular tab. |
287 MSG_ROUTING_CONTROL = kint32max, | 284 MSG_ROUTING_CONTROL = kint32max, |
288 }; | 285 }; |
289 | 286 |
290 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 287 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
291 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 288 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
292 | 289 |
293 #endif // IPC_IPC_MESSAGE_H_ | 290 #endif // IPC_IPC_MESSAGE_H_ |
OLD | NEW |