OLD | NEW |
---|---|
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 int ChildPortHandshake::ReadPipeFD() const { | 73 int ChildPortHandshake::ReadPipeFD() const { |
74 DCHECK_NE(pipe_read_.get(), -1); | 74 DCHECK_NE(pipe_read_.get(), -1); |
75 return pipe_read_.get(); | 75 return pipe_read_.get(); |
76 } | 76 } |
77 | 77 |
78 mach_port_t ChildPortHandshake::RunServer() { | 78 mach_port_t ChildPortHandshake::RunServer() { |
79 DCHECK_NE(pipe_read_.get(), -1); | 79 DCHECK_NE(pipe_read_.get(), -1); |
80 pipe_read_.reset(); | 80 pipe_read_.reset(); |
81 | 81 |
82 // Transfer ownership of the write pipe into this method’s scope. | 82 // Transfer ownership of the write pipe into this method’s scope. |
83 base::ScopedFD pipe_write_owner(pipe_write_.release()); | 83 base::ScopedFD pipe_write_owner = pipe_write_.Pass(); |
Robert Sesek
2015/03/11 22:44:22
I can revert this one if you prefer the other.
Mark Mentovai
2015/03/12 02:58:27
Robert Sesek wrote:
| |
84 | 84 |
85 // Initialize the token and share it with the client via the pipe. | 85 // Initialize the token and share it with the client via the pipe. |
86 token_ = base::RandUint64(); | 86 token_ = base::RandUint64(); |
87 int pipe_write = pipe_write_owner.get(); | 87 int pipe_write = pipe_write_owner.get(); |
88 if (!LoggingWriteFile(pipe_write, &token_, sizeof(token_))) { | 88 if (!LoggingWriteFile(pipe_write, &token_, sizeof(token_))) { |
89 LOG(WARNING) << "no client check-in"; | 89 LOG(WARNING) << "no client check-in"; |
90 return MACH_PORT_NULL; | 90 return MACH_PORT_NULL; |
91 } | 91 } |
92 | 92 |
93 // Create a unique name for the bootstrap service mapping. Make it unguessable | 93 // Create a unique name for the bootstrap service mapping. Make it unguessable |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 bootstrap_look_up(bootstrap_port, service_name.c_str(), &server_port); | 338 bootstrap_look_up(bootstrap_port, service_name.c_str(), &server_port); |
339 BOOTSTRAP_CHECK(kr == BOOTSTRAP_SUCCESS, kr) << "bootstrap_look_up"; | 339 BOOTSTRAP_CHECK(kr == BOOTSTRAP_SUCCESS, kr) << "bootstrap_look_up"; |
340 base::mac::ScopedMachSendRight server_port_owner(server_port); | 340 base::mac::ScopedMachSendRight server_port_owner(server_port); |
341 | 341 |
342 // Check in with the server. | 342 // Check in with the server. |
343 kr = child_port_check_in(server_port, token, port, right_type); | 343 kr = child_port_check_in(server_port, token, port, right_type); |
344 MACH_CHECK(kr == KERN_SUCCESS, kr) << "child_port_check_in"; | 344 MACH_CHECK(kr == KERN_SUCCESS, kr) << "child_port_check_in"; |
345 } | 345 } |
346 | 346 |
347 } // namespace crashpad | 347 } // namespace crashpad |
OLD | NEW |