| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/mach_ipc_mac.h" | 5 #include "chrome/common/mach_ipc_mac.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 ReceivePort::ReceivePort() { | 206 ReceivePort::ReceivePort() { |
| 207 mach_port_t current_task = mach_task_self(); | 207 mach_port_t current_task = mach_task_self(); |
| 208 | 208 |
| 209 init_result_ = mach_port_allocate(current_task, | 209 init_result_ = mach_port_allocate(current_task, |
| 210 MACH_PORT_RIGHT_RECEIVE, | 210 MACH_PORT_RIGHT_RECEIVE, |
| 211 &port_); | 211 &port_); |
| 212 | 212 |
| 213 if (init_result_ != KERN_SUCCESS) | 213 if (init_result_ != KERN_SUCCESS) |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 init_result_ = mach_port_insert_right(current_task, | 216 init_result_ = mach_port_insert_right(current_task, |
| 217 port_, | 217 port_, |
| 218 port_, | 218 port_, |
| 219 MACH_MSG_TYPE_MAKE_SEND); | 219 MACH_MSG_TYPE_MAKE_SEND); |
| 220 } | 220 } |
| 221 | 221 |
| 222 //============================================================================== | 222 //============================================================================== |
| 223 // Given an already existing mach port, use it. We take ownership of the | 223 // Given an already existing mach port, use it. We take ownership of the |
| 224 // port and deallocate it in our destructor. | 224 // port and deallocate it in our destructor. |
| 225 ReceivePort::ReceivePort(mach_port_t receive_port) | 225 ReceivePort::ReceivePort(mach_port_t receive_port) |
| 226 : port_(receive_port), | 226 : port_(receive_port), |
| 227 init_result_(KERN_SUCCESS) { | 227 init_result_(KERN_SUCCESS) { |
| 228 } | 228 } |
| 229 | 229 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 kern_return_t result = mach_msg(message.Head(), | 299 kern_return_t result = mach_msg(message.Head(), |
| 300 MACH_SEND_MSG | MACH_SEND_TIMEOUT, | 300 MACH_SEND_MSG | MACH_SEND_TIMEOUT, |
| 301 message.Head()->msgh_size, | 301 message.Head()->msgh_size, |
| 302 0, | 302 0, |
| 303 MACH_PORT_NULL, | 303 MACH_PORT_NULL, |
| 304 timeout, // timeout in ms | 304 timeout, // timeout in ms |
| 305 MACH_PORT_NULL); | 305 MACH_PORT_NULL); |
| 306 | 306 |
| 307 return result; | 307 return result; |
| 308 } | 308 } |
| OLD | NEW |