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..58c6ab05a7c6d48bfc5ded12ce737c8393e0963f 100644 |
| --- a/base/debug/crash_logging.h |
| +++ b/base/debug/crash_logging.h |
| @@ -51,6 +51,33 @@ 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; |
| +}; |
| + |
| +typedef void (*InitCrashKeysCallbackFuncT)(const std::vector<std::string>&); |
|
Scott Hess - ex-Googler
2013/01/04 18:59:39
I don't understand why this is present. Is the ca
Robert Sesek
2013/01/04 19:25:38
Windows needs to know the amount of storage to res
|
| + |
| +// Before the crash key logging mechanism can be used, all crash keys must be |
| +// registered with this function. The callback is run after the system is |
| +// initialized, and it is passed a list of all the potential registered keys |
| +// (in the chunk naming convention). |
| +BASE_EXPORT void InitCrashKeys(const CrashKey* const keys, size_t count, |
| + InitCrashKeysCallbackFuncT completion_callback); |
| + |
| +// 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 +88,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 |