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" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #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.
| |
| 12 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 13 | 14 |
| 14 // These functions add metadata to the upload payload when sending crash reports | 15 // These functions add metadata to the upload payload when sending crash reports |
| 15 // to the crash server. | 16 // to the crash server. |
| 16 // | 17 // |
| 17 // IMPORTANT: On OS X and Linux, the key/value pairs are only sent as part of | 18 // IMPORTANT: On OS X and Linux, the key/value pairs are only sent as part of |
| 18 // the upload and are not included in the minidump! | 19 // the upload and are not included in the minidump! |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 namespace debug { | 22 namespace debug { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 44 public: | 45 public: |
| 45 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); | 46 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); |
| 46 ~ScopedCrashKey(); | 47 ~ScopedCrashKey(); |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 std::string key_; | 50 std::string key_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); | 52 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); |
| 52 }; | 53 }; |
| 53 | 54 |
| 55 // Before setting values for a key, all the keys must be registered. | |
| 56 struct BASE_EXPORT CrashKey { | |
| 57 // The name of the crash key, used in the above functions. | |
| 58 const char* const key_name; | |
| 59 | |
| 60 // For values longer than max_length, the value can be chunked into values | |
| 61 // named "key_name-1", "key_name-2", etc. This is the maximum number of | |
| 62 // numbered chunks to use before the value is truncated. | |
| 63 size_t num_chunks; | |
| 64 | |
| 65 // The maximum length of a single chunk. Truncation happens if the value is | |
| 66 // greater than |num_chunks * max_length|. | |
| 67 size_t max_length; | |
| 68 }; | |
| 69 | |
| 70 // Before the crash key logging mechanism can be used, all crash keys must be | |
| 71 // registered with this function. The crash reporting implementation should | |
| 72 // allocate space for exactly |out_key_storage_size| crash keys. | |
| 73 BASE_EXPORT void InitCrashKeys(const CrashKey* const keys, size_t count, | |
| 74 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
| |
| 75 | |
| 76 // Returns the correspnding crash key object or NULL for a given key. | |
| 77 BASE_EXPORT const CrashKey* LookupCrashKey(const base::StringPiece& key); | |
| 78 | |
| 54 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, | 79 typedef void (*SetCrashKeyValueFuncT)(const base::StringPiece&, |
| 55 const base::StringPiece&); | 80 const base::StringPiece&); |
| 56 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); | 81 typedef void (*ClearCrashKeyValueFuncT)(const base::StringPiece&); |
| 57 | 82 |
| 58 // Sets the function pointers that are used to integrate with the platform- | 83 // Sets the function pointers that are used to integrate with the platform- |
| 59 // specific crash reporting libraries. | 84 // specific crash reporting libraries. |
| 60 BASE_EXPORT void SetCrashKeyReportingFunctions( | 85 BASE_EXPORT void SetCrashKeyReportingFunctions( |
| 61 SetCrashKeyValueFuncT set_key_func, | 86 SetCrashKeyValueFuncT set_key_func, |
| 62 ClearCrashKeyValueFuncT clear_key_func); | 87 ClearCrashKeyValueFuncT clear_key_func); |
| 63 | 88 |
| 89 // Helper function that breaks up a value according to the parameters | |
| 90 // specified by the crash key object. | |
| 91 BASE_EXPORT std::vector<std::string> ChunkCrashKeyValue( | |
| 92 const CrashKey& crash_key, const base::StringPiece& value); | |
| 93 | |
| 94 // Resets the crash key system so it can be reinitialized. For testing only. | |
| 95 BASE_EXPORT void ResetCrashLoggingForTesting(); | |
| 96 | |
| 64 } // namespace debug | 97 } // namespace debug |
| 65 } // namespace base | 98 } // namespace base |
| 66 | 99 |
| 67 #endif // BASE_DEBUG_CRASH_LOGGING_H_ | 100 #endif // BASE_DEBUG_CRASH_LOGGING_H_ |
| OLD | NEW |