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

Unified Diff: util/mach/child_port_handshake.cc

Issue 1405273002: Mach port scopers should use get() instead of type conversion operators (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: More is_valid() 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 | « tools/mac/exception_port_tool.cc ('k') | util/mach/exception_ports_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/child_port_handshake.cc
diff --git a/util/mach/child_port_handshake.cc b/util/mach/child_port_handshake.cc
index b01af7a7ff61c1bbc5c97e585715cb04992ba117..119a53c02565a72f88fca63243c1e4309b10e198 100644
--- a/util/mach/child_port_handshake.cc
+++ b/util/mach/child_port_handshake.cc
@@ -105,7 +105,7 @@ mach_port_t ChildPortHandshake::RunServer() {
// Check the new service in with the bootstrap server, obtaining a receive
// right for it.
base::mac::ScopedMachReceiveRight server_port(BootstrapCheckIn(service_name));
- CHECK_NE(server_port, kMachPortNull);
+ CHECK(server_port.is_valid());
// Share the service name with the client via the pipe.
uint32_t service_name_length = service_name.size();
@@ -125,10 +125,10 @@ mach_port_t ChildPortHandshake::RunServer() {
// requires a port set. Create a new port set and add the receive right to it.
base::mac::ScopedMachPortSet server_port_set(
NewMachPort(MACH_PORT_RIGHT_PORT_SET));
- CHECK_NE(server_port_set, kMachPortNull);
+ CHECK(server_port_set.is_valid());
- kern_return_t kr =
- mach_port_insert_member(mach_task_self(), server_port, server_port_set);
+ kern_return_t kr = mach_port_insert_member(
+ mach_task_self(), server_port.get(), server_port_set.get());
MACH_CHECK(kr == KERN_SUCCESS, kr) << "mach_port_insert_member";
// Set up a kqueue to monitor both the server’s receive right and the write
@@ -140,7 +140,7 @@ mach_port_t ChildPortHandshake::RunServer() {
struct kevent changelist[2];
EV_SET(&changelist[0],
- server_port_set,
+ server_port_set.get(),
EVFILT_MACHPORT,
EV_ADD | EV_CLEAR,
0,
@@ -194,7 +194,7 @@ mach_port_t ChildPortHandshake::RunServer() {
switch (event.filter) {
case EVFILT_MACHPORT: {
// There’s something to receive on the port set.
- DCHECK_EQ(event.ident, server_port_set);
+ DCHECK_EQ(event.ident, server_port_set.get());
// Run the message server in an inner loop instead of using
// MachMessageServer::kPersistent. This allows the loop to exit as soon
@@ -207,7 +207,7 @@ mach_port_t ChildPortHandshake::RunServer() {
// this will call HandleChildPortCheckIn().
mach_msg_return_t mr =
MachMessageServer::Run(&child_port_server,
- server_port_set,
+ server_port_set.get(),
MACH_MSG_OPTION_NONE,
MachMessageServer::kOneShot,
MachMessageServer::kReceiveLargeIgnore,
@@ -329,10 +329,11 @@ void ChildPortHandshake::RunClientInternal_SendCheckIn(
// Get a send right to the server by looking up the service with the bootstrap
// server by name.
base::mac::ScopedMachSendRight server_port(BootstrapLookUp(service_name));
- CHECK_NE(server_port, kMachPortNull);
+ CHECK(server_port.is_valid());
// Check in with the server.
- kern_return_t kr = child_port_check_in(server_port, token, port, right_type);
+ kern_return_t kr =
+ child_port_check_in(server_port.get(), token, port, right_type);
MACH_CHECK(kr == KERN_SUCCESS, kr) << "child_port_check_in";
}
« no previous file with comments | « tools/mac/exception_port_tool.cc ('k') | util/mach/exception_ports_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698