| 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 16 matching lines...) Expand all Loading... |
| 27 class FileDescriptorSet; | 27 class FileDescriptorSet; |
| 28 | 28 |
| 29 namespace IPC { | 29 namespace IPC { |
| 30 | 30 |
| 31 //------------------------------------------------------------------------------ | 31 //------------------------------------------------------------------------------ |
| 32 | 32 |
| 33 struct LogData; | 33 struct LogData; |
| 34 | 34 |
| 35 class IPC_EXPORT Message : public Pickle { | 35 class IPC_EXPORT Message : public Pickle { |
| 36 public: | 36 public: |
| 37 enum PriorityValue { |
| 38 PRIORITY_LOW = 1, |
| 39 PRIORITY_NORMAL, |
| 40 PRIORITY_HIGH |
| 41 }; |
| 42 |
| 37 // Bit values used in the flags field. | 43 // Bit values used in the flags field. |
| 38 // Upper 24 bits of flags store a reference number, so this enum is limited to | 44 // Upper 24 bits of flags store a reference number, so this enum is limited to |
| 39 // 8 bits. | 45 // 8 bits. |
| 40 enum { | 46 enum { |
| 41 UNUSED = 0x03, // Low 2 bits are not used. | 47 PRIORITY_MASK = 0x03, // Low 2 bits of store the priority value. |
| 42 SYNC_BIT = 0x04, | 48 SYNC_BIT = 0x04, |
| 43 REPLY_BIT = 0x08, | 49 REPLY_BIT = 0x08, |
| 44 REPLY_ERROR_BIT = 0x10, | 50 REPLY_ERROR_BIT = 0x10, |
| 45 UNBLOCK_BIT = 0x20, | 51 UNBLOCK_BIT = 0x20, |
| 46 PUMPING_MSGS_BIT = 0x40, | 52 PUMPING_MSGS_BIT = 0x40, |
| 47 HAS_SENT_TIME_BIT = 0x80, | 53 HAS_SENT_TIME_BIT = 0x80, |
| 48 }; | 54 }; |
| 49 | 55 |
| 50 virtual ~Message(); | 56 virtual ~Message(); |
| 51 | 57 |
| 52 Message(); | 58 Message(); |
| 53 | 59 |
| 54 // Initialize a message with routing ID and a user-defined type. | 60 // Initialize a message with a user-defined type, priority value, and |
| 55 Message(int32 routing_id, uint32 type); | 61 // destination WebView ID. |
| 62 Message(int32 routing_id, uint32 type, PriorityValue priority); |
| 56 | 63 |
| 57 // Initializes a message from a const block of data. The data is not copied; | 64 // Initializes a message from a const block of data. The data is not copied; |
| 58 // instead the data is merely referenced by this message. Only const methods | 65 // instead the data is merely referenced by this message. Only const methods |
| 59 // should be used on the message when initialized this way. | 66 // should be used on the message when initialized this way. |
| 60 Message(const char* data, size_t data_len); | 67 Message(const char* data, int data_len); |
| 61 | 68 |
| 62 Message(const Message& other); | 69 Message(const Message& other); |
| 63 Message& operator=(const Message& other); | 70 Message& operator=(const Message& other); |
| 64 | 71 |
| 72 PriorityValue priority() const { |
| 73 return static_cast<PriorityValue>(header()->flags & PRIORITY_MASK); |
| 74 } |
| 75 |
| 65 // True if this is a synchronous message. | 76 // True if this is a synchronous message. |
| 66 void set_sync() { | 77 void set_sync() { |
| 67 header()->flags |= SYNC_BIT; | 78 header()->flags |= SYNC_BIT; |
| 68 } | 79 } |
| 69 bool is_sync() const { | 80 bool is_sync() const { |
| 70 return (header()->flags & SYNC_BIT) != 0; | 81 return (header()->flags & SYNC_BIT) != 0; |
| 71 } | 82 } |
| 72 | 83 |
| 73 // Set this on a reply to a synchronous message. | 84 // Set this on a reply to a synchronous message. |
| 74 void set_reply() { | 85 void set_reply() { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 MSG_ROUTING_NONE = -2, | 284 MSG_ROUTING_NONE = -2, |
| 274 | 285 |
| 275 // indicates a general message not sent to a particular tab. | 286 // indicates a general message not sent to a particular tab. |
| 276 MSG_ROUTING_CONTROL = kint32max, | 287 MSG_ROUTING_CONTROL = kint32max, |
| 277 }; | 288 }; |
| 278 | 289 |
| 279 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 290 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
| 280 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 291 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
| 281 | 292 |
| 282 #endif // IPC_IPC_MESSAGE_H_ | 293 #endif // IPC_IPC_MESSAGE_H_ |
| OLD | NEW |