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 15 matching lines...) Expand all Loading... |
26 #include "base/logging.h" | 26 #include "base/logging.h" |
27 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
28 #include "base/scoped_generic.h" | 28 #include "base/scoped_generic.h" |
29 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
31 #include "client/crash_report_database.h" | 31 #include "client/crash_report_database.h" |
32 #include "client/crashpad_client.h" | 32 #include "client/crashpad_client.h" |
33 #include "tools/tool_support.h" | 33 #include "tools/tool_support.h" |
34 #include "handler/crash_report_upload_thread.h" | 34 #include "handler/crash_report_upload_thread.h" |
35 #include "util/file/file_io.h" | 35 #include "util/file/file_io.h" |
| 36 #include "util/stdlib/move.h" |
36 #include "util/stdlib/map_insert.h" | 37 #include "util/stdlib/map_insert.h" |
37 #include "util/stdlib/string_number_conversion.h" | 38 #include "util/stdlib/string_number_conversion.h" |
38 #include "util/string/split_string.h" | 39 #include "util/string/split_string.h" |
39 #include "util/synchronization/semaphore.h" | 40 #include "util/synchronization/semaphore.h" |
40 | 41 |
41 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
42 #include <libgen.h> | 43 #include <libgen.h> |
43 #include <signal.h> | 44 #include <signal.h> |
44 | 45 |
45 #include "base/mac/scoped_mach_port.h" | 46 #include "base/mac/scoped_mach_port.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ChildPortHandshake::PortRightType::kReceiveRight)); | 308 ChildPortHandshake::PortRightType::kReceiveRight)); |
308 } else if (!options.mach_service.empty()) { | 309 } else if (!options.mach_service.empty()) { |
309 receive_right = BootstrapCheckIn(options.mach_service); | 310 receive_right = BootstrapCheckIn(options.mach_service); |
310 } | 311 } |
311 | 312 |
312 if (!receive_right.is_valid()) { | 313 if (!receive_right.is_valid()) { |
313 return EXIT_FAILURE; | 314 return EXIT_FAILURE; |
314 } | 315 } |
315 | 316 |
316 ExceptionHandlerServer exception_handler_server( | 317 ExceptionHandlerServer exception_handler_server( |
317 receive_right.Pass(), !options.mach_service.empty()); | 318 crashpad::move(receive_right), !options.mach_service.empty()); |
318 base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server( | 319 base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server( |
319 &g_exception_handler_server, &exception_handler_server); | 320 &g_exception_handler_server, &exception_handler_server); |
320 | 321 |
321 struct sigaction old_sa; | 322 struct sigaction old_sa; |
322 ScopedResetSIGTERM reset_sigterm; | 323 ScopedResetSIGTERM reset_sigterm; |
323 if (!options.mach_service.empty()) { | 324 if (!options.mach_service.empty()) { |
324 // When running from launchd, no no-senders notification could ever be | 325 // When running from launchd, no no-senders notification could ever be |
325 // triggered, because launchd maintains a send right to the service. When | 326 // triggered, because launchd maintains a send right to the service. When |
326 // launchd wants the job to exit, it will send a SIGTERM. See | 327 // launchd wants the job to exit, it will send a SIGTERM. See |
327 // launchd.plist(5). | 328 // launchd.plist(5). |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 database.get(), &upload_thread, &options.annotations); | 373 database.get(), &upload_thread, &options.annotations); |
373 | 374 |
374 exception_handler_server.Run(&exception_handler); | 375 exception_handler_server.Run(&exception_handler); |
375 | 376 |
376 upload_thread.Stop(); | 377 upload_thread.Stop(); |
377 | 378 |
378 return EXIT_SUCCESS; | 379 return EXIT_SUCCESS; |
379 } | 380 } |
380 | 381 |
381 } // namespace crashpad | 382 } // namespace crashpad |
OLD | NEW |