| Index: components/crash/content/browser/crash_dump_manager_android.cc
|
| diff --git a/components/crash/content/browser/crash_dump_manager_android.cc b/components/crash/content/browser/crash_dump_manager_android.cc
|
| index 62e77ad6206c83c83177a64c9d00c3ecc84ff122..8a0f402c76e9828221815eb90c867185b66a473d 100644
|
| --- a/components/crash/content/browser/crash_dump_manager_android.cc
|
| +++ b/components/crash/content/browser/crash_dump_manager_android.cc
|
| @@ -4,10 +4,12 @@
|
|
|
| #include "components/crash/content/browser/crash_dump_manager_android.h"
|
|
|
| +#include "base/android/application_status_listener.h"
|
| #include "base/bind.h"
|
| #include "base/files/file_util.h"
|
| #include "base/format_macros.h"
|
| #include "base/logging.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/posix/global_descriptors.h"
|
| #include "base/process/process.h"
|
| #include "base/rand_util.h"
|
| @@ -82,7 +84,8 @@ base::File CrashDumpManager::CreateMinidumpFile(int child_process_id) {
|
|
|
| // static
|
| void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path,
|
| - base::ProcessHandle pid) {
|
| + base::ProcessHandle pid,
|
| + bool recordExitStatus) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| CHECK(instance_);
|
| int64 file_size = 0;
|
| @@ -90,6 +93,18 @@ void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path,
|
| DCHECK(r) << "Failed to retrieve size for minidump "
|
| << minidump_path.value();
|
|
|
| + if (recordExitStatus) {
|
| + int exitStatus = ExitStatus::COUNT;
|
| + if (file_size == 0) {
|
| + exitStatus = ExitStatus::EMPTY_MINIDUMP;
|
| + } else {
|
| + exitStatus = ExitStatus::VALID_MINIDUMP;
|
| + }
|
| + UMA_HISTOGRAM_ENUMERATION("Tab.RendererDetailedExitStatus",
|
| + exitStatus,
|
| + ExitStatus::COUNT);
|
| + }
|
| +
|
| if (file_size == 0) {
|
| // Empty minidump, this process did not crash. Just remove the file.
|
| r = base::DeleteFile(minidump_path, false);
|
| @@ -142,7 +157,17 @@ void CrashDumpManager::Observe(int type,
|
| case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
|
| content::RenderProcessHost* rph =
|
| content::Source<content::RenderProcessHost>(source).ptr();
|
| - OnChildExit(rph->GetID(), rph->GetHandle());
|
| + content::RenderProcessHost::RendererClosedDetails* process_details =
|
| + content::Details<content::RenderProcessHost::RendererClosedDetails>(
|
| + details).ptr();
|
| + if (process_details->status == base::TERMINATION_STATUS_OOM_PROTECTED &&
|
| + base::android::ApplicationStatusListener::HasRunningActivities()) {
|
| + OnChildExit(rph->GetID(),
|
| + rph->GetHandle(),
|
| + /* recordExitStatus */ true);
|
| + } else {
|
| + OnChildExit(rph->GetID(), rph->GetHandle());
|
| + }
|
| break;
|
| }
|
| default:
|
| @@ -153,6 +178,12 @@ void CrashDumpManager::Observe(int type,
|
|
|
| void CrashDumpManager::OnChildExit(int child_process_id,
|
| base::ProcessHandle pid) {
|
| + OnChildExit(child_process_id, pid, /* recordExitStatus */ false);
|
| +}
|
| +
|
| +void CrashDumpManager::OnChildExit(int child_process_id,
|
| + base::ProcessHandle pid,
|
| + bool recordExitStatus) {
|
| base::FilePath minidump_path;
|
| {
|
| base::AutoLock auto_lock(child_process_id_to_minidump_path_lock_);
|
| @@ -168,7 +199,10 @@ void CrashDumpManager::OnChildExit(int child_process_id,
|
| }
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, pid));
|
| + base::Bind(&CrashDumpManager::ProcessMinidump,
|
| + minidump_path,
|
| + pid,
|
| + recordExitStatus));
|
| }
|
|
|
| } // namespace breakpad
|
|
|