OLD | NEW |
---|---|
1 // Copyright (c) 2007, Google Inc. | 1 // Copyright (c) 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 return; | 174 return; |
175 | 175 |
176 init_result_ = mach_port_insert_right(current_task, | 176 init_result_ = mach_port_insert_right(current_task, |
177 port_, | 177 port_, |
178 port_, | 178 port_, |
179 MACH_MSG_TYPE_MAKE_SEND); | 179 MACH_MSG_TYPE_MAKE_SEND); |
180 | 180 |
181 if (init_result_ != KERN_SUCCESS) | 181 if (init_result_ != KERN_SUCCESS) |
182 return; | 182 return; |
183 | 183 |
184 mach_port_t task_bootstrap_port = 0; | 184 // Without |NSMachPortDeallocateNone|, the NSMachPort seems to deallocate |
185 init_result_ = task_get_bootstrap_port(current_task, &task_bootstrap_port); | 185 // receive rights on port when it is eventually released. It is not necessary |
186 | 186 // to deallocate any rights here as |port_| is fully deallocated in the |
187 if (init_result_ != KERN_SUCCESS) | 187 // ReceivePort destructor. |
188 return; | 188 NSPort *ns_port = [NSMachPort portWithMachPort:port_ |
189 | 189 options:NSMachPortDeallocateNone]; |
190 init_result_ = bootstrap_register(bootstrap_port, | 190 NSString *port_name = [NSString stringWithUTF8String:receive_port_name]; |
191 const_cast<char*>(receive_port_name), | 191 [[NSMachBootstrapServer sharedInstance] registerPort:ns_port name:port_name]; |
Mark Mentovai
2012/01/26 14:27:40
Rather than doing this Cocoa stuff, bpoop uses the
Nico
2012/01/26 18:07:39
If breakpad doesn't care about -Wdeprecated-declar
| |
192 port_); | |
193 } | 192 } |
194 | 193 |
195 //============================================================================== | 194 //============================================================================== |
196 // create a new mach port for receiving messages | 195 // create a new mach port for receiving messages |
197 ReceivePort::ReceivePort() { | 196 ReceivePort::ReceivePort() { |
198 mach_port_t current_task = mach_task_self(); | 197 mach_port_t current_task = mach_task_self(); |
199 | 198 |
200 init_result_ = mach_port_allocate(current_task, | 199 init_result_ = mach_port_allocate(current_task, |
201 MACH_PORT_RIGHT_RECEIVE, | 200 MACH_PORT_RIGHT_RECEIVE, |
202 &port_); | 201 &port_); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 message.head.msgh_size, | 294 message.head.msgh_size, |
296 0, | 295 0, |
297 MACH_PORT_NULL, | 296 MACH_PORT_NULL, |
298 timeout, // timeout in ms | 297 timeout, // timeout in ms |
299 MACH_PORT_NULL); | 298 MACH_PORT_NULL); |
300 | 299 |
301 return result; | 300 return result; |
302 } | 301 } |
303 | 302 |
304 } // namespace google_breakpad | 303 } // namespace google_breakpad |
OLD | NEW |