| 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/pickle.h" | 12 #include "base/pickle.h" |
| 12 #include "ipc/ipc_export.h" | 13 #include "ipc/ipc_export.h" |
| 13 | 14 |
| 14 // TODO(brettw) remove this and update files that depend on this being included | 15 // TODO(brettw) remove this and update files that depend on this being included |
| 15 // from here. | 16 // from here. |
| 16 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
| 17 | 18 |
| 18 // Ipc logging adds a dependency from the 'chrome' target on all ipc message | 19 // Ipc logging adds a dependency from the 'chrome' target on all ipc message |
| 19 // classes. In a component build, this would require exporting all message | 20 // classes. In a component build, this would require exporting all message |
| 20 // classes, so don't support ipc logging in the components build. | 21 // classes, so don't support ipc logging in the components build. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 | 43 |
| 43 class IPC_EXPORT Message : public Pickle { | 44 class IPC_EXPORT Message : public Pickle { |
| 44 public: | 45 public: |
| 45 enum PriorityValue { | 46 enum PriorityValue { |
| 46 PRIORITY_LOW = 1, | 47 PRIORITY_LOW = 1, |
| 47 PRIORITY_NORMAL, | 48 PRIORITY_NORMAL, |
| 48 PRIORITY_HIGH | 49 PRIORITY_HIGH |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 // Bit values used in the flags field. | 52 // Bit values used in the flags field. |
| 53 // Upper 24 bits of flags store a reference number, so this enum is limited to |
| 54 // 8 bits. |
| 52 enum { | 55 enum { |
| 53 PRIORITY_MASK = 0x0003, // Low 2 bits of store the priority value. | 56 PRIORITY_MASK = 0x03, // Low 2 bits of store the priority value. |
| 54 SYNC_BIT = 0x0004, | 57 SYNC_BIT = 0x04, |
| 55 REPLY_BIT = 0x0008, | 58 REPLY_BIT = 0x08, |
| 56 REPLY_ERROR_BIT = 0x0010, | 59 REPLY_ERROR_BIT = 0x10, |
| 57 UNBLOCK_BIT = 0x0020, | 60 UNBLOCK_BIT = 0x20, |
| 58 PUMPING_MSGS_BIT = 0x0040, | 61 PUMPING_MSGS_BIT = 0x40, |
| 59 HAS_SENT_TIME_BIT = 0x0080, | 62 HAS_SENT_TIME_BIT = 0x80, |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 virtual ~Message(); | 65 virtual ~Message(); |
| 63 | 66 |
| 64 Message(); | 67 Message(); |
| 65 | 68 |
| 66 // Initialize a message with a user-defined type, priority value, and | 69 // Initialize a message with a user-defined type, priority value, and |
| 67 // destination WebView ID. | 70 // destination WebView ID. |
| 68 Message(int32 routing_id, uint32 type, PriorityValue priority); | 71 Message(int32 routing_id, uint32 type, PriorityValue priority); |
| 69 | 72 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // The following four functions are needed so we can log sync messages with | 217 // The following four functions are needed so we can log sync messages with |
| 215 // delayed replies. We stick the log data from the sent message into the | 218 // delayed replies. We stick the log data from the sent message into the |
| 216 // reply message, so that when it's sent and we have the output parameters | 219 // reply message, so that when it's sent and we have the output parameters |
| 217 // we can log it. As such, we set a flag on the sent message to not log it. | 220 // we can log it. As such, we set a flag on the sent message to not log it. |
| 218 void set_sync_log_data(LogData* data) const { log_data_ = data; } | 221 void set_sync_log_data(LogData* data) const { log_data_ = data; } |
| 219 LogData* sync_log_data() const { return log_data_; } | 222 LogData* sync_log_data() const { return log_data_; } |
| 220 void set_dont_log() const { dont_log_ = true; } | 223 void set_dont_log() const { dont_log_ = true; } |
| 221 bool dont_log() const { return dont_log_; } | 224 bool dont_log() const { return dont_log_; } |
| 222 #endif | 225 #endif |
| 223 | 226 |
| 227 // Called at various points between send and receive to track message. |
| 228 void TraceMessageStep() { |
| 229 TRACE_EVENT_ASYNC_BEGIN_STEP0("ipc", "IPC", header()->flags, NULL); |
| 230 } |
| 231 |
| 224 protected: | 232 protected: |
| 225 friend class Channel; | 233 friend class Channel; |
| 226 friend class MessageReplyDeserializer; | 234 friend class MessageReplyDeserializer; |
| 227 friend class SyncMessage; | 235 friend class SyncMessage; |
| 228 | 236 |
| 229 #pragma pack(push, 4) | 237 #pragma pack(push, 4) |
| 230 struct Header : Pickle::Header { | 238 struct Header : Pickle::Header { |
| 231 int32 routing; // ID of the view that this message is destined for | 239 int32 routing; // ID of the view that this message is destined for |
| 232 uint32 type; // specifies the user-defined message type | 240 uint32 type; // specifies the user-defined message type |
| 233 uint32 flags; // specifies control flags for the message | 241 uint32 flags; // specifies control flags for the message |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 MSG_ROUTING_NONE = -2, | 289 MSG_ROUTING_NONE = -2, |
| 282 | 290 |
| 283 // indicates a general message not sent to a particular tab. | 291 // indicates a general message not sent to a particular tab. |
| 284 MSG_ROUTING_CONTROL = kint32max, | 292 MSG_ROUTING_CONTROL = kint32max, |
| 285 }; | 293 }; |
| 286 | 294 |
| 287 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 295 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
| 288 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 296 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
| 289 | 297 |
| 290 #endif // IPC_IPC_MESSAGE_H_ | 298 #endif // IPC_IPC_MESSAGE_H_ |
| OLD | NEW |