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

Side by Side Diff: tools/mac/exception_port_tool.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 unified diff | Download patch
« no previous file with comments | « tools/mac/catch_exception_tool.cc ('k') | util/mach/child_port_handshake.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // value, which can then be associated with handlers shown by 188 // value, which can then be associated with handlers shown by
189 // ShowExceptionPorts(). Any send rights obtained by this function are added to 189 // ShowExceptionPorts(). Any send rights obtained by this function are added to
190 // |mach_send_right_pool|. 190 // |mach_send_right_pool|.
191 void ShowBootstrapService(const std::string& service_name, 191 void ShowBootstrapService(const std::string& service_name,
192 MachSendRightPool* mach_send_right_pool) { 192 MachSendRightPool* mach_send_right_pool) {
193 base::mac::ScopedMachSendRight service_port(BootstrapLookUp(service_name)); 193 base::mac::ScopedMachSendRight service_port(BootstrapLookUp(service_name));
194 if (service_port == kMachPortNull) { 194 if (service_port == kMachPortNull) {
195 return; 195 return;
196 } 196 }
197 197
198 mach_send_right_pool->AddSendRight(service_port); 198 mach_send_right_pool->AddSendRight(service_port.get());
199 199
200 printf("service %s %#x\n", service_name.c_str(), service_port.get()); 200 printf("service %s %#x\n", service_name.c_str(), service_port.get());
201 } 201 }
202 202
203 // Prints information about all exception ports known for |exception_ports|. If 203 // Prints information about all exception ports known for |exception_ports|. If
204 // |numeric| is true, all information is printed in numeric form, otherwise, it 204 // |numeric| is true, all information is printed in numeric form, otherwise, it
205 // will be converted to symbolic constants where possible by 205 // will be converted to symbolic constants where possible by
206 // SymbolicConstantsMach. If |is_new| is true, information will be presented as 206 // SymbolicConstantsMach. If |is_new| is true, information will be presented as
207 // “new exception ports”, indicating that they show the state of the exception 207 // “new exception ports”, indicating that they show the state of the exception
208 // ports after SetExceptionPort() has been called. Any send rights obtained by 208 // ports after SetExceptionPort() has been called. Any send rights obtained by
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 // The service port doesn’t need to be added to a MachSendRightPool because 295 // The service port doesn’t need to be added to a MachSendRightPool because
296 // it’s not used for display at all. ScopedMachSendRight is sufficient. 296 // it’s not used for display at all. ScopedMachSendRight is sufficient.
297 } else if (description->handler != kHandlerNull) { 297 } else if (description->handler != kHandlerNull) {
298 return false; 298 return false;
299 } 299 }
300 300
301 ExceptionPorts exception_ports(description->target_type, target_port); 301 ExceptionPorts exception_ports(description->target_type, target_port);
302 if (!exception_ports.SetExceptionPort(description->mask, 302 if (!exception_ports.SetExceptionPort(description->mask,
303 service_port, 303 service_port.get(),
304 description->behavior, 304 description->behavior,
305 description->flavor)) { 305 description->flavor)) {
306 return false; 306 return false;
307 } 307 }
308 308
309 return true; 309 return true;
310 } 310 }
311 311
312 void Usage(const std::string& me) { 312 void Usage(const std::string& me) {
313 fprintf(stderr, 313 fprintf(stderr,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 return kExitSuccess; 583 return kExitSuccess;
584 } 584 }
585 585
586 } // namespace 586 } // namespace
587 } // namespace crashpad 587 } // namespace crashpad
588 588
589 int main(int argc, char* argv[]) { 589 int main(int argc, char* argv[]) {
590 return crashpad::ExceptionPortToolMain(argc, argv); 590 return crashpad::ExceptionPortToolMain(argc, argv);
591 } 591 }
OLDNEW
« no previous file with comments | « tools/mac/catch_exception_tool.cc ('k') | util/mach/child_port_handshake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698