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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 void ParamTraits<base::SharedMemoryHandle>::Write(base::Pickle* m, | 771 void ParamTraits<base::SharedMemoryHandle>::Write(base::Pickle* m, |
772 const param_type& p) { | 772 const param_type& p) { |
773 m->WriteBool(p.NeedsBrokering()); | 773 m->WriteBool(p.NeedsBrokering()); |
774 | 774 |
775 if (p.NeedsBrokering()) { | 775 if (p.NeedsBrokering()) { |
776 HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); | 776 HandleWin handle_win(p.GetHandle(), HandleWin::DUPLICATE); |
777 ParamTraits<HandleWin>::Write(m, handle_win); | 777 ParamTraits<HandleWin>::Write(m, handle_win); |
778 | 778 |
779 // If the caller intended to pass ownership to the IPC stack, release a | 779 // If the caller intended to pass ownership to the IPC stack, release a |
780 // reference. | 780 // reference. |
781 if (p.OwnershipPassesToIPC()) | 781 if (p.OwnershipPassesToIPC() && p.BelongsToCurrentProcess()) |
782 p.Close(); | 782 p.Close(); |
783 } else { | 783 } else { |
784 m->WriteInt(HandleToLong(p.GetHandle())); | 784 m->WriteInt(HandleToLong(p.GetHandle())); |
785 } | 785 } |
786 } | 786 } |
787 | 787 |
788 bool ParamTraits<base::SharedMemoryHandle>::Read(const base::Pickle* m, | 788 bool ParamTraits<base::SharedMemoryHandle>::Read(const base::Pickle* m, |
789 base::PickleIterator* iter, | 789 base::PickleIterator* iter, |
790 param_type* r) { | 790 param_type* r) { |
791 bool needs_brokering; | 791 bool needs_brokering; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 return result; | 1216 return result; |
1217 } | 1217 } |
1218 | 1218 |
1219 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1219 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1220 l->append("<MSG>"); | 1220 l->append("<MSG>"); |
1221 } | 1221 } |
1222 | 1222 |
1223 #endif // OS_WIN | 1223 #endif // OS_WIN |
1224 | 1224 |
1225 } // namespace IPC | 1225 } // namespace IPC |
OLD | NEW |