| 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 #include "base/debug/crash_logging.h" | 5 #include "base/debug/crash_logging.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 void SetCrashKeyValue(const base::StringPiece& key, | 47 void SetCrashKeyValue(const base::StringPiece& key, |
| 48 const base::StringPiece& value) { | 48 const base::StringPiece& value) { |
| 49 if (!g_set_key_func_) | 49 if (!g_set_key_func_) |
| 50 return; | 50 return; |
| 51 | 51 |
| 52 const CrashKey* crash_key = LookupCrashKey(key); | 52 const CrashKey* crash_key = LookupCrashKey(key); |
| 53 | 53 |
| 54 // TODO(rsesek): Do this: | 54 DCHECK(crash_key) << "All crash keys must be registered before use " |
| 55 //DCHECK(crash_key) << "All crash keys must be registered before use " | 55 << "(key = " << key << ")"; |
| 56 // << "(key = " << key << ")"; | |
| 57 | 56 |
| 58 // Handle the un-chunked case. | 57 // Handle the un-chunked case. |
| 59 if (!crash_key || crash_key->max_length <= g_chunk_max_length_) { | 58 if (!crash_key || crash_key->max_length <= g_chunk_max_length_) { |
| 60 g_set_key_func_(key, value); | 59 g_set_key_func_(key, value); |
| 61 return; | 60 return; |
| 62 } | 61 } |
| 63 | 62 |
| 64 // Unset the unused chunks. | 63 // Unset the unused chunks. |
| 65 std::vector<std::string> chunks = | 64 std::vector<std::string> chunks = |
| 66 ChunkCrashKeyValue(*crash_key, value, g_chunk_max_length_); | 65 ChunkCrashKeyValue(*crash_key, value, g_chunk_max_length_); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void ResetCrashLoggingForTesting() { | 191 void ResetCrashLoggingForTesting() { |
| 193 delete g_crash_keys_; | 192 delete g_crash_keys_; |
| 194 g_crash_keys_ = NULL; | 193 g_crash_keys_ = NULL; |
| 195 g_chunk_max_length_ = 0; | 194 g_chunk_max_length_ = 0; |
| 196 g_set_key_func_ = NULL; | 195 g_set_key_func_ = NULL; |
| 197 g_clear_key_func_ = NULL; | 196 g_clear_key_func_ = NULL; |
| 198 } | 197 } |
| 199 | 198 |
| 200 } // namespace debug | 199 } // namespace debug |
| 201 } // namespace base | 200 } // namespace base |
| OLD | NEW |