Index: chrome/common/mach_ipc_mac.mm |
diff --git a/chrome/common/mach_ipc_mac.mm b/chrome/common/mach_ipc_mac.mm |
index 7693d9a7f3be5de6cd69d55258446fb79c731d31..48f2a5a3f212617729396fba445efe73ddce94ba 100644 |
--- a/chrome/common/mach_ipc_mac.mm |
+++ b/chrome/common/mach_ipc_mac.mm |
@@ -185,20 +185,26 @@ ReceivePort::ReceivePort(const char *receive_port_name) { |
MACH_PORT_RIGHT_RECEIVE, |
&port_); |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "failed to allocate send port\n"); |
Mark Mentovai
2010/01/11 20:22:46
What's this decoration about?
|
return; |
+ } |
init_result_ = mach_port_insert_right(current_task, |
port_, |
port_, |
MACH_MSG_TYPE_MAKE_SEND); |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "failed to insert send right\n"); |
Mark Mentovai
2010/01/11 20:22:46
Same
|
return; |
+ } |
NSPort *ns_port = [NSMachPort portWithMachPort:port_]; |
NSString *port_name = [NSString stringWithUTF8String:receive_port_name]; |
- [[NSMachBootstrapServer sharedInstance] registerPort:ns_port name:port_name]; |
+ if (![[NSMachBootstrapServer sharedInstance] registerPort:ns_port name:port_name]) { |
Mark Mentovai
2010/01/11 20:22:46
80
|
+NSLog(@"failed to register ort %@ with name %@", ns_port, port_name); |
Mark Mentovai
2010/01/11 20:22:46
NSLog?
And you misspelled port. :)
|
+ } |
} |
//============================================================================== |
@@ -210,8 +216,10 @@ ReceivePort::ReceivePort() { |
MACH_PORT_RIGHT_RECEIVE, |
&port_); |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "failed to allocate send port2\n"); |
Mark Mentovai
2010/01/11 20:22:46
t’let
|
return; |
+ } |
init_result_ = mach_port_insert_right(current_task, |
port_, |
@@ -241,8 +249,10 @@ kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message, |
} |
// return any error condition encountered in constructor |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "failed to insert send right2\n"); |
Mark Mentovai
2010/01/11 20:22:46
…
|
return init_result_; |
+ } |
out_message->Head()->msgh_bits = 0; |
out_message->Head()->msgh_local_port = port_; |
@@ -269,8 +279,10 @@ MachPortSender::MachPortSender(const char *receive_port_name) { |
mach_port_t bootstrap_port = 0; |
init_result_ = task_get_bootstrap_port(mach_task_self(), &bootstrap_port); |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "receiving bootstrap port failed\n"); |
Mark Mentovai
2010/01/11 20:22:46
…
|
return; |
+ } |
init_result_ = bootstrap_look_up(bootstrap_port, |
const_cast<char*>(receive_port_name), |
@@ -291,8 +303,10 @@ kern_return_t MachPortSender::SendMessage(MachSendMessage &message, |
return KERN_INVALID_VALUE; // just for safety -- never should occur |
}; |
- if (init_result_ != KERN_SUCCESS) |
+ if (init_result_ != KERN_SUCCESS) { |
+fprintf(stderr, "bootstrap lookup failed\n"); |
Mark Mentovai
2010/01/11 20:22:46
…
|
return init_result_; |
+ } |
message.Head()->msgh_remote_port = send_port_; |