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

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

Issue 25572002: Enforce crash key registration in SetCrashKeyValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698