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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 #include <stack> | 10 #include <stack> |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace IPC { | 35 namespace IPC { |
36 | 36 |
37 #define kSyncMessageHeaderSize 4 | 37 #define kSyncMessageHeaderSize 4 |
38 | 38 |
39 SyncMessage::SyncMessage( | 39 SyncMessage::SyncMessage( |
40 int32 routing_id, | 40 int32 routing_id, |
41 uint32 type, | 41 uint32 type, |
| 42 PriorityValue priority, |
42 MessageReplyDeserializer* deserializer) | 43 MessageReplyDeserializer* deserializer) |
43 : Message(routing_id, type), | 44 : Message(routing_id, type, priority), |
44 deserializer_(deserializer), | 45 deserializer_(deserializer), |
45 pump_messages_event_(NULL) | 46 pump_messages_event_(NULL) |
46 { | 47 { |
47 set_sync(); | 48 set_sync(); |
48 set_unblock(true); | 49 set_unblock(true); |
49 | 50 |
50 // Add synchronous message data before the message payload. | 51 // Add synchronous message data before the message payload. |
51 SyncHeader header; | 52 SyncHeader header; |
52 header.message_id = g_next_id.GetNext(); | 53 header.message_id = g_next_id.GetNext(); |
53 WriteSyncHeader(this, header); | 54 WriteSyncHeader(this, header); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SyncHeader header; | 89 SyncHeader header; |
89 if (!ReadSyncHeader(msg, &header)) | 90 if (!ReadSyncHeader(msg, &header)) |
90 return 0; | 91 return 0; |
91 | 92 |
92 return header.message_id; | 93 return header.message_id; |
93 } | 94 } |
94 | 95 |
95 Message* SyncMessage::GenerateReply(const Message* msg) { | 96 Message* SyncMessage::GenerateReply(const Message* msg) { |
96 DCHECK(msg->is_sync()); | 97 DCHECK(msg->is_sync()); |
97 | 98 |
98 Message* reply = new Message(msg->routing_id(), IPC_REPLY_ID); | 99 Message* reply = new Message(msg->routing_id(), IPC_REPLY_ID, |
| 100 msg->priority()); |
99 reply->set_reply(); | 101 reply->set_reply(); |
100 | 102 |
101 SyncHeader header; | 103 SyncHeader header; |
102 | 104 |
103 // use the same message id, but this time reply bit is set | 105 // use the same message id, but this time reply bit is set |
104 header.message_id = GetMessageId(*msg); | 106 header.message_id = GetMessageId(*msg); |
105 WriteSyncHeader(reply, header); | 107 WriteSyncHeader(reply, header); |
106 | 108 |
107 return reply; | 109 return reply; |
108 } | 110 } |
(...skipping 25 matching lines...) Expand all Loading... |
134 | 136 |
135 return true; | 137 return true; |
136 } | 138 } |
137 | 139 |
138 | 140 |
139 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { | 141 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { |
140 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); | 142 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); |
141 } | 143 } |
142 | 144 |
143 } // namespace IPC | 145 } // namespace IPC |
OLD | NEW |