Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2325)

Unified Diff: chrome/tools/crash_service/crash_service.cc

Issue 7538036: Windows Breakpad: Allow the crash dump dir and pipe name to be overridden (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix to use W version of GetEnvironmentVariable Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/tools/crash_service/crash_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/crash_service/crash_service.cc
diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc
index ed311070389804bec1f9b104a27e0e0fca5b8a07..660a8882c716fd04baf6b537c4848928a4e604f2 100644
--- a/chrome/tools/crash_service/crash_service.cc
+++ b/chrome/tools/crash_service/crash_service.cc
@@ -149,6 +149,8 @@ struct DumpJobInfo {
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";
CrashService::CrashService(const std::wstring& report_dir)
: report_path_(report_dir),
@@ -172,7 +174,7 @@ bool CrashService::Initialize(const std::wstring& command_line) {
using google_breakpad::CrashReportSender;
using google_breakpad::CrashGenerationServer;
- const wchar_t* pipe_name = kTestPipeName;
+ std::wstring pipe_name = kTestPipeName;
int max_reports = -1;
// The checkpoint file allows CrashReportSender to enforce the the maximum
@@ -189,18 +191,26 @@ bool CrashService::Initialize(const std::wstring& command_line) {
}
report_path_ = user_data_dir.Append(chrome::kCrashReportLog);
+ CommandLine cmd_line = CommandLine::FromString(command_line);
+
FilePath dumps_path;
- if (!PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path)) {
- LOG(ERROR) << "could not get DIR_CRASH_DUMPS";
- return false;
+ if (cmd_line.HasSwitch(kDumpsDir)) {
+ dumps_path = FilePath(cmd_line.GetSwitchValueNative(kDumpsDir));
+ } else {
+ if (!PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path)) {
+ LOG(ERROR) << "could not get DIR_CRASH_DUMPS";
+ return false;
+ }
}
- CommandLine cmd_line = CommandLine::FromString(command_line);
-
// 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());
+ // Allow the global pipe name to be overridden for better testability.
+ if (cmd_line.HasSwitch(kPipeName))
+ pipe_name = cmd_line.GetSwitchValueNative(kPipeName);
+
if (max_reports > 0) {
// Create the http sender object.
sender_ = new CrashReportSender(checkpoint_path.value());
« no previous file with comments | « chrome/tools/crash_service/crash_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698