Chromium Code Reviews| Index: base/debug/crash_logging.h |
| diff --git a/base/debug/crash_logging.h b/base/debug/crash_logging.h |
| index c39c41d0363a1954e45984d213f8d2930a5c9103..28ccf497413510047cb0da68bdeba1051e7cf190 100644 |
| --- a/base/debug/crash_logging.h |
| +++ b/base/debug/crash_logging.h |
| @@ -9,6 +9,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| +#include "base/callback.h" |
|
Scott Hess - ex-Googler
2013/01/08 00:34:37
I assume this was here for using base::Callback, w
Robert Sesek
2013/01/08 00:56:23
Done.
|
| #include "base/string_piece.h" |
| // These functions add metadata to the upload payload when sending crash reports |
| @@ -51,6 +52,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 crash reporting implementation should |
| +// allocate space for exactly |out_key_storage_size| crash keys. |
| +BASE_EXPORT void InitCrashKeys(const CrashKey* const keys, size_t count, |
| + size_t* out_key_storage_size); |
|
Scott Hess - ex-Googler
2013/01/08 00:34:37
I guess there must be something I'm missing, here.
Robert Sesek
2013/01/08 00:56:23
My assumption is that when the caller registers th
Scott Hess - ex-Googler
2013/01/08 01:06:06
I think you're over-analyzing. Mostly, I'm thinki
|
| + |
| +// 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 +86,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 |