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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "handler/handler_main.h" | 15 #include "handler/handler_main.h" |
16 | 16 |
17 #include <getopt.h> | 17 #include <getopt.h> |
18 #include <stdlib.h> | 18 #include <stdlib.h> |
19 | 19 |
20 #include <map> | 20 #include <map> |
21 #include <string> | 21 #include <string> |
| 22 #include <utility> |
22 | 23 |
23 #include "base/auto_reset.h" | 24 #include "base/auto_reset.h" |
24 #include "base/files/file_path.h" | 25 #include "base/files/file_path.h" |
25 #include "base/files/scoped_file.h" | 26 #include "base/files/scoped_file.h" |
26 #include "base/logging.h" | 27 #include "base/logging.h" |
27 #include "base/memory/scoped_ptr.h" | 28 #include "base/memory/scoped_ptr.h" |
28 #include "base/scoped_generic.h" | 29 #include "base/scoped_generic.h" |
29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
30 #include "build/build_config.h" | 31 #include "build/build_config.h" |
31 #include "client/crash_report_database.h" | 32 #include "client/crash_report_database.h" |
32 #include "client/crashpad_client.h" | 33 #include "client/crashpad_client.h" |
33 #include "tools/tool_support.h" | 34 #include "tools/tool_support.h" |
34 #include "handler/crash_report_upload_thread.h" | 35 #include "handler/crash_report_upload_thread.h" |
35 #include "util/file/file_io.h" | 36 #include "util/file/file_io.h" |
36 #include "util/stdlib/move.h" | |
37 #include "util/stdlib/map_insert.h" | 37 #include "util/stdlib/map_insert.h" |
38 #include "util/stdlib/string_number_conversion.h" | 38 #include "util/stdlib/string_number_conversion.h" |
39 #include "util/string/split_string.h" | 39 #include "util/string/split_string.h" |
40 #include "util/synchronization/semaphore.h" | 40 #include "util/synchronization/semaphore.h" |
41 | 41 |
42 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
43 #include <libgen.h> | 43 #include <libgen.h> |
44 #include <signal.h> | 44 #include <signal.h> |
45 | 45 |
46 #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... |
308 ChildPortHandshake::PortRightType::kReceiveRight)); | 308 ChildPortHandshake::PortRightType::kReceiveRight)); |
309 } else if (!options.mach_service.empty()) { | 309 } else if (!options.mach_service.empty()) { |
310 receive_right = BootstrapCheckIn(options.mach_service); | 310 receive_right = BootstrapCheckIn(options.mach_service); |
311 } | 311 } |
312 | 312 |
313 if (!receive_right.is_valid()) { | 313 if (!receive_right.is_valid()) { |
314 return EXIT_FAILURE; | 314 return EXIT_FAILURE; |
315 } | 315 } |
316 | 316 |
317 ExceptionHandlerServer exception_handler_server( | 317 ExceptionHandlerServer exception_handler_server( |
318 crashpad::move(receive_right), !options.mach_service.empty()); | 318 std::move(receive_right), !options.mach_service.empty()); |
319 base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server( | 319 base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server( |
320 &g_exception_handler_server, &exception_handler_server); | 320 &g_exception_handler_server, &exception_handler_server); |
321 | 321 |
322 struct sigaction old_sa; | 322 struct sigaction old_sa; |
323 ScopedResetSIGTERM reset_sigterm; | 323 ScopedResetSIGTERM reset_sigterm; |
324 if (!options.mach_service.empty()) { | 324 if (!options.mach_service.empty()) { |
325 // When running from launchd, no no-senders notification could ever be | 325 // When running from launchd, no no-senders notification could ever be |
326 // triggered, because launchd maintains a send right to the service. When | 326 // triggered, because launchd maintains a send right to the service. When |
327 // 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 |
328 // launchd.plist(5). | 328 // launchd.plist(5). |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 database.get(), &upload_thread, &options.annotations); | 372 database.get(), &upload_thread, &options.annotations); |
373 | 373 |
374 exception_handler_server.Run(&exception_handler); | 374 exception_handler_server.Run(&exception_handler); |
375 | 375 |
376 upload_thread.Stop(); | 376 upload_thread.Stop(); |
377 | 377 |
378 return EXIT_SUCCESS; | 378 return EXIT_SUCCESS; |
379 } | 379 } |
380 | 380 |
381 } // namespace crashpad | 381 } // namespace crashpad |
OLD | NEW |