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" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // writes it to |*attachment|. It returns true on success. | 177 // writes it to |*attachment|. It returns true on success. |
178 bool ReadAttachment(base::PickleIterator* iter, | 178 bool ReadAttachment(base::PickleIterator* iter, |
179 scoped_refptr<MessageAttachment>* attachment) const; | 179 scoped_refptr<MessageAttachment>* attachment) const; |
180 // Returns true if there are any attachment in this message. | 180 // Returns true if there are any attachment in this message. |
181 bool HasAttachments() const; | 181 bool HasAttachments() const; |
182 // Returns true if there are any MojoHandleAttachments in this message. | 182 // Returns true if there are any MojoHandleAttachments in this message. |
183 bool HasMojoHandles() const; | 183 bool HasMojoHandles() const; |
184 // Whether the message has any brokerable attachments. | 184 // Whether the message has any brokerable attachments. |
185 bool HasBrokerableAttachments() const; | 185 bool HasBrokerableAttachments() const; |
186 | 186 |
| 187 void set_sender_pid(base::ProcessId id) { sender_pid_ = id; } |
| 188 base::ProcessId get_sender_pid() const { return sender_pid_; } |
| 189 |
187 #ifdef IPC_MESSAGE_LOG_ENABLED | 190 #ifdef IPC_MESSAGE_LOG_ENABLED |
188 // Adds the outgoing time from Time::Now() at the end of the message and sets | 191 // Adds the outgoing time from Time::Now() at the end of the message and sets |
189 // a bit to indicate that it's been added. | 192 // a bit to indicate that it's been added. |
190 void set_sent_time(int64 time); | 193 void set_sent_time(int64 time); |
191 int64 sent_time() const; | 194 int64 sent_time() const; |
192 | 195 |
193 void set_received_time(int64 time) const; | 196 void set_received_time(int64 time) const; |
194 int64 received_time() const { return received_time_; } | 197 int64 received_time() const { return received_time_; } |
195 void set_output_params(const std::string& op) const { output_params_ = op; } | 198 void set_output_params(const std::string& op) const { output_params_ = op; } |
196 const std::string& output_params() const { return output_params_; } | 199 const std::string& output_params() const { return output_params_; } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 void EnsureMessageAttachmentSet(); | 259 void EnsureMessageAttachmentSet(); |
257 | 260 |
258 MessageAttachmentSet* attachment_set() { | 261 MessageAttachmentSet* attachment_set() { |
259 EnsureMessageAttachmentSet(); | 262 EnsureMessageAttachmentSet(); |
260 return attachment_set_.get(); | 263 return attachment_set_.get(); |
261 } | 264 } |
262 const MessageAttachmentSet* attachment_set() const { | 265 const MessageAttachmentSet* attachment_set() const { |
263 return attachment_set_.get(); | 266 return attachment_set_.get(); |
264 } | 267 } |
265 | 268 |
| 269 // The process id of the sender of the message. This member is populated with |
| 270 // a valid value for every message dispatched to listeners. |
| 271 base::ProcessId sender_pid_; |
| 272 |
266 #ifdef IPC_MESSAGE_LOG_ENABLED | 273 #ifdef IPC_MESSAGE_LOG_ENABLED |
267 // Used for logging. | 274 // Used for logging. |
268 mutable int64 received_time_; | 275 mutable int64 received_time_; |
269 mutable std::string output_params_; | 276 mutable std::string output_params_; |
270 mutable LogData* log_data_; | 277 mutable LogData* log_data_; |
271 mutable bool dont_log_; | 278 mutable bool dont_log_; |
272 #endif | 279 #endif |
273 }; | 280 }; |
274 | 281 |
275 //------------------------------------------------------------------------------ | 282 //------------------------------------------------------------------------------ |
276 | 283 |
277 } // namespace IPC | 284 } // namespace IPC |
278 | 285 |
279 enum SpecialRoutingIDs { | 286 enum SpecialRoutingIDs { |
280 // indicates that we don't have a routing ID yet. | 287 // indicates that we don't have a routing ID yet. |
281 MSG_ROUTING_NONE = -2, | 288 MSG_ROUTING_NONE = -2, |
282 | 289 |
283 // indicates a general message not sent to a particular tab. | 290 // indicates a general message not sent to a particular tab. |
284 MSG_ROUTING_CONTROL = kint32max, | 291 MSG_ROUTING_CONTROL = kint32max, |
285 }; | 292 }; |
286 | 293 |
287 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 294 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
288 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 295 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
289 | 296 |
290 #endif // IPC_IPC_MESSAGE_H_ | 297 #endif // IPC_IPC_MESSAGE_H_ |
OLD | NEW |