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