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

Unified Diff: base/debug/crash_logging.h

Issue 11761030: Create the crash key registration system and register some Mac-specific keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 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
Index: base/debug/crash_logging.h
diff --git a/base/debug/crash_logging.h b/base/debug/crash_logging.h
index c39c41d0363a1954e45984d213f8d2930a5c9103..c41eff869f7707e2f1ae83ad8126ef9d507ac60f 100644
--- a/base/debug/crash_logging.h
+++ b/base/debug/crash_logging.h
@@ -51,6 +51,30 @@ class BASE_EXPORT ScopedCrashKey {
DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey);
};
+// Before setting values for a key, all the keys must be registered.
+struct BASE_EXPORT CrashKey {
+ // The name of the crash key, used in the above functions.
+ const char* const key_name;
+
+ // For values longer than max_length, the value can be chunked into values
+ // named "key_name-1", "key_name-2", etc. This is the maximum number of
+ // numbered chunks to use before the value is truncated.
+ size_t num_chunks;
+
+ // The maximum length of a single chunk. Truncation happens if the value is
+ // greater than |num_chunks * max_length|.
+ size_t max_length;
+};
+
+// Before the crash key logging mechanism can be used, all crash keys must be
+// registered with this function. The function returns the amount of space
+// the crash reporting implementation should allocate space for the registered
+// crash keys.
+BASE_EXPORT size_t InitCrashKeys(const CrashKey* const keys, size_t count);
+
+// Returns the correspnding crash key object or NULL for a given key.
+BASE_EXPORT const CrashKey* LookupCrashKey(const base::StringPiece& key);
+
typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&,
const base::StringPiece&);
typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&);
@@ -61,6 +85,14 @@ BASE_EXPORT void SetCrashKeyReportingFunctions(
SetCrashKeyValueFuncT set_key_func,
ClearCrashKeyValueFuncT clear_key_func);
+// Helper function that breaks up a value according to the parameters
+// specified by the crash key object.
+BASE_EXPORT std::vector<std::string> ChunkCrashKeyValue(
+ const CrashKey& crash_key, const base::StringPiece& value);
+
+// Resets the crash key system so it can be reinitialized. For testing only.
+BASE_EXPORT void ResetCrashLoggingForTesting();
+
} // namespace debug
} // namespace base
« no previous file with comments | « base/base.gyp ('k') | base/debug/crash_logging.cc » ('j') | base/debug/crash_logging.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698