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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 public: | 48 public: |
| 49 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); | 49 ScopedCrashKey(const base::StringPiece& key, const base::StringPiece& value); |
| 50 ~ScopedCrashKey(); | 50 ~ScopedCrashKey(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 std::string key_; | 53 std::string key_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); | 55 DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 #define ScopedCrashKey(x) static_assert(false, "a scoped crash key has no name") | |
|
dcheng
2016/07/11 01:42:44
I'll think of a better error if people think this
ncarter (slow)
2016/07/11 17:08:12
How does this work with only one arg?
dcheng
2016/07/12 01:23:38
I've updated this to add the appropriate number of
| |
| 59 | |
| 58 // Before setting values for a key, all the keys must be registered. | 60 // Before setting values for a key, all the keys must be registered. |
| 59 struct BASE_EXPORT CrashKey { | 61 struct BASE_EXPORT CrashKey { |
| 60 // The name of the crash key, used in the above functions. | 62 // The name of the crash key, used in the above functions. |
| 61 const char* key_name; | 63 const char* key_name; |
| 62 | 64 |
| 63 // The maximum length for a value. If the value is longer than this, it will | 65 // The maximum length for a value. If the value is longer than this, it will |
| 64 // be truncated. If the value is larger than the |chunk_max_length| passed to | 66 // be truncated. If the value is larger than the |chunk_max_length| passed to |
| 65 // InitCrashKeys() but less than this value, it will be split into multiple | 67 // InitCrashKeys() but less than this value, it will be split into multiple |
| 66 // numbered chunks. | 68 // numbered chunks. |
| 67 size_t max_length; | 69 size_t max_length; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 97 const base::StringPiece& value, | 99 const base::StringPiece& value, |
| 98 size_t chunk_max_length); | 100 size_t chunk_max_length); |
| 99 | 101 |
| 100 // Resets the crash key system so it can be reinitialized. For testing only. | 102 // Resets the crash key system so it can be reinitialized. For testing only. |
| 101 BASE_EXPORT void ResetCrashLoggingForTesting(); | 103 BASE_EXPORT void ResetCrashLoggingForTesting(); |
| 102 | 104 |
| 103 } // namespace debug | 105 } // namespace debug |
| 104 } // namespace base | 106 } // namespace base |
| 105 | 107 |
| 106 #endif // BASE_DEBUG_CRASH_LOGGING_H_ | 108 #endif // BASE_DEBUG_CRASH_LOGGING_H_ |
| OLD | NEW |