Index: components/crash/content/browser/crash_dump_manager_android.h |
diff --git a/components/crash/content/browser/crash_dump_manager_android.h b/components/crash/content/browser/crash_dump_manager_android.h |
index 7ba75cee4cfaef587fb104cdc2ce3891e1bc562d..0ac2c7ac3843273579ed86cbd8e4f8176933a040 100644 |
--- a/components/crash/content/browser/crash_dump_manager_android.h |
+++ b/components/crash/content/browser/crash_dump_manager_android.h |
@@ -7,17 +7,9 @@ |
#include <map> |
-#include "base/android/application_status_listener.h" |
-#include "base/files/file.h" |
#include "base/files/file_path.h" |
-#include "base/macros.h" |
-#include "base/process/kill.h" |
-#include "base/process/process.h" |
#include "base/synchronization/lock.h" |
-#include "content/public/browser/browser_child_process_observer.h" |
-#include "content/public/browser/notification_observer.h" |
-#include "content/public/browser/notification_registrar.h" |
-#include "content/public/common/process_type.h" |
+#include "components/crash/content/browser/crash_dump_observer_android.h" |
namespace breakpad { |
@@ -27,23 +19,23 @@ namespace breakpad { |
// (as the browser process does not have access to some system files for the |
// crashed process). So the minidump is generated in the renderer process. |
// Since the isolated process cannot open files, we provide it on creation with |
-// a file descriptor where to write the minidump in the event of a crash. |
+// a file descriptor into which to write the minidump in the event of a crash. |
// This class creates these file descriptors and associates them with render |
-// processes and take the appropriate action when the render process terminates. |
-class CrashDumpManager : public content::BrowserChildProcessObserver, |
- public content::NotificationObserver { |
+// processes and takes the appropriate action when the render process |
+// terminates. |
+class CrashDumpManager : public breakpad::CrashDumpObserver::Client { |
public: |
- // The embedder should create a single instance of the CrashDumpManager. |
- static CrashDumpManager* GetInstance(); |
- |
- // Should be created on the UI thread. |
- explicit CrashDumpManager(const base::FilePath& crash_dump_dir); |
- |
+ CrashDumpManager(const base::FilePath& crash_dump_dir, int descriptor_id); |
~CrashDumpManager() override; |
- // Returns a file that should be used to generate a minidump for the process |
- // |child_process_id|. |
- base::File CreateMinidumpFile(int child_process_id); |
+ // breakpad::CrashDumpObserver::Client implementation: |
+ void OnChildStart(int child_process_id, |
+ content::FileDescriptorInfo* mappings) override; |
+ void OnChildExit(int child_process_id, |
+ base::ProcessHandle pid, |
+ content::ProcessType process_type, |
+ base::TerminationStatus termination_status, |
+ base::android::ApplicationState app_state) override; |
private: |
typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath; |
@@ -60,41 +52,23 @@ class CrashDumpManager : public content::BrowserChildProcessObserver, |
MINIDUMP_STATUS_COUNT |
}; |
- static void ProcessMinidump(const base::FilePath& minidump_path, |
- base::ProcessHandle pid, |
- content::ProcessType process_type, |
- base::TerminationStatus termination_status, |
- base::android::ApplicationState app_state); |
- |
- // content::BrowserChildProcessObserver implementation: |
- void BrowserChildProcessHostDisconnected( |
- const content::ChildProcessData& data) override; |
- void BrowserChildProcessCrashed( |
- const content::ChildProcessData& data, |
- int exit_code) override; |
- |
- // NotificationObserver implementation: |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override; |
- |
- // Called on child process exit (including crash). |
- void OnChildExit(int child_process_id, |
- base::ProcessHandle pid, |
- content::ProcessType process_type, |
- base::TerminationStatus termination_status, |
- base::android::ApplicationState app_state); |
- |
- content::NotificationRegistrar notification_registrar_; |
+ void ProcessMinidump(const base::FilePath& minidump_path, |
+ base::ProcessHandle pid, |
+ content::ProcessType process_type, |
+ base::TerminationStatus termination_status, |
+ base::android::ApplicationState app_state); |
// This map should only be accessed with its lock aquired as it is accessed |
// from the PROCESS_LAUNCHER and UI threads. |
base::Lock child_process_id_to_minidump_path_lock_; |
ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_; |
+ // The directory in which temporary minidump files should be created. |
base::FilePath crash_dump_dir_; |
- static CrashDumpManager* instance_; |
+ // The id used to identify the file descriptor in the set of file |
+ // descriptor mappings passed to the child process. |
+ int descriptor_id_; |
DISALLOW_COPY_AND_ASSIGN(CrashDumpManager); |
}; |