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

Unified Diff: components/crash/content/app/breakpad_linux.cc

Issue 1582403004: Linux: Send the product channel to non-browser processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content_browsertests linking Created 4 years, 11 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
« components/crash.gypi ('K') | « components/crash.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crash/content/app/breakpad_linux.cc
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc
index 3435f0487a5482d395c227ccf971743794ceabd7..aab3a98a555b9220ebcaa9484d2fd21d59959463 100644
--- a/components/crash/content/app/breakpad_linux.cc
+++ b/components/crash/content/app/breakpad_linux.cc
@@ -37,6 +37,7 @@
#include "base/posix/eintr_wrapper.h"
#include "base/posix/global_descriptors.h"
#include "base/process/memory.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_checker.h"
#include "breakpad/src/client/linux/crash_generation/crash_generation_client.h"
@@ -223,11 +224,37 @@ size_t LengthWithoutTrailingSpaces(const char* str, size_t len) {
return len;
}
-void SetClientIdFromCommandLine(const base::CommandLine& command_line) {
- // Get the guid from the command line switch.
+bool GetEnableCrashReporterSwitchParts(const base::CommandLine& command_line,
+ std::vector<std::string>* switch_parts) {
std::string switch_value =
command_line.GetSwitchValueASCII(switches::kEnableCrashReporter);
- GetCrashReporterClient()->SetCrashReporterClientIdFromGUID(switch_value);
+ std::vector<std::string> parts = base::SplitString(switch_value,
+ ",",
+ base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_ALL);
+ if (parts.size() != 2)
+ return false;
+
+ *switch_parts = parts;
+ return true;
+}
+
+#if !defined(OS_ANDROID)
+void SetChannelFromCommandLine(const base::CommandLine& command_line) {
+ std::vector<std::string> switch_parts;
+ if (!GetEnableCrashReporterSwitchParts(command_line, &switch_parts))
+ return;
+
+ base::debug::SetCrashKeyValue(crash_keys::kChannel, switch_parts[1]);
+}
+#endif
+
+void SetClientIdFromCommandLine(const base::CommandLine& command_line) {
+ std::vector<std::string> switch_parts;
+ if (!GetEnableCrashReporterSwitchParts(command_line, &switch_parts))
+ return;
+
+ GetCrashReporterClient()->SetCrashReporterClientIdFromGUID(switch_parts[0]);
}
// MIME substrings.
@@ -1827,7 +1854,9 @@ void InitCrashReporter(const std::string& process_type) {
// simplicity.
if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter))
return;
+
InitCrashKeys();
+ SetChannelFromCommandLine(parsed_command_line);
SetClientIdFromCommandLine(parsed_command_line);
EnableNonBrowserCrashDumping();
VLOG(1) << "Non Browser crash dumping enabled for: " << process_type;
« components/crash.gypi ('K') | « components/crash.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698