Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: test/mac/mach_multiprocess.cc

Issue 1383283003: Add and use scoped-right-returning wrappers for Mach bootstrap routines (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Self-review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/mac/catch_exception_tool.cc » ('j') | util/mach/mach_extensions.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mac/mach_multiprocess.cc
diff --git a/test/mac/mach_multiprocess.cc b/test/mac/mach_multiprocess.cc
index 834b5d678d13b39a1510af2f5261715d687d121d..6d410d38cee5eb00a3c269e4891f6df2bf6cf59d 100644
--- a/test/mac/mach_multiprocess.cc
+++ b/test/mac/mach_multiprocess.cc
@@ -16,7 +16,6 @@
#include <AvailabilityMacros.h>
#include <bsm/libbsm.h>
-#include <servers/bootstrap.h>
#include <string>
@@ -98,13 +97,8 @@ void MachMultiprocess::PreFork() {
info_->service_name.append(1, base::RandInt('A', 'Z'));
}
- mach_port_t local_port;
- kern_return_t kr = bootstrap_check_in(bootstrap_port,
- info_->service_name.c_str(),
- &local_port);
- ASSERT_EQ(BOOTSTRAP_SUCCESS, kr)
- << BootstrapErrorMessage(kr, "bootstrap_check_in");
- info_->local_port.reset(local_port);
+ info_->local_port = BootstrapCheckIn(info_->service_name);
+ ASSERT_NE(kMachPortNull, info_->local_port);
}
mach_port_t MachMultiprocess::LocalPort() const {
@@ -224,12 +218,8 @@ void MachMultiprocess::MultiprocessChild() {
ASSERT_NE(kMachPortNull, info_->local_port);
// The remote port can be obtained from the bootstrap server.
- mach_port_t remote_port;
- kern_return_t kr = bootstrap_look_up(
- bootstrap_port, info_->service_name.c_str(), &remote_port);
- ASSERT_EQ(BOOTSTRAP_SUCCESS, kr)
- << BootstrapErrorMessage(kr, "bootstrap_look_up");
- info_->remote_port.reset(remote_port);
+ info_->remote_port = BootstrapLookUp(info_->service_name);
+ ASSERT_NE(kMachPortNull, info_->remote_port);
// The “hello” message will provide the parent with its remote port, a send
// right to the child task’s local port receive right. It will also carry a
@@ -246,13 +236,13 @@ void MachMultiprocess::MultiprocessChild() {
message.port_descriptor.disposition = MACH_MSG_TYPE_COPY_SEND;
message.port_descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
- kr = mach_msg(&message.header,
- MACH_SEND_MSG,
- message.header.msgh_size,
- 0,
- MACH_PORT_NULL,
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
+ kern_return_t kr = mach_msg(&message.header,
+ MACH_SEND_MSG,
+ message.header.msgh_size,
+ 0,
+ MACH_PORT_NULL,
+ MACH_MSG_TIMEOUT_NONE,
+ MACH_PORT_NULL);
ASSERT_EQ(MACH_MSG_SUCCESS, kr) << MachErrorMessage(kr, "mach_msg");
MachMultiprocessChild();
« no previous file with comments | « no previous file | tools/mac/catch_exception_tool.cc » ('j') | util/mach/mach_extensions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698