OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/crash/browser/crash_handler_host_linux.h" | 5 #include "components/crash/browser/crash_handler_host_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
17 #include "base/files/scoped_file.h" | 17 #include "base/files/scoped_file.h" |
18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
19 #include "base/linux_util.h" | 19 #include "base/linux_util.h" |
| 20 #include "base/location.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/message_loop/message_loop.h" | |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/posix/eintr_wrapper.h" | 23 #include "base/posix/eintr_wrapper.h" |
24 #include "base/rand_util.h" | 24 #include "base/rand_util.h" |
| 25 #include "base/single_thread_task_runner.h" |
25 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
27 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
28 #include "breakpad/src/client/linux/handler/exception_handler.h" | 29 #include "breakpad/src/client/linux/handler/exception_handler.h" |
29 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" | 30 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" |
30 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" | 31 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" |
31 #include "components/crash/app/breakpad_linux_impl.h" | 32 #include "components/crash/app/breakpad_linux_impl.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 | 34 |
34 #if defined(OS_ANDROID) && !defined(__LP64__) | 35 #if defined(OS_ANDROID) && !defined(__LP64__) |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 struct msghdr msg = {0}; | 409 struct msghdr msg = {0}; |
409 struct iovec done_iov; | 410 struct iovec done_iov; |
410 done_iov.iov_base = const_cast<char*>("\x42"); | 411 done_iov.iov_base = const_cast<char*>("\x42"); |
411 done_iov.iov_len = 1; | 412 done_iov.iov_len = 1; |
412 msg.msg_iov = &done_iov; | 413 msg.msg_iov = &done_iov; |
413 msg.msg_iovlen = 1; | 414 msg.msg_iovlen = 1; |
414 | 415 |
415 HANDLE_EINTR(sendmsg(signal_fd, &msg, MSG_DONTWAIT | MSG_NOSIGNAL)); | 416 HANDLE_EINTR(sendmsg(signal_fd, &msg, MSG_DONTWAIT | MSG_NOSIGNAL)); |
416 close(signal_fd); | 417 close(signal_fd); |
417 | 418 |
418 uploader_thread_->message_loop()->PostTask( | 419 uploader_thread_->task_runner()->PostTask( |
419 FROM_HERE, | 420 FROM_HERE, |
420 base::Bind(&CrashDumpTask, base::Unretained(this), base::Passed(&info))); | 421 base::Bind(&CrashDumpTask, base::Unretained(this), base::Passed(&info))); |
421 } | 422 } |
422 | 423 |
423 void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { | 424 void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { |
424 file_descriptor_watcher_.StopWatchingFileDescriptor(); | 425 file_descriptor_watcher_.StopWatchingFileDescriptor(); |
425 | 426 |
426 // If we are quitting and there are crash dumps in the queue, turn them into | 427 // If we are quitting and there are crash dumps in the queue, turn them into |
427 // no-ops. | 428 // no-ops. |
428 shutting_down_ = true; | 429 shutting_down_ = true; |
429 uploader_thread_->Stop(); | 430 uploader_thread_->Stop(); |
430 } | 431 } |
431 | 432 |
432 bool CrashHandlerHostLinux::IsShuttingDown() const { | 433 bool CrashHandlerHostLinux::IsShuttingDown() const { |
433 return shutting_down_; | 434 return shutting_down_; |
434 } | 435 } |
435 | 436 |
436 } // namespace breakpad | 437 } // namespace breakpad |
OLD | NEW |