| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mach_port_mac.h" | 5 #include "ipc/mach_port_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "ipc/mach_port_attachment_mac.h" | 10 #include "ipc/mach_port_attachment_mac.h" |
| 11 | 11 |
| 12 namespace IPC { | 12 namespace IPC { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 void ParamTraits<MachPortMac>::GetSize(base::PickleSizer* s, |
| 16 const param_type& p) { |
| 17 s->AddAttachment(); |
| 18 } |
| 19 |
| 20 // static |
| 15 void ParamTraits<MachPortMac>::Write(base::Pickle* m, const param_type& p) { | 21 void ParamTraits<MachPortMac>::Write(base::Pickle* m, const param_type& p) { |
| 16 if (!m->WriteAttachment( | 22 if (!m->WriteAttachment( |
| 17 new IPC::internal::MachPortAttachmentMac(p.get_mach_port()))) { | 23 new IPC::internal::MachPortAttachmentMac(p.get_mach_port()))) { |
| 18 NOTREACHED(); | 24 NOTREACHED(); |
| 19 } | 25 } |
| 20 } | 26 } |
| 21 | 27 |
| 22 // static | 28 // static |
| 23 bool ParamTraits<MachPortMac>::Read(const base::Pickle* m, | 29 bool ParamTraits<MachPortMac>::Read(const base::Pickle* m, |
| 24 base::PickleIterator* iter, | 30 base::PickleIterator* iter, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 mach_port_attachment->reset_mach_port_ownership(); | 48 mach_port_attachment->reset_mach_port_ownership(); |
| 43 return true; | 49 return true; |
| 44 } | 50 } |
| 45 | 51 |
| 46 // static | 52 // static |
| 47 void ParamTraits<MachPortMac>::Log(const param_type& p, std::string* l) { | 53 void ParamTraits<MachPortMac>::Log(const param_type& p, std::string* l) { |
| 48 l->append(base::StringPrintf("mach port: 0x%X", p.get_mach_port())); | 54 l->append(base::StringPrintf("mach port: 0x%X", p.get_mach_port())); |
| 49 } | 55 } |
| 50 | 56 |
| 51 } // namespace IPC | 57 } // namespace IPC |
| OLD | NEW |