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

Side by Side Diff: webrtc/base/logging.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 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 | « webrtc/base/logging.h ('k') | webrtc/base/logging_unittest.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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Boolean options default to false (0) 112 // Boolean options default to false (0)
113 bool LogMessage::thread_, LogMessage::timestamp_; 113 bool LogMessage::thread_, LogMessage::timestamp_;
114 114
115 LogMessage::LogMessage(const char* file, int line, LoggingSeverity sev, 115 LogMessage::LogMessage(const char* file, int line, LoggingSeverity sev,
116 LogErrorContext err_ctx, int err, const char* module) 116 LogErrorContext err_ctx, int err, const char* module)
117 : severity_(sev), 117 : severity_(sev),
118 tag_(kLibjingle), 118 tag_(kLibjingle),
119 warn_slow_logs_delay_(WARN_SLOW_LOGS_DELAY) { 119 warn_slow_logs_delay_(WARN_SLOW_LOGS_DELAY) {
120 if (timestamp_) { 120 if (timestamp_) {
121 uint32 time = TimeSince(LogStartTime()); 121 uint32_t time = TimeSince(LogStartTime());
122 // Also ensure WallClockStartTime is initialized, so that it matches 122 // Also ensure WallClockStartTime is initialized, so that it matches
123 // LogStartTime. 123 // LogStartTime.
124 WallClockStartTime(); 124 WallClockStartTime();
125 print_stream_ << "[" << std::setfill('0') << std::setw(3) << (time / 1000) 125 print_stream_ << "[" << std::setfill('0') << std::setw(3) << (time / 1000)
126 << ":" << std::setw(3) << (time % 1000) << std::setfill(' ') 126 << ":" << std::setw(3) << (time % 1000) << std::setfill(' ')
127 << "] "; 127 << "] ";
128 } 128 }
129 129
130 if (thread_) { 130 if (thread_) {
131 PlatformThreadId id = CurrentThreadId(); 131 PlatformThreadId id = CurrentThreadId();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 LogMessage::~LogMessage() { 190 LogMessage::~LogMessage() {
191 if (!extra_.empty()) 191 if (!extra_.empty())
192 print_stream_ << " : " << extra_; 192 print_stream_ << " : " << extra_;
193 print_stream_ << std::endl; 193 print_stream_ << std::endl;
194 194
195 const std::string& str = print_stream_.str(); 195 const std::string& str = print_stream_.str();
196 if (severity_ >= dbg_sev_) { 196 if (severity_ >= dbg_sev_) {
197 OutputToDebug(str, severity_, tag_); 197 OutputToDebug(str, severity_, tag_);
198 } 198 }
199 199
200 uint32 before = Time(); 200 uint32_t before = Time();
201 // Must lock streams_ before accessing 201 // Must lock streams_ before accessing
202 CritScope cs(&crit_); 202 CritScope cs(&crit_);
203 for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) { 203 for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) {
204 if (severity_ >= it->second) { 204 if (severity_ >= it->second) {
205 it->first->OnLogMessage(str); 205 it->first->OnLogMessage(str);
206 } 206 }
207 } 207 }
208 uint32 delay = TimeSince(before); 208 uint32_t delay = TimeSince(before);
209 if (delay >= warn_slow_logs_delay_) { 209 if (delay >= warn_slow_logs_delay_) {
210 rtc::LogMessage slow_log_warning(__FILE__, __LINE__, LS_WARNING); 210 rtc::LogMessage slow_log_warning(__FILE__, __LINE__, LS_WARNING);
211 // If our warning is slow, we don't want to warn about it, because 211 // If our warning is slow, we don't want to warn about it, because
212 // that would lead to inifinite recursion. So, give a really big 212 // that would lead to inifinite recursion. So, give a really big
213 // number for the delay threshold. 213 // number for the delay threshold.
214 slow_log_warning.warn_slow_logs_delay_ = UINT_MAX; 214 slow_log_warning.warn_slow_logs_delay_ = UINT_MAX;
215 slow_log_warning.stream() << "Slow log: took " << delay << "ms to write " 215 slow_log_warning.stream() << "Slow log: took " << delay << "ms to write "
216 << str.size() << " bytes."; 216 << str.size() << " bytes.";
217 } 217 }
218 } 218 }
219 219
220 uint32 LogMessage::LogStartTime() { 220 uint32_t LogMessage::LogStartTime() {
221 static const uint32 g_start = Time(); 221 static const uint32_t g_start = Time();
222 return g_start; 222 return g_start;
223 } 223 }
224 224
225 uint32 LogMessage::WallClockStartTime() { 225 uint32_t LogMessage::WallClockStartTime() {
226 static const uint32 g_start_wallclock = time(NULL); 226 static const uint32_t g_start_wallclock = time(NULL);
227 return g_start_wallclock; 227 return g_start_wallclock;
228 } 228 }
229 229
230 void LogMessage::LogThreads(bool on) { 230 void LogMessage::LogThreads(bool on) {
231 thread_ = on; 231 thread_ = on;
232 } 232 }
233 233
234 void LogMessage::LogTimestamps(bool on) { 234 void LogMessage::LogTimestamps(bool on) {
235 timestamp_ = on; 235 timestamp_ = on;
236 } 236 }
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 555
556 if (state) { 556 if (state) {
557 state->unprintable_count_[input] = consecutive_unprintable; 557 state->unprintable_count_[input] = consecutive_unprintable;
558 } 558 }
559 } 559 }
560 560
561 ////////////////////////////////////////////////////////////////////// 561 //////////////////////////////////////////////////////////////////////
562 562
563 } // namespace rtc 563 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/logging.h ('k') | webrtc/base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698