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

Unified Diff: components/crash/core/common/crash_keys.h

Issue 1481933002: Move crash keys for command-line switches to components/crash so they can be set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@installer_crash_keys
Patch Set: Created 5 years, 1 month 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
Index: components/crash/core/common/crash_keys.h
diff --git a/components/crash/core/common/crash_keys.h b/components/crash/core/common/crash_keys.h
index 70b77ae1165a3ddb3209300e7fc6cf52d8b56dc9..dfa4b27ef74d6d12b6ec40ab40b7a097daa24a9c 100644
--- a/components/crash/core/common/crash_keys.h
+++ b/components/crash/core/common/crash_keys.h
@@ -8,8 +8,14 @@
#include <string>
#include <vector>
+#include "base/callback_forward.h"
+#include "base/debug/crash_logging.h"
#include "build/build_config.h"
+namespace base {
+class CommandLine;
+} // namespace base
+
namespace crash_keys {
// Sets the ID (which may either be a full GUID or a GUID that was already
@@ -21,6 +27,18 @@ void ClearMetricsClientId();
// Sets the list of active experiment/variations info.
void SetVariationsList(const std::vector<std::string>& variations);
+// Adds a common set of crash keys for holding command-line switches to |keys|.
+void GetCrashKeysForCommandLineSwitches(
+ std::vector<base::debug::CrashKey>* keys);
+
+// Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
+void SetSwitchesFromCommandLine(const base::CommandLine& command_line);
grt (UTC plus 2) 2015/11/27 18:51:21 rather than overloading the function, i think it's
Joe Mason 2015/11/27 21:16:47 Done.
+
+// Sets the kSwitch and kNumSwitches keys based on the given |command_line|.
+// Ignore any switch for which |skip_filter| returns true.
+void SetSwitchesFromCommandLine(const base::CommandLine& command_line,
+ const base::Callback<bool(const std::string &)>& skip_filter);
grt (UTC plus 2) 2015/11/27 18:51:21 callback seems like overkill. how about starting w
Joe Mason 2015/11/27 21:16:47 Done.
+
// Crash Key Constants /////////////////////////////////////////////////////////
// kChunkMaxLength is the platform-specific maximum size that a value in a
@@ -68,6 +86,14 @@ extern const char kNumVariations[];
// typically set by SetExperimentList.
extern const char kVariations[];
+// Process command line switches. |kSwitch| should be formatted with an integer,
+// in the range [1, kSwitchesMaxCount].
+const size_t kSwitchesMaxCount = 15;
+extern const char kSwitch[];
grt (UTC plus 2) 2015/11/27 18:51:21 may as well document this for what it is: // A pri
Joe Mason 2015/11/27 21:16:47 Done.
+// The total number of switches, used to report the total in case more than
grt (UTC plus 2) 2015/11/27 18:51:21 nit: blank line before comment
Joe Mason 2015/11/27 21:16:47 Done.
+// |kSwitchesMaxCount| are present.
+extern const char kNumSwitches[];
+
// Used to help investigate bug 464926.
extern const char kBug464926CrashKey[];

Powered by Google App Engine
This is Rietveld 408576698