 Chromium Code Reviews
 Chromium Code Reviews Issue 1525023003:
  Distinguish in the browser between renderer crashes and kills  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1525023003:
  Distinguish in the browser between renderer crashes and kills  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: components/crash/content/app/breakpad_linux.cc | 
| diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc | 
| index 62888ad9ff5fa9f6d88feb8e640bb66d886070a3..1d24f009fa6fcfcec42c363e35ffba4736088b82 100644 | 
| --- a/components/crash/content/app/breakpad_linux.cc | 
| +++ b/components/crash/content/app/breakpad_linux.cc | 
| @@ -96,8 +96,10 @@ ExceptionHandler* g_breakpad = nullptr; | 
| const char* g_asan_report_str = nullptr; | 
| #endif | 
| #if defined(OS_ANDROID) | 
| +const char kWebViewProcessType[] = "webview"; | 
| char* g_process_type = nullptr; | 
| ExceptionHandler* g_microdump = nullptr; | 
| +int g_signal_code_pipe_fd = -1; | 
| class MicrodumpInfo { | 
| public: | 
| @@ -737,7 +739,22 @@ bool MicrodumpCrashDone(const MinidumpDescriptor& minidump, | 
| const bool is_browser_process = (context != nullptr); | 
| return FinalizeCrashDoneAndroid(is_browser_process); | 
| - } | 
| +} | 
| + | 
| +bool WriteSignalCodeToPipe(const void* crash_context, | 
| + size_t crash_context_size, | 
| + void* context) { | 
| + if (g_signal_code_pipe_fd == -1 || | 
| + crash_context_size != sizeof(ExceptionHandler::CrashContext)) | 
| + return false; | 
| 
Peter Wen
2015/12/21 14:49:24
If context size is wrong, then should this be trea
 
mnaganov (inactive)
2015/12/21 17:24:44
If the context size is of an unexpected value, tha
 | 
| + const ExceptionHandler::CrashContext* eh_context = | 
| + static_cast<const ExceptionHandler::CrashContext*>(crash_context); | 
| + int signo = eh_context->siginfo.si_signo; | 
| + sys_write(g_signal_code_pipe_fd, &signo, sizeof(signo)); | 
| + IGNORE_RET(sys_close(g_signal_code_pipe_fd)); | 
| + g_signal_code_pipe_fd = -1; | 
| + return false; | 
| +} | 
| bool CrashDoneInProcessNoUpload( | 
| const google_breakpad::MinidumpDescriptor& descriptor, | 
| @@ -830,7 +847,8 @@ void MicrodumpInfo::Initialize(const std::string& process_type, | 
| const char* android_build_fp) { | 
| DCHECK(thread_checker_.CalledOnValidThread()); | 
| DCHECK(!g_microdump); | 
| - bool is_browser_process = process_type.empty() || process_type == "webview"; | 
| + bool is_browser_process = | 
| + process_type.empty() || process_type == kWebViewProcessType; | 
| MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole); | 
| @@ -859,7 +877,7 @@ void MicrodumpInfo::Initialize(const std::string& process_type, | 
| true, // Install handlers. | 
| -1); // Server file descriptor. -1 for in-process. | 
| - if (process_type == "webview") { | 
| + if (process_type == kWebViewProcessType) { | 
| // We do not use |DumpProcess()| for handling programatically | 
| // generated dumps for WebView because we only know the file | 
| // descriptor to which we are dumping at the time of the call to | 
| @@ -869,6 +887,11 @@ void MicrodumpInfo::Initialize(const std::string& process_type, | 
| // time. | 
| base::debug::SetDumpWithoutCrashingFunction( | 
| &GenerateMinidumpOnDemandForAndroid); | 
| + } else if (!process_type.empty()) { | 
| + g_signal_code_pipe_fd = | 
| + GetCrashReporterClient()->GetAndroidMinidumpDescriptor(); | 
| + if (g_signal_code_pipe_fd != -1) | 
| + g_microdump->set_crash_handler(WriteSignalCodeToPipe); | 
| } | 
| } |