| Index: chrome/browser/android/crash_dump_manager.cc
|
| diff --git a/chrome/browser/android/crash_dump_manager.cc b/chrome/browser/android/crash_dump_manager.cc
|
| index fa85fd3f560892bb45820551b0d18080a5d1e3ab..91b234cf5ac63575cd588423f5a3d63136cb9ab6 100644
|
| --- a/chrome/browser/android/crash_dump_manager.cc
|
| +++ b/chrome/browser/android/crash_dump_manager.cc
|
| @@ -45,16 +45,14 @@ CrashDumpManager::CrashDumpManager() {
|
| notification_registrar_.Add(this,
|
| content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
|
| content::NotificationService::AllSources());
|
| - notification_registrar_.Add(this,
|
| - content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED,
|
| - content::NotificationService::AllSources());
|
| - notification_registrar_.Add(this,
|
| - content::NOTIFICATION_CHILD_PROCESS_CRASHED,
|
| - content::NotificationService::AllSources());
|
| +
|
| + BrowserChildProcessObserver::Add(this);
|
| }
|
|
|
| CrashDumpManager::~CrashDumpManager() {
|
| instance_ = NULL;
|
| +
|
| + BrowserChildProcessObserver::Remove(this);
|
| }
|
|
|
| int CrashDumpManager::CreateMinidumpFile(int child_process_id) {
|
| @@ -83,6 +81,16 @@ int CrashDumpManager::CreateMinidumpFile(int child_process_id) {
|
| return minidump_file;
|
| }
|
|
|
| +void CrashDumpManager::BrowserChildProcessHostDisconnected(
|
| + const content::ChildProcessData& data) {
|
| + OnChildExit(data.id, data.handle);
|
| +}
|
| +
|
| +void CrashDumpManager::BrowserChildProcessCrashed(
|
| + const content::ChildProcessData& data) {
|
| + OnChildExit(data.id, data.handle);
|
| +}
|
| +
|
| void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path,
|
| base::ProcessHandle pid) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| @@ -127,8 +135,6 @@ void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path,
|
| void CrashDumpManager::Observe(int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| - int child_process_id;
|
| - base::ProcessHandle pid;
|
| switch (type) {
|
| case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED:
|
| // NOTIFICATION_RENDERER_PROCESS_TERMINATED is sent when the renderer
|
| @@ -137,22 +143,17 @@ void CrashDumpManager::Observe(int type,
|
| case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
|
| content::RenderProcessHost* rph =
|
| content::Source<content::RenderProcessHost>(source).ptr();
|
| - child_process_id = rph->GetID();
|
| - pid = rph->GetHandle();
|
| - break;
|
| - }
|
| - case content::NOTIFICATION_CHILD_PROCESS_CRASHED:
|
| - case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: {
|
| - content::ChildProcessData* child_process_data =
|
| - content::Details<content::ChildProcessData>(details).ptr();
|
| - child_process_id = child_process_data->id;
|
| - pid = child_process_data->handle;
|
| + OnChildExit(rph->GetID(), rph->GetHandle());
|
| break;
|
| }
|
| default:
|
| NOTREACHED();
|
| return;
|
| }
|
| +}
|
| +
|
| +void CrashDumpManager::OnChildExit(int child_process_id,
|
| + base::ProcessHandle pid) {
|
| base::FilePath minidump_path;
|
| {
|
| base::AutoLock auto_lock(child_process_id_to_minidump_path_lock_);
|
|
|