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