| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
| 6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
| 7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" | 7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" |
| 8 | 8 |
| 9 #include "chrome/app/breakpad_linux.h" | 9 #include "chrome/app/breakpad_linux.h" |
| 10 | 10 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 new google_breakpad::ExceptionHandler(dumps_path.value().c_str(), NULL, | 679 new google_breakpad::ExceptionHandler(dumps_path.value().c_str(), NULL, |
| 680 CrashDoneNoUpload, NULL, | 680 CrashDoneNoUpload, NULL, |
| 681 true /* install handlers */); | 681 true /* install handlers */); |
| 682 } else { | 682 } else { |
| 683 new google_breakpad::ExceptionHandler(tmp_path.value().c_str(), NULL, | 683 new google_breakpad::ExceptionHandler(tmp_path.value().c_str(), NULL, |
| 684 CrashDoneUpload, NULL, | 684 CrashDoneUpload, NULL, |
| 685 true /* install handlers */); | 685 true /* install handlers */); |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 | 688 |
| 689 // Currently Non-Browser = Renderer, Plugins, Native Client and Gpu | 689 // Currently Non-Browser = Renderer, Plugins and Gpu |
| 690 static bool | 690 static bool |
| 691 NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size, | 691 NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size, |
| 692 void* context) { | 692 void* context) { |
| 693 const int fd = reinterpret_cast<intptr_t>(context); | 693 const int fd = reinterpret_cast<intptr_t>(context); |
| 694 int fds[2] = { -1, -1 }; | 694 int fds[2] = { -1, -1 }; |
| 695 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { | 695 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { |
| 696 static const char msg[] = "Failed to create socket for crash dumping.\n"; | 696 static const char msg[] = "Failed to create socket for crash dumping.\n"; |
| 697 sys_write(2, msg, sizeof(msg)-1); | 697 sys_write(2, msg, sizeof(msg)-1); |
| 698 return false; | 698 return false; |
| 699 } | 699 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 void InitCrashReporter() { | 781 void InitCrashReporter() { |
| 782 // Determine the process type and take appropriate action. | 782 // Determine the process type and take appropriate action. |
| 783 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 783 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 784 const std::string process_type = | 784 const std::string process_type = |
| 785 parsed_command_line.GetSwitchValueASCII(switches::kProcessType); | 785 parsed_command_line.GetSwitchValueASCII(switches::kProcessType); |
| 786 if (process_type.empty()) { | 786 if (process_type.empty()) { |
| 787 EnableCrashDumping(getenv(env_vars::kHeadless) != NULL); | 787 EnableCrashDumping(getenv(env_vars::kHeadless) != NULL); |
| 788 } else if (process_type == switches::kRendererProcess || | 788 } else if (process_type == switches::kRendererProcess || |
| 789 process_type == switches::kPluginProcess || | 789 process_type == switches::kPluginProcess || |
| 790 process_type == switches::kZygoteProcess || | 790 process_type == switches::kZygoteProcess || |
| 791 process_type == switches::kNaClLoaderProcess || | |
| 792 process_type == switches::kGpuProcess) { | 791 process_type == switches::kGpuProcess) { |
| 793 // We might be chrooted in a zygote or renderer process so we cannot call | 792 // We might be chrooted in a zygote or renderer process so we cannot call |
| 794 // GetCollectStatsConsent because that needs access the the user's home | 793 // GetCollectStatsConsent because that needs access the the user's home |
| 795 // dir. Instead, we set a command line flag for these processes. | 794 // dir. Instead, we set a command line flag for these processes. |
| 796 // Even though plugins are not chrooted, we share the same code path for | 795 // Even though plugins are not chrooted, we share the same code path for |
| 797 // simplicity. | 796 // simplicity. |
| 798 if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter)) | 797 if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter)) |
| 799 return; | 798 return; |
| 800 // Get the guid and linux distro from the command line switch. | 799 // Get the guid and linux distro from the command line switch. |
| 801 std::string switch_value = | 800 std::string switch_value = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 814 struct timeval tv; | 813 struct timeval tv; |
| 815 if (!gettimeofday(&tv, NULL)) | 814 if (!gettimeofday(&tv, NULL)) |
| 816 process_start_time = timeval_to_ms(&tv); | 815 process_start_time = timeval_to_ms(&tv); |
| 817 else | 816 else |
| 818 process_start_time = 0; | 817 process_start_time = 0; |
| 819 } | 818 } |
| 820 | 819 |
| 821 bool IsCrashReporterEnabled() { | 820 bool IsCrashReporterEnabled() { |
| 822 return is_crash_reporter_enabled; | 821 return is_crash_reporter_enabled; |
| 823 } | 822 } |
| OLD | NEW |