OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ppapi/proxy/handle_converter.h" | 5 #include "ppapi/proxy/handle_converter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // | 220 // |
221 // In POSIX, we only serialize an index in to a FileDescriptorSet, and the | 221 // In POSIX, we only serialize an index in to a FileDescriptorSet, and the |
222 // actual file descriptors are sent out-of-band. So on Windows, to make a | 222 // actual file descriptors are sent out-of-band. So on Windows, to make a |
223 // message that's compatible with Windows, we need to write a new message that | 223 // message that's compatible with Windows, we need to write a new message that |
224 // has simple indices in the message body instead of the HANDLEs. | 224 // has simple indices in the message body instead of the HANDLEs. |
225 // | 225 // |
226 // NOTE: This means on Windows, new_msg_ptr's serialized contents are not | 226 // NOTE: This means on Windows, new_msg_ptr's serialized contents are not |
227 // compatible with Windows IPC deserialization code; it is intended to be | 227 // compatible with Windows IPC deserialization code; it is intended to be |
228 // passed to NaCl. | 228 // passed to NaCl. |
229 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
230 new_msg_ptr->reset( | 230 new_msg_ptr->reset(new IPC::Message(msg.routing_id(), msg.type())); |
231 new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); | |
232 #else | 231 #else |
233 // Even on POSIX, we have to rewrite messages to create channels, because | 232 // Even on POSIX, we have to rewrite messages to create channels, because |
234 // these contain a handle with an invalid (place holder) descriptor. The | 233 // these contain a handle with an invalid (place holder) descriptor. The |
235 // message sending code sees this and doesn't pass the descriptor over | 234 // message sending code sees this and doesn't pass the descriptor over |
236 // correctly. | 235 // correctly. |
237 if (msg.type() == PpapiMsg_CreateNaClChannel::ID) { | 236 if (msg.type() == PpapiMsg_CreateNaClChannel::ID) |
238 new_msg_ptr->reset( | 237 new_msg_ptr->reset(new IPC::Message(msg.routing_id(), msg.type())); |
239 new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); | |
240 } | |
241 #endif | 238 #endif |
242 | 239 |
243 switch (msg.type()) { | 240 switch (msg.type()) { |
244 CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel) | 241 CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel) |
245 CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated) | 242 CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated) |
246 CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage) | 243 CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage) |
247 CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply) | 244 CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply) |
248 case IPC_REPLY_ID: { | 245 case IPC_REPLY_ID: { |
249 int id = IPC::SyncMessage::GetMessageId(msg); | 246 int id = IPC::SyncMessage::GetMessageId(msg); |
250 PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id)); | 247 PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id)); |
(...skipping 25 matching lines...) Expand all Loading... |
276 DCHECK(msg.is_sync()); | 273 DCHECK(msg.is_sync()); |
277 | 274 |
278 int msg_id = IPC::SyncMessage::GetMessageId(msg); | 275 int msg_id = IPC::SyncMessage::GetMessageId(msg); |
279 DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); | 276 DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end()); |
280 | 277 |
281 pending_sync_msgs_[msg_id] = msg.type(); | 278 pending_sync_msgs_[msg_id] = msg.type(); |
282 } | 279 } |
283 | 280 |
284 } // namespace proxy | 281 } // namespace proxy |
285 } // namespace ppapi | 282 } // namespace ppapi |
OLD | NEW |