Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_DEBUG_CRASH_LOGGING_H_ | 5 #ifndef BASE_DEBUG_CRASH_LOGGING_H_ |
| 6 #define BASE_DEBUG_CRASH_LOGGING_H_ | 6 #define BASE_DEBUG_CRASH_LOGGING_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 public: | 44 public: |
| 45 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); | 45 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); |
| 46 ~ScopedCrashKey(); | 46 ~ScopedCrashKey(); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 std::string key_; | 49 std::string key_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); | 51 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Before setting values for a key, all the keys must be registered. | |
| 55 struct BASE_EXPORT CrashKey { | |
| 56 // The name of the crash key, used in the above functions. | |
| 57 const char* const key_name; | |
| 58 | |
| 59 // For values longer than max_length, the value can be chunked into values | |
| 60 // named "key_name-1", "key_name-2", etc. This is the maximum number of | |
| 61 // numbered chunks to use before the value is truncated. | |
| 62 size_t num_chunks; | |
| 63 | |
| 64 // The maximum length of a single chunk. Truncation happens if the value is | |
| 65 // greater than |num_chunks * max_length|. | |
| 66 size_t max_length; | |
| 67 }; | |
| 68 | |
| 69 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
| |
| 70 | |
| 71 // Before the crash key logging mechanism can be used, all crash keys must be | |
| 72 // registered with this function. The callback is run after the system is | |
| 73 // initialized, and it is passed a list of all the potential registered keys | |
| 74 // (in the chunk naming convention). | |
| 75 BASE_EXPORT void InitCrashKeys(const CrashKey* const keys, size_t count, | |
| 76 InitCrashKeysCallbackFuncT completion_callback); | |
| 77 | |
| 78 // Returns the correspnding crash key object or NULL for a given key. | |
| 79 BASE_EXPORT const CrashKey* LookupCrashKey(const base::StringPiece& key); | |
| 80 | |
| 54 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, | 81 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, |
| 55 const base::StringPiece&); | 82 const base::StringPiece&); |
| 56 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); | 83 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); |
| 57 | 84 |
| 58 // Sets the function pointers that are used to integrate with the platform- | 85 // Sets the function pointers that are used to integrate with the platform- |
| 59 // specific crash reporting libraries. | 86 // specific crash reporting libraries. |
| 60 BASE_EXPORT void SetCrashKeyReportingFunctions( | 87 BASE_EXPORT void SetCrashKeyReportingFunctions( |
| 61 SetCrashKeyValueFuncT set_key_func, | 88 SetCrashKeyValueFuncT set_key_func, |
| 62 ClearCrashKeyValueFuncT clear_key_func); | 89 ClearCrashKeyValueFuncT clear_key_func); |
| 63 | 90 |
| 91 // Helper function that breaks up a value according to the parameters | |
| 92 // specified by the crash key object. | |
| 93 BASE_EXPORT std::vector<std::string> ChunkCrashKeyValue( | |
| 94 const CrashKey& crash_key, const base::StringPiece& value); | |
| 95 | |
| 96 // Resets the crash key system so it can be reinitialized. For testing only. | |
| 97 BASE_EXPORT void ResetCrashLoggingForTesting(); | |
| 98 | |
| 64 } // namespace debug | 99 } // namespace debug |
| 65 } // namespace base | 100 } // namespace base |
| 66 | 101 |
| 67 #endif // BASE_DEBUG_CRASH_LOGGING_H_ | 102 #endif // BASE_DEBUG_CRASH_LOGGING_H_ |
| OLD | NEW |