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

Unified Diff: base/logging.cc

Issue 21216: Change the behavior of --enable-dcheck from crashing (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« base/logging.h ('K') | « base/logging.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.cc
===================================================================
--- base/logging.cc (revision 9544)
+++ base/logging.cc (working copy)
@@ -46,7 +46,7 @@
bool g_enable_dcheck = false;
const char* const log_severity_names[LOG_NUM_SEVERITIES] = {
- "INFO", "WARNING", "ERROR", "FATAL" };
+ "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" };
int min_log_level = 0;
LogLockingState lock_log_file = LOCK_LOG_FILE;
@@ -89,8 +89,11 @@
bool log_tickcount = false;
// An assert handler override specified by the client to be called instead of
+// the debug message dialog and process termination.
+LogAssertHandlerFunction log_assert_handler = NULL;
+// An report handler override specified by the client to be called instead of
wtc 2009/02/19 01:32:04 Nit: add a blank line above this line.
// the debug message dialog.
-LogAssertHandlerFunction log_assert_handler = NULL;
+LogReportHandlerFunction log_report_handler = NULL;
// The lock is used if log file locking is false. It helps us avoid problems
// with multiple threads writing to the log file at the same time. Use
@@ -291,6 +294,10 @@
log_assert_handler = handler;
}
+void SetLogReportHandler(LogReportHandlerFunction handler) {
+ log_report_handler = handler;
+}
+
// Displays a message box to the user with the error message in it. For
// Windows programs, it's possible that the message loop is messed up on
// a fatal error, and creating a MessageBox will cause that message loop
@@ -348,6 +355,13 @@
stream_ << "Check failed: " << (*result.str_);
}
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ const CheckOpString& result)
+ : severity_(severity) {
+ Init(file, line);
+ stream_ << "Check failed: " << (*result.str_);
+}
+
LogMessage::LogMessage(const char* file, int line)
: severity_(LOG_INFO) {
Init(file, line);
@@ -511,6 +525,13 @@
// dump, but until then, do not invoke the Apple crash reporter.
}
}
+ } else if (severity_ == LOG_ERROR_REPORT) {
+ // We are here only if the user runs with --enable-dcheck in release mode.
+ if (log_report_handler) {
+ log_report_handler(std::string(stream_.str()));
+ } else {
+ DisplayDebugMessage(stream_.str());
+ }
}
}
« base/logging.h ('K') | « base/logging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698