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 |
566 break; | 572 break; |
567 } | 573 } |
568 } | 574 } |
569 | 575 |
570 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, | 576 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, |
571 base::PickleIterator* iter, | 577 base::PickleIterator* iter, |
572 param_type* r) { | 578 param_type* r) { |
573 base::SharedMemoryHandle::TypeWireFormat type; | 579 base::SharedMemoryHandle::TypeWireFormat type; |
574 if (!iter->ReadInt(&type)) | 580 if (!iter->ReadInt(&type)) |
575 return false; | 581 return false; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 return result; | 1039 return result; |
1034 } | 1040 } |
1035 | 1041 |
1036 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1042 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1037 l->append("<MSG>"); | 1043 l->append("<MSG>"); |
1038 } | 1044 } |
1039 | 1045 |
1040 #endif // OS_WIN | 1046 #endif // OS_WIN |
1041 | 1047 |
1042 } // namespace IPC | 1048 } // namespace IPC |
OLD | NEW |