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

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: Don't assume char (un)signedness Created 6 years, 3 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') | base/logging.h » ('J')
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 return (length + g_chunk_max_length_ - 1) / g_chunk_max_length_;
brettw 2014/10/01 17:54:06 I felt like the intent of the old code was clearer
Peter Kasting 2014/10/01 19:30:21 We can cast the result, but if something is unclea
40 } 40 }
41 41
42 // The longest max_length allowed by the system. 42 // The longest max_length allowed by the system.
43 const size_t kLargestValueAllowed = 1024; 43 const size_t kLargestValueAllowed = 1024;
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_ || !g_crash_keys_) 49 if (!g_set_key_func_ || !g_crash_keys_)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void ResetCrashLoggingForTesting() { 193 void ResetCrashLoggingForTesting() {
194 delete g_crash_keys_; 194 delete g_crash_keys_;
195 g_crash_keys_ = NULL; 195 g_crash_keys_ = NULL;
196 g_chunk_max_length_ = 0; 196 g_chunk_max_length_ = 0;
197 g_set_key_func_ = NULL; 197 g_set_key_func_ = NULL;
198 g_clear_key_func_ = NULL; 198 g_clear_key_func_ = NULL;
199 } 199 }
200 200
201 } // namespace debug 201 } // namespace debug
202 } // namespace base 202 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | base/logging.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698