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

Side by Side Diff: chrome/common/logging_chrome.cc

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Use LazyIsntance and stl stack. Created 3 years, 9 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 // Need to include this before most other files because it defines 7 // Need to include this before most other files because it defines
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the
10 // ViewMsgLog et al. functions. 10 // ViewMsgLog et al. functions.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include <initguid.h> 62 #include <initguid.h>
63 #include "base/logging_win.h" 63 #include "base/logging_win.h"
64 #include "base/syslog_logging.h" 64 #include "base/syslog_logging.h"
65 #include "chrome/install_static/install_details.h" 65 #include "chrome/install_static/install_details.h"
66 #endif 66 #endif
67 67
68 namespace { 68 namespace {
69 69
70 // When true, this means that error dialogs should not be shown. 70 // When true, this means that error dialogs should not be shown.
71 bool dialogs_are_suppressed_ = false; 71 bool dialogs_are_suppressed_ = false;
72 logging::ScopedLogAssertHandler* assert_handler_ = nullptr;
72 73
73 // This should be true for exactly the period between the end of 74 // This should be true for exactly the period between the end of
74 // InitChromeLogging() and the beginning of CleanupChromeLogging(). 75 // InitChromeLogging() and the beginning of CleanupChromeLogging().
75 bool chrome_logging_initialized_ = false; 76 bool chrome_logging_initialized_ = false;
76 77
77 // Set if we called InitChromeLogging() but failed to initialize. 78 // Set if we called InitChromeLogging() but failed to initialize.
78 bool chrome_logging_failed_ = false; 79 bool chrome_logging_failed_ = false;
79 80
80 // This should be true for exactly the period between the end of 81 // This should be true for exactly the period between the end of
81 // InitChromeLogging() and the beginning of CleanupChromeLogging(). 82 // InitChromeLogging() and the beginning of CleanupChromeLogging().
82 bool chrome_logging_redirected_ = false; 83 bool chrome_logging_redirected_ = false;
83 84
84 #if defined(OS_WIN) 85 #if defined(OS_WIN)
85 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} 86 // {7FE69228-633E-4f06-80C1-527FEA23E3A7}
86 const GUID kChromeTraceProviderName = { 87 const GUID kChromeTraceProviderName = {
87 0x7fe69228, 0x633e, 0x4f06, 88 0x7fe69228, 0x633e, 0x4f06,
88 { 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7 } }; 89 { 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7 } };
89 #endif 90 #endif
90 91
91 // Assertion handler for logging errors that occur when dialogs are 92 // Assertion handler for logging errors that occur when dialogs are
92 // silenced. To record a new error, pass the log string associated 93 // silenced. To record a new error, pass the log string associated
93 // with that error in the str parameter. 94 // with that error in the str parameter.
94 MSVC_DISABLE_OPTIMIZE(); 95 MSVC_DISABLE_OPTIMIZE();
95 void SilentRuntimeAssertHandler(const std::string& str) { 96 void SilentRuntimeAssertHandler(
97 const char* file, int line,
98 const base::StringPiece& message, const base::StringPiece& stack_trace) {
96 base::debug::BreakDebugger(); 99 base::debug::BreakDebugger();
97 } 100 }
98 MSVC_ENABLE_OPTIMIZE(); 101 MSVC_ENABLE_OPTIMIZE();
99 102
100 // Suppresses error/assertion dialogs and enables the logging of 103 // Suppresses error/assertion dialogs and enables the logging of
101 // those errors into silenced_errors_. 104 // those errors into silenced_errors_.
102 void SuppressDialogs() { 105 void SuppressDialogs() {
103 if (dialogs_are_suppressed_) 106 if (dialogs_are_suppressed_)
104 return; 107 return;
105 108
106 logging::SetLogAssertHandler(SilentRuntimeAssertHandler); 109 assert_handler_ = new logging::ScopedLogAssertHandler(
110 base::Bind(SilentRuntimeAssertHandler));
107 111
108 #if defined(OS_WIN) 112 #if defined(OS_WIN)
109 UINT new_flags = SEM_FAILCRITICALERRORS | 113 UINT new_flags = SEM_FAILCRITICALERRORS |
110 SEM_NOGPFAULTERRORBOX | 114 SEM_NOGPFAULTERRORBOX |
111 SEM_NOOPENFILEERRORBOX; 115 SEM_NOOPENFILEERRORBOX;
112 116
113 // Preserve existing error mode, as discussed at http://t/dmea 117 // Preserve existing error mode, as discussed at http://t/dmea
114 UINT existing_flags = SetErrorMode(new_flags); 118 UINT existing_flags = SetErrorMode(new_flags);
115 SetErrorMode(existing_flags | new_flags); 119 SetErrorMode(existing_flags | new_flags);
116 #endif 120 #endif
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 time_deets.year, 420 time_deets.year,
417 time_deets.month, 421 time_deets.month,
418 time_deets.day_of_month, 422 time_deets.day_of_month,
419 time_deets.hour, 423 time_deets.hour,
420 time_deets.minute, 424 time_deets.minute,
421 time_deets.second); 425 time_deets.second);
422 return base_path.InsertBeforeExtensionASCII(suffix); 426 return base_path.InsertBeforeExtensionASCII(suffix);
423 } 427 }
424 428
425 } // namespace logging 429 } // namespace logging
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698