Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: base/debug/crash_logging.cc

Issue 2692273008: Hacky slashy (Closed)
Patch Set: wip Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 23
24 // Global map of crash key names to registration entries. 24 // Global map of crash key names to registration entries.
25 typedef std::unordered_map<base::StringPiece, CrashKey, base::StringPieceHash> 25 typedef std::unordered_map<base::StringPiece, CrashKey, base::StringPieceHash>
26 CrashKeyMap; 26 CrashKeyMap;
27 CrashKeyMap* g_crash_keys_ = NULL; 27 CrashKeyMap* g_crash_keys_ = NULL;
28 28
29 // The maximum length of a single chunk. 29 // The maximum length of a single chunk.
30 size_t g_chunk_max_length_ = 0; 30 size_t g_chunk_max_length_ = 0;
31 31
32 // String used to format chunked key names. 32 // String used to format chunked key names.
33 #if !defined(OS_FUCHSIA)
33 const char kChunkFormatString[] = "%s-%" PRIuS; 34 const char kChunkFormatString[] = "%s-%" PRIuS;
35 #else
36 const char kChunkFormatString[] = "%s-%zu";
37 #endif
34 38
35 // The functions that are called to actually set the key-value pairs in the 39 // The functions that are called to actually set the key-value pairs in the
36 // crash reportng system. 40 // crash reportng system.
37 SetCrashKeyValueFuncT g_set_key_func_ = NULL; 41 SetCrashKeyValueFuncT g_set_key_func_ = NULL;
38 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL; 42 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL;
39 43
40 // For a given |length|, computes the number of chunks a value of that size 44 // For a given |length|, computes the number of chunks a value of that size
41 // will occupy. 45 // will occupy.
42 size_t NumChunksForLength(size_t length) { 46 size_t NumChunksForLength(size_t length) {
43 // Compute (length / g_chunk_max_length_), rounded up. 47 // Compute (length / g_chunk_max_length_), rounded up.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void ResetCrashLoggingForTesting() { 202 void ResetCrashLoggingForTesting() {
199 delete g_crash_keys_; 203 delete g_crash_keys_;
200 g_crash_keys_ = NULL; 204 g_crash_keys_ = NULL;
201 g_chunk_max_length_ = 0; 205 g_chunk_max_length_ = 0;
202 g_set_key_func_ = NULL; 206 g_set_key_func_ = NULL;
203 g_clear_key_func_ = NULL; 207 g_clear_key_func_ = NULL;
204 } 208 }
205 209
206 } // namespace debug 210 } // namespace debug
207 } // namespace base 211 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698