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/test_util_mac.h" | 5 #include "ipc/test_util_mac.h" |
6 | 6 |
7 #include <servers/bootstrap.h> | 7 #include <servers/bootstrap.h> |
8 | 8 |
9 #include "base/mac/mach_logging.h" | 9 #include "base/mac/mach_logging.h" |
10 #include "base/mac/scoped_mach_port.h" | 10 #include "base/mac/scoped_mach_port.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 mach_port_name_array_t name_array; | 93 mach_port_name_array_t name_array; |
94 mach_msg_type_number_t names_count; | 94 mach_msg_type_number_t names_count; |
95 mach_port_type_array_t type_array; | 95 mach_port_type_array_t type_array; |
96 mach_msg_type_number_t types_count; | 96 mach_msg_type_number_t types_count; |
97 kern_return_t kr = mach_port_names(mach_task_self(), &name_array, | 97 kern_return_t kr = mach_port_names(mach_task_self(), &name_array, |
98 &names_count, &type_array, &types_count); | 98 &names_count, &type_array, &types_count); |
99 MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetActiveNameCount"; | 99 MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetActiveNameCount"; |
100 return names_count; | 100 return names_count; |
101 } | 101 } |
102 | 102 |
| 103 mach_port_urefs_t GetMachRefCount(mach_port_name_t name, |
| 104 mach_port_right_t right) { |
| 105 mach_port_urefs_t ref_count; |
| 106 kern_return_t kr = mach_port_get_refs(mach_task_self(), name, |
| 107 MACH_PORT_RIGHT_SEND, &ref_count); |
| 108 MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetRefCount"; |
| 109 return ref_count; |
| 110 } |
| 111 |
103 void IncrementMachRefCount(mach_port_name_t name, mach_port_right_t right) { | 112 void IncrementMachRefCount(mach_port_name_t name, mach_port_right_t right) { |
104 kern_return_t kr = mach_port_mod_refs(mach_task_self(), name, right, 1); | 113 kern_return_t kr = mach_port_mod_refs(mach_task_self(), name, right, 1); |
105 MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetRefCount"; | 114 MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetRefCount"; |
106 } | 115 } |
107 | 116 |
108 } // namespace IPC | 117 } // namespace IPC |
OLD | NEW |