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

Side by Side Diff: base/logging.cc

Issue 1846373002: Revert of Patch to try dump-on-DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « base/logging.h ('k') | 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 // 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/logging.h" 5 #include "base/logging.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include <cstring> 52 #include <cstring>
53 #include <ctime> 53 #include <ctime>
54 #include <iomanip> 54 #include <iomanip>
55 #include <ostream> 55 #include <ostream>
56 #include <string> 56 #include <string>
57 57
58 #include "base/base_switches.h" 58 #include "base/base_switches.h"
59 #include "base/command_line.h" 59 #include "base/command_line.h"
60 #include "base/debug/alias.h" 60 #include "base/debug/alias.h"
61 #include "base/debug/debugger.h" 61 #include "base/debug/debugger.h"
62 #include "base/debug/dump_without_crashing.h"
63 #include "base/debug/stack_trace.h" 62 #include "base/debug/stack_trace.h"
64 #include "base/posix/eintr_wrapper.h" 63 #include "base/posix/eintr_wrapper.h"
65 #include "base/strings/string_piece.h" 64 #include "base/strings/string_piece.h"
66 #include "base/strings/string_util.h" 65 #include "base/strings/string_util.h"
67 #include "base/strings/stringprintf.h" 66 #include "base/strings/stringprintf.h"
68 #include "base/strings/sys_string_conversions.h" 67 #include "base/strings/sys_string_conversions.h"
69 #include "base/strings/utf_string_conversions.h" 68 #include "base/strings/utf_string_conversions.h"
70 #include "base/synchronization/lock_impl.h" 69 #include "base/synchronization/lock_impl.h"
71 #include "base/threading/platform_thread.h" 70 #include "base/threading/platform_thread.h"
72 #include "base/vlog.h" 71 #include "base/vlog.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void CloseLogFileUnlocked() { 326 void CloseLogFileUnlocked() {
328 if (!g_log_file) 327 if (!g_log_file)
329 return; 328 return;
330 329
331 CloseFile(g_log_file); 330 CloseFile(g_log_file);
332 g_log_file = nullptr; 331 g_log_file = nullptr;
333 } 332 }
334 333
335 } // namespace 334 } // namespace
336 335
337 #if defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
338 // Used to implement dump-on-DCHECK. See crbug.com/596231.
339 void DCheckDumpWithoutCrashing() {
340 // To ensure we don't risk spamming Crash with dump-on-DCHECK reports we log
341 // only the first[*] DCHECK to fail once DumpWithoutCrashing() is working.
342 // [*] This is racey, but in the pathological case still only results in one
343 // dump per-racing-thread, rather than our aim of one per-process.
344 static bool dump_on_dcheck = true;
345 if (dump_on_dcheck)
346 dump_on_dcheck = !base::debug::DumpWithoutCrashing();
347 }
348 #endif
349
350 LoggingSettings::LoggingSettings() 336 LoggingSettings::LoggingSettings()
351 : logging_dest(LOG_DEFAULT), 337 : logging_dest(LOG_DEFAULT),
352 log_file(nullptr), 338 log_file(nullptr),
353 lock_log(LOCK_LOG_FILE), 339 lock_log(LOCK_LOG_FILE),
354 delete_old(APPEND_TO_OLD_LOG_FILE) {} 340 delete_old(APPEND_TO_OLD_LOG_FILE) {}
355 341
356 bool BaseInitLoggingImpl(const LoggingSettings& settings) { 342 bool BaseInitLoggingImpl(const LoggingSettings& settings) {
357 #if defined(OS_NACL) 343 #if defined(OS_NACL)
358 // Can log only to the system debug log. 344 // Can log only to the system debug log.
359 CHECK_EQ(settings.logging_dest & ~LOG_TO_SYSTEM_DEBUG_LOG, 0); 345 CHECK_EQ(settings.logging_dest & ~LOG_TO_SYSTEM_DEBUG_LOG, 0);
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { 908 BASE_EXPORT void LogErrorNotReached(const char* file, int line) {
923 LogMessage(file, line, LOG_ERROR).stream() 909 LogMessage(file, line, LOG_ERROR).stream()
924 << "NOTREACHED() hit."; 910 << "NOTREACHED() hit.";
925 } 911 }
926 912
927 } // namespace logging 913 } // namespace logging
928 914
929 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { 915 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) {
930 return out << (wstr ? base::WideToUTF8(wstr) : std::string()); 916 return out << (wstr ? base::WideToUTF8(wstr) : std::string());
931 } 917 }
OLDNEW
« no previous file with comments | « base/logging.h ('k') | base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698