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..58e0dd6d96946e35408c61186fcd1a8a294f4de8 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()); |
+ |
+ StartObservingBrowserChildProcesses(); |
} |
CrashDumpManager::~CrashDumpManager() { |
instance_ = NULL; |
+ |
+ StopObservingBrowserChildProcesses(); |
} |
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_); |