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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 #elif defined(OS_WIN) | 660 #elif defined(OS_WIN) |
661 void ParamTraits<base::SharedMemoryHandle>::Write(Message* m, | 661 void ParamTraits<base::SharedMemoryHandle>::Write(Message* m, |
662 const param_type& p) { | 662 const param_type& p) { |
663 m->WriteBool(p.NeedsBrokering()); | 663 m->WriteBool(p.NeedsBrokering()); |
664 | 664 |
665 if (p.NeedsBrokering()) { | 665 if (p.NeedsBrokering()) { |
666 HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); | 666 HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); |
667 ParamTraits<HandleWin>::Write(m, handle_win); | 667 ParamTraits<HandleWin>::Write(m, handle_win); |
| 668 |
| 669 // If the caller intended to pass ownership to the IPC stack, release a |
| 670 // reference. |
| 671 if (p.OwnershipPassesToIPC()) |
| 672 p.Close(); |
668 } else { | 673 } else { |
669 m->WriteInt(HandleToLong(p.GetHandle())); | 674 m->WriteInt(HandleToLong(p.GetHandle())); |
670 } | 675 } |
671 } | 676 } |
672 | 677 |
673 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, | 678 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m, |
674 base::PickleIterator* iter, | 679 base::PickleIterator* iter, |
675 param_type* r) { | 680 param_type* r) { |
676 bool needs_brokering; | 681 bool needs_brokering; |
677 if (!iter->ReadBool(&needs_brokering)) | 682 if (!iter->ReadBool(&needs_brokering)) |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 return result; | 1038 return result; |
1034 } | 1039 } |
1035 | 1040 |
1036 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1041 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1037 l->append("<MSG>"); | 1042 l->append("<MSG>"); |
1038 } | 1043 } |
1039 | 1044 |
1040 #endif // OS_WIN | 1045 #endif // OS_WIN |
1041 | 1046 |
1042 } // namespace IPC | 1047 } // namespace IPC |
OLD | NEW |