| 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 "base/mac/scoped_mach_port.h" | 5 #include "base/mac/scoped_mach_port.h" |
| 6 | 6 |
| 7 #include "base/mac/mach_logging.h" | 7 #include "base/mac/mach_logging.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 namespace mac { | 10 namespace mac { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 void PortSetTraits::Free(mach_port_t port) { | 29 void PortSetTraits::Free(mach_port_t port) { |
| 30 kern_return_t kr = | 30 kern_return_t kr = |
| 31 mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET, -1); | 31 mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET, -1); |
| 32 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) | 32 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) |
| 33 << "ScopedMachPortSet mach_port_mod_refs"; | 33 << "ScopedMachPortSet mach_port_mod_refs"; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // static |
| 37 void RefCountedSendRighTraits::Retain(mach_port_t port) { |
| 38 kern_return_t kr = |
| 39 mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, 1); |
| 40 |
| 41 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) |
| 42 << "RefCountedSendRighTraits::Retain mach_port_mod_refs"; |
| 43 } |
| 44 |
| 45 // static |
| 46 void RefCountedSendRighTraits::Release(mach_port_t port) { |
| 47 kern_return_t kr = |
| 48 mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, -1); |
| 49 |
| 50 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) |
| 51 << "RefCountedSendRighTraits::Release mach_port_mod_refs"; |
| 52 } |
| 53 |
| 36 } // namespace internal | 54 } // namespace internal |
| 37 } // namespace mac | 55 } // namespace mac |
| 38 } // namespace base | 56 } // namespace base |
| OLD | NEW |