| 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 // Before the crash key logging mechanism can be used, all crash keys must be | 
|  | 70 // registered with this function. The function returns the amount of space | 
|  | 71 // the crash reporting implementation should allocate space for the registered | 
|  | 72 // crash keys. | 
|  | 73 BASE_EXPORT size_t InitCrashKeys(const CrashKey* const keys, size_t count); | 
|  | 74 | 
|  | 75 // Returns the correspnding crash key object or NULL for a given key. | 
|  | 76 BASE_EXPORT const CrashKey* LookupCrashKey(const base::StringPiece& key); | 
|  | 77 | 
| 54 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, | 78 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, | 
| 55                                       const base::StringPiece&); | 79                                       const base::StringPiece&); | 
| 56 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); | 80 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); | 
| 57 | 81 | 
| 58 // Sets the function pointers that are used to integrate with the platform- | 82 // Sets the function pointers that are used to integrate with the platform- | 
| 59 // specific crash reporting libraries. | 83 // specific crash reporting libraries. | 
| 60 BASE_EXPORT void SetCrashKeyReportingFunctions( | 84 BASE_EXPORT void SetCrashKeyReportingFunctions( | 
| 61     SetCrashKeyValueFuncT set_key_func, | 85     SetCrashKeyValueFuncT set_key_func, | 
| 62     ClearCrashKeyValueFuncT clear_key_func); | 86     ClearCrashKeyValueFuncT clear_key_func); | 
| 63 | 87 | 
|  | 88 // Helper function that breaks up a value according to the parameters | 
|  | 89 // specified by the crash key object. | 
|  | 90 BASE_EXPORT std::vector<std::string> ChunkCrashKeyValue( | 
|  | 91     const CrashKey& crash_key, const base::StringPiece& value); | 
|  | 92 | 
|  | 93 // Resets the crash key system so it can be reinitialized. For testing only. | 
|  | 94 BASE_EXPORT void ResetCrashLoggingForTesting(); | 
|  | 95 | 
| 64 }  // namespace debug | 96 }  // namespace debug | 
| 65 }  // namespace base | 97 }  // namespace base | 
| 66 | 98 | 
| 67 #endif  // BASE_DEBUG_CRASH_LOGGING_H_ | 99 #endif  // BASE_DEBUG_CRASH_LOGGING_H_ | 
| OLD | NEW | 
|---|