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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/nullable_string16.h" | 10 #include "base/strings/nullable_string16.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 case base::SharedMemoryHandle::POSIX: | 556 case base::SharedMemoryHandle::POSIX: |
557 ParamTraits<base::FileDescriptor>::Write(m, p.GetFileDescriptor()); | 557 ParamTraits<base::FileDescriptor>::Write(m, p.GetFileDescriptor()); |
558 break; | 558 break; |
559 case base::SharedMemoryHandle::MACH: | 559 case base::SharedMemoryHandle::MACH: |
560 MachPortMac mach_port_mac(p.GetMemoryObject()); | 560 MachPortMac mach_port_mac(p.GetMemoryObject()); |
561 ParamTraits<MachPortMac>::Write(m, mach_port_mac); | 561 ParamTraits<MachPortMac>::Write(m, mach_port_mac); |
562 size_t size = 0; | 562 size_t size = 0; |
563 bool result = p.GetSize(&size); | 563 bool result = p.GetSize(&size); |
564 DCHECK(result); | 564 DCHECK(result); |
565 ParamTraits<size_t>::Write(m, size); | 565 ParamTraits<size_t>::Write(m, size); |
566 | |
567 // If the caller intended to pass ownership to the IPC stack, release a | |
568 // reference. | |
569 if (p.OwnershipPassesToIPC()) | |
570 p.Close(); | |
571 | |
572 break; | 566 break; |
573 } | 567 } |
574 } | 568 } |
575 | 569 |
576 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, | 570 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, |
577 base::PickleIterator* iter, | 571 base::PickleIterator* iter, |
578 param_type* r) { | 572 param_type* r) { |
579 base::SharedMemoryHandle::TypeWireFormat type; | 573 base::SharedMemoryHandle::TypeWireFormat type; |
580 if (!iter->ReadInt(&type)) | 574 if (!iter->ReadInt(&type)) |
581 return false; | 575 return false; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 return result; | 1033 return result; |
1040 } | 1034 } |
1041 | 1035 |
1042 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1036 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1043 l->append("<MSG>"); | 1037 l->append("<MSG>"); |
1044 } | 1038 } |
1045 | 1039 |
1046 #endif // OS_WIN | 1040 #endif // OS_WIN |
1047 | 1041 |
1048 } // namespace IPC | 1042 } // namespace IPC |
OLD | NEW |