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

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

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 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
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | 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 18 matching lines...) Expand all
29 const char kChunkFormatString[] = "%s-%" PRIuS; 29 const char kChunkFormatString[] = "%s-%" PRIuS;
30 30
31 // The functions that are called to actually set the key-value pairs in the 31 // The functions that are called to actually set the key-value pairs in the
32 // crash reportng system. 32 // crash reportng system.
33 SetCrashKeyValueFuncT g_set_key_func_ = NULL; 33 SetCrashKeyValueFuncT g_set_key_func_ = NULL;
34 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL; 34 ClearCrashKeyValueFuncT g_clear_key_func_ = NULL;
35 35
36 // For a given |length|, computes the number of chunks a value of that size 36 // For a given |length|, computes the number of chunks a value of that size
37 // will occupy. 37 // will occupy.
38 size_t NumChunksForLength(size_t length) { 38 size_t NumChunksForLength(size_t length) {
39 return std::ceil(length / static_cast<float>(g_chunk_max_length_)); 39 // Compute (length / g_chunk_max_length_), rounded up.
40 return (length + g_chunk_max_length_ - 1) / g_chunk_max_length_;
40 } 41 }
41 42
42 // The longest max_length allowed by the system. 43 // The longest max_length allowed by the system.
43 const size_t kLargestValueAllowed = 1024; 44 const size_t kLargestValueAllowed = 1024;
44 45
45 } // namespace 46 } // namespace
46 47
47 void SetCrashKeyValue(const base::StringPiece& key, 48 void SetCrashKeyValue(const base::StringPiece& key,
48 const base::StringPiece& value) { 49 const base::StringPiece& value) {
49 if (!g_set_key_func_ || !g_crash_keys_) 50 if (!g_set_key_func_ || !g_crash_keys_)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void ResetCrashLoggingForTesting() { 194 void ResetCrashLoggingForTesting() {
194 delete g_crash_keys_; 195 delete g_crash_keys_;
195 g_crash_keys_ = NULL; 196 g_crash_keys_ = NULL;
196 g_chunk_max_length_ = 0; 197 g_chunk_max_length_ = 0;
197 g_set_key_func_ = NULL; 198 g_set_key_func_ = NULL;
198 g_clear_key_func_ = NULL; 199 g_clear_key_func_ = NULL;
199 } 200 }
200 201
201 } // namespace debug 202 } // namespace debug
202 } // namespace base 203 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698