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

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

Issue 2828373002: Revert of Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Created 3 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
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;
73 72
74 // This should be true for exactly the period between the end of 73 // This should be true for exactly the period between the end of
75 // InitChromeLogging() and the beginning of CleanupChromeLogging(). 74 // InitChromeLogging() and the beginning of CleanupChromeLogging().
76 bool chrome_logging_initialized_ = false; 75 bool chrome_logging_initialized_ = false;
77 76
78 // Set if we called InitChromeLogging() but failed to initialize. 77 // Set if we called InitChromeLogging() but failed to initialize.
79 bool chrome_logging_failed_ = false; 78 bool chrome_logging_failed_ = false;
80 79
81 // This should be true for exactly the period between the end of 80 // This should be true for exactly the period between the end of
82 // InitChromeLogging() and the beginning of CleanupChromeLogging(). 81 // InitChromeLogging() and the beginning of CleanupChromeLogging().
83 bool chrome_logging_redirected_ = false; 82 bool chrome_logging_redirected_ = false;
84 83
85 #if defined(OS_WIN) 84 #if defined(OS_WIN)
86 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} 85 // {7FE69228-633E-4f06-80C1-527FEA23E3A7}
87 const GUID kChromeTraceProviderName = { 86 const GUID kChromeTraceProviderName = {
88 0x7fe69228, 0x633e, 0x4f06, 87 0x7fe69228, 0x633e, 0x4f06,
89 { 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7 } }; 88 { 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7 } };
90 #endif 89 #endif
91 90
92 // Assertion handler for logging errors that occur when dialogs are 91 // Assertion handler for logging errors that occur when dialogs are
93 // silenced. To record a new error, pass the log string associated 92 // silenced. To record a new error, pass the log string associated
94 // with that error in the str parameter. 93 // with that error in the str parameter.
95 MSVC_DISABLE_OPTIMIZE(); 94 MSVC_DISABLE_OPTIMIZE();
96 void SilentRuntimeAssertHandler(const char* file, 95 void SilentRuntimeAssertHandler(const std::string& str) {
97 int line,
98 const base::StringPiece message,
99 const base::StringPiece stack_trace) {
100 base::debug::BreakDebugger(); 96 base::debug::BreakDebugger();
101 } 97 }
102 MSVC_ENABLE_OPTIMIZE(); 98 MSVC_ENABLE_OPTIMIZE();
103 99
104 // Suppresses error/assertion dialogs and enables the logging of 100 // Suppresses error/assertion dialogs and enables the logging of
105 // those errors into silenced_errors_. 101 // those errors into silenced_errors_.
106 void SuppressDialogs() { 102 void SuppressDialogs() {
107 if (dialogs_are_suppressed_) 103 if (dialogs_are_suppressed_)
108 return; 104 return;
109 105
110 assert_handler_ = new logging::ScopedLogAssertHandler( 106 logging::SetLogAssertHandler(SilentRuntimeAssertHandler);
111 base::Bind(SilentRuntimeAssertHandler));
112 107
113 #if defined(OS_WIN) 108 #if defined(OS_WIN)
114 UINT new_flags = SEM_FAILCRITICALERRORS | 109 UINT new_flags = SEM_FAILCRITICALERRORS |
115 SEM_NOGPFAULTERRORBOX | 110 SEM_NOGPFAULTERRORBOX |
116 SEM_NOOPENFILEERRORBOX; 111 SEM_NOOPENFILEERRORBOX;
117 112
118 // Preserve existing error mode, as discussed at http://t/dmea 113 // Preserve existing error mode, as discussed at http://t/dmea
119 UINT existing_flags = SetErrorMode(new_flags); 114 UINT existing_flags = SetErrorMode(new_flags);
120 SetErrorMode(existing_flags | new_flags); 115 SetErrorMode(existing_flags | new_flags);
121 #endif 116 #endif
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 time_deets.year, 416 time_deets.year,
422 time_deets.month, 417 time_deets.month,
423 time_deets.day_of_month, 418 time_deets.day_of_month,
424 time_deets.hour, 419 time_deets.hour,
425 time_deets.minute, 420 time_deets.minute,
426 time_deets.second); 421 time_deets.second);
427 return base_path.InsertBeforeExtensionASCII(suffix); 422 return base_path.InsertBeforeExtensionASCII(suffix);
428 } 423 }
429 424
430 } // namespace logging 425 } // namespace logging
OLDNEW
« no previous file with comments | « base/test/test_suite.cc ('k') | ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698