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

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

Issue 2137863002: Make it a compile error to use a crash key with no variable name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 <map> 8 #include <map>
9 9
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 15
16 #undef ScopedCrashKey
danakj 2016/07/19 02:14:05 The precompiler will replace the constructor defn
dcheng 2016/07/19 02:34:34 Yeah, this will garble the ctor. So this is a dumb
danakj 2016/07/19 21:02:56 OK can you leave a quick comment on that.
dcheng 2016/07/22 05:39:22 Done.
17
16 namespace base { 18 namespace base {
17 namespace debug { 19 namespace debug {
18 20
19 namespace { 21 namespace {
20 22
21 // Global map of crash key names to registration entries. 23 // Global map of crash key names to registration entries.
22 typedef std::map<base::StringPiece, CrashKey> CrashKeyMap; 24 typedef std::map<base::StringPiece, CrashKey> CrashKeyMap;
23 CrashKeyMap* g_crash_keys_ = NULL; 25 CrashKeyMap* g_crash_keys_ = NULL;
24 26
25 // The maximum length of a single chunk. 27 // The maximum length of a single chunk.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void ResetCrashLoggingForTesting() { 196 void ResetCrashLoggingForTesting() {
195 delete g_crash_keys_; 197 delete g_crash_keys_;
196 g_crash_keys_ = NULL; 198 g_crash_keys_ = NULL;
197 g_chunk_max_length_ = 0; 199 g_chunk_max_length_ = 0;
198 g_set_key_func_ = NULL; 200 g_set_key_func_ = NULL;
199 g_clear_key_func_ = NULL; 201 g_clear_key_func_ = NULL;
200 } 202 }
201 203
202 } // namespace debug 204 } // namespace debug
203 } // namespace base 205 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698