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

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: typedef -> using, %lu -> PRIuS 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
« no previous file with comments | « components/crash/core/common/BUILD.gn ('k') | components/crash/core/common/crash_keys.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b1ad64b0c9dfd99a69291fab2b0bb1b32320d9d6 100644
--- a/components/crash/core/common/crash_keys.h
+++ b/components/crash/core/common/crash_keys.h
@@ -8,8 +8,13 @@
#include <string>
#include <vector>
+#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 +26,20 @@ 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);
+
+// A function returning true if |flag| is a switch that should be filtered out
+// of crash keys.
+using SwitchFilterFunction = bool (*)(const std::string& flag);
+
+// Sets the kNumSwitches key and a set of keys named using kSwitchFormat based
+// on the given |command_line|. If |skip_filter| is not null, ignore any switch
+// for which it returns true.
+void SetSwitchesFromCommandLine(const base::CommandLine& command_line,
+ SwitchFilterFunction skip_filter);
+
// Crash Key Constants /////////////////////////////////////////////////////////
// kChunkMaxLength is the platform-specific maximum size that a value in a
@@ -68,6 +87,18 @@ extern const char kNumVariations[];
// typically set by SetExperimentList.
extern const char kVariations[];
+// The maximum number of command line switches to process. |kSwitchFormat|
+// should be formatted with an integer in the range [1, kSwitchesMaxCount].
+const size_t kSwitchesMaxCount = 15;
+
+// A printf-style format string naming the set of crash keys corresponding to
+// at most |kSwitchesMaxCount| command line switches.
+extern const char kSwitchFormat[];
+
+// The total number of switches, used to report the total in case more than
+// |kSwitchesMaxCount| are present.
+extern const char kNumSwitches[];
+
// Used to help investigate bug 464926.
extern const char kBug464926CrashKey[];
« no previous file with comments | « components/crash/core/common/BUILD.gn ('k') | components/crash/core/common/crash_keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698