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 <unordered_map> | 8 #include <unordered_map> |
9 | 9 |
10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL; | 38 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL; |
39 | 39 |
40 // For a given |length|, computes the number of chunks a value of that size | 40 // For a given |length|, computes the number of chunks a value of that size |
41 // will occupy. | 41 // will occupy. |
42 size_t NumChunksForLength(size_t length) { | 42 size_t NumChunksForLength(size_t length) { |
43 // Compute (length / g_chunk_max_length_), rounded up. | 43 // Compute (length / g_chunk_max_length_), rounded up. |
44 return (length + g_chunk_max_length_ - 1) / g_chunk_max_length_; | 44 return (length + g_chunk_max_length_ - 1) / g_chunk_max_length_; |
45 } | 45 } |
46 | 46 |
47 // The longest max_length allowed by the system. | 47 // The longest max_length allowed by the system. |
48 const size_t kLargestValueAllowed = 1024; | 48 const size_t kLargestValueAllowed = 2048; |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 void SetCrashKeyValue(const base::StringPiece& key, | 52 void SetCrashKeyValue(const base::StringPiece& key, |
53 const base::StringPiece& value) { | 53 const base::StringPiece& value) { |
54 if (!g_set_key_func_ || !g_crash_keys_) | 54 if (!g_set_key_func_ || !g_crash_keys_) |
55 return; | 55 return; |
56 | 56 |
57 const CrashKey* crash_key = LookupCrashKey(key); | 57 const CrashKey* crash_key = LookupCrashKey(key); |
58 | 58 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void ResetCrashLoggingForTesting() { | 198 void ResetCrashLoggingForTesting() { |
199 delete g_crash_keys_; | 199 delete g_crash_keys_; |
200 g_crash_keys_ = NULL; | 200 g_crash_keys_ = NULL; |
201 g_chunk_max_length_ = 0; | 201 g_chunk_max_length_ = 0; |
202 g_set_key_func_ = NULL; | 202 g_set_key_func_ = NULL; |
203 g_clear_key_func_ = NULL; | 203 g_clear_key_func_ = NULL; |
204 } | 204 } |
205 | 205 |
206 } // namespace debug | 206 } // namespace debug |
207 } // namespace base | 207 } // namespace base |
OLD | NEW |