Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: ppapi/proxy/nacl_message_scanner.cc

Issue 1197853004: Revert of Revert of Make SharedMemoryHandle a class on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/nacl_message_scanner.h" 5 #include "ppapi/proxy/nacl_message_scanner.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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 it != file_systems_.end(); ++it) 286 it != file_systems_.end(); ++it)
287 delete it->second; 287 delete it->second;
288 for (FileIOMap::iterator it = files_.begin(); it != files_.end(); ++it) 288 for (FileIOMap::iterator it = files_.begin(); it != files_.end(); ++it)
289 delete it->second; 289 delete it->second;
290 } 290 }
291 291
292 // Windows IPC differs from POSIX in that native handles are serialized in the 292 // Windows IPC differs from POSIX in that native handles are serialized in the
293 // message body, rather than passed in a separate FileDescriptorSet. Therefore, 293 // message body, rather than passed in a separate FileDescriptorSet. Therefore,
294 // on Windows, any message containing handles must be rewritten in the POSIX 294 // on Windows, any message containing handles must be rewritten in the POSIX
295 // format before we can send it to the NaCl plugin. 295 // format before we can send it to the NaCl plugin.
296 // On Mac, base::SharedMemoryHandle has a different serialization than
297 // base::FileDescriptor (which base::SharedMemoryHandle is typedef-ed to in
298 // OS_NACL).
296 bool NaClMessageScanner::ScanMessage( 299 bool NaClMessageScanner::ScanMessage(
297 const IPC::Message& msg, 300 const IPC::Message& msg,
298 uint32_t type, 301 uint32_t type,
299 std::vector<SerializedHandle>* handles, 302 std::vector<SerializedHandle>* handles,
300 scoped_ptr<IPC::Message>* new_msg_ptr) { 303 scoped_ptr<IPC::Message>* new_msg_ptr) {
301 DCHECK(handles); 304 DCHECK(handles);
302 DCHECK(handles->empty()); 305 DCHECK(handles->empty());
303 DCHECK(new_msg_ptr); 306 DCHECK(new_msg_ptr);
304 DCHECK(!new_msg_ptr->get()); 307 DCHECK(!new_msg_ptr->get());
305 308
306 bool rewrite_msg = 309 bool rewrite_msg =
307 #if defined(OS_WIN) 310 #if defined(OS_WIN) || defined(OS_MACOSX)
308 true; 311 true;
309 #else 312 #else
310 false; 313 false;
311 #endif 314 #endif
312 315
313 // We can't always tell from the message ID if rewriting is needed. Therefore, 316 // We can't always tell from the message ID if rewriting is needed. Therefore,
314 // scan any message types that might contain a handle. If we later determine 317 // scan any message types that might contain a handle. If we later determine
315 // that there are no handles, we can cancel the rewriting by clearing the 318 // that there are no handles, we can cancel the rewriting by clearing the
316 // results.new_msg pointer. 319 // results.new_msg pointer.
317 ScanningResults results; 320 ScanningResults results;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 fio_it->second->SetMaxWrittenOffset(offset_it->second); 518 fio_it->second->SetMaxWrittenOffset(offset_it->second);
516 } 519 }
517 } 520 }
518 break; 521 break;
519 } 522 }
520 } 523 }
521 } 524 }
522 525
523 } // namespace proxy 526 } // namespace proxy
524 } // namespace ppapi 527 } // namespace ppapi
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698