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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 header.message_id = GetMessageId(*msg); | 106 header.message_id = GetMessageId(*msg); |
107 WriteSyncHeader(reply, header); | 107 WriteSyncHeader(reply, header); |
108 | 108 |
109 return reply; | 109 return reply; |
110 } | 110 } |
111 | 111 |
112 bool SyncMessage::ReadSyncHeader(const Message& msg, SyncHeader* header) { | 112 bool SyncMessage::ReadSyncHeader(const Message& msg, SyncHeader* header) { |
113 DCHECK(msg.is_sync() || msg.is_reply()); | 113 DCHECK(msg.is_sync() || msg.is_reply()); |
114 | 114 |
115 PickleIterator iter(msg); | 115 PickleIterator iter(msg); |
116 bool result = msg.ReadInt(&iter, &header->message_id); | 116 bool result = iter.ReadInt(&header->message_id); |
117 if (!result) { | 117 if (!result) { |
118 NOTREACHED(); | 118 NOTREACHED(); |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 bool SyncMessage::WriteSyncHeader(Message* msg, const SyncHeader& header) { | 125 bool SyncMessage::WriteSyncHeader(Message* msg, const SyncHeader& header) { |
126 DCHECK(msg->is_sync() || msg->is_reply()); | 126 DCHECK(msg->is_sync() || msg->is_reply()); |
127 DCHECK(msg->payload_size() == 0); | 127 DCHECK(msg->payload_size() == 0); |
128 bool result = msg->WriteInt(header.message_id); | 128 bool result = msg->WriteInt(header.message_id); |
129 if (!result) { | 129 if (!result) { |
130 NOTREACHED(); | 130 NOTREACHED(); |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 // Note: if you add anything here, you need to update kSyncMessageHeaderSize. | 134 // Note: if you add anything here, you need to update kSyncMessageHeaderSize. |
135 DCHECK(kSyncMessageHeaderSize == msg->payload_size()); | 135 DCHECK(kSyncMessageHeaderSize == msg->payload_size()); |
136 | 136 |
137 return true; | 137 return true; |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { | 141 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { |
142 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); | 142 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); |
143 } | 143 } |
144 | 144 |
145 } // namespace IPC | 145 } // namespace IPC |
OLD | NEW |