Index: chrome/tools/crash_service/crash_service.cc |
=================================================================== |
--- chrome/tools/crash_service/crash_service.cc (revision 150982) |
+++ chrome/tools/crash_service/crash_service.cc (working copy) |
@@ -14,6 +14,7 @@ |
#include "base/file_util.h" |
#include "base/logging.h" |
#include "base/path_service.h" |
+#include "base/string_number_conversions.h" |
#include "base/win/windows_version.h" |
#include "breakpad/src/client/windows/crash_generation/client_info.h" |
#include "breakpad/src/client/windows/crash_generation/crash_generation_server.h" |
@@ -146,12 +147,15 @@ |
} // namespace |
// Command line switches: |
-const char CrashService::kMaxReports[] = "max-reports"; |
-const char CrashService::kNoWindow[] = "no-window"; |
-const char CrashService::kReporterTag[] = "reporter"; |
-const char CrashService::kDumpsDir[] = "dumps-dir"; |
-const char CrashService::kPipeName[] = "pipe-name"; |
+const char CrashService::kMaxReports[] = "max-reports"; |
+const char CrashService::kNoWindow[] = "no-window"; |
+const char CrashService::kReporterTag[] = "reporter"; |
+const char CrashService::kDumpsDir[] = "dumps-dir"; |
+const char CrashService::kPipeName[] = "pipe-name"; |
+const char CrashService::kArchiveDumpsByPid[] = "archive-dumps-by-pid"; |
+bool CrashService::archive_dumps_by_pid_ = false; |
+ |
CrashService::CrashService(const std::wstring& report_dir) |
: report_path_(report_dir), |
sender_(NULL), |
@@ -203,6 +207,9 @@ |
} |
} |
+ if (cmd_line.HasSwitch(kArchiveDumpsByPid)) |
+ archive_dumps_by_pid_ = true; |
+ |
// We can override the send reports quota with a command line switch. |
if (cmd_line.HasSwitch(kMaxReports)) |
max_reports = _wtoi(cmd_line.GetSwitchValueNative(kMaxReports).c_str()); |
@@ -371,12 +378,23 @@ |
LOG(ERROR) << "could not write custom info file"; |
} |
+ // Move dump file to the directory under client pid. |
+ FilePath dump_path = FilePath(*file_path); |
+ if (archive_dumps_by_pid_) { |
+ FilePath dump_path_with_pid(dump_path.DirName()); |
+ dump_path_with_pid = dump_path_with_pid.Append(base::Int64ToString16(pid)); |
+ file_util::CreateDirectoryW(dump_path_with_pid); |
+ dump_path_with_pid = dump_path_with_pid.Append(dump_path.BaseName()); |
+ file_util::Move(dump_path, dump_path_with_pid); |
+ } |
+ |
if (!self->sender_) |
return; |
// Send the crash dump using a worker thread. This operation has retry |
// logic in case there is no internet connection at the time. |
- DumpJobInfo* dump_job = new DumpJobInfo(pid, self, map, *file_path); |
+ DumpJobInfo* dump_job = new DumpJobInfo(pid, self, map, |
+ dump_path.value()); |
if (!::QueueUserWorkItem(&CrashService::AsyncSendDump, |
dump_job, WT_EXECUTELONGFUNCTION)) { |
LOG(ERROR) << "could not queue job"; |