summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorcmasone@google.com <cmasone@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 00:38:12 +0000
committercmasone@google.com <cmasone@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 00:38:12 +0000
commit81e0a85082ccf4b14f48ed5229baa2cbd8642ad4 (patch)
tree8ba996d8a88dab6c1c9b8a32af78d202e439a254 /base
parent5c21a2eeaa92326a6a771e27c70b11b1ea52441a (diff)
downloadchromium_src-81e0a85082ccf4b14f48ed5229baa2cbd8642ad4.zip
chromium_src-81e0a85082ccf4b14f48ed5229baa2cbd8642ad4.tar.gz
chromium_src-81e0a85082ccf4b14f48ed5229baa2cbd8642ad4.tar.bz2
Stop eternal loop in DisplayDebugMessageInDialog
if CommandLine was never initialized, CommandLine::ForCurrentProcess() will DCHECK. That causes DisplayDebugMessageInDialog() to run...which calls CommandLine::ForCurrentProcess(), which can DCHECK. Also, Chrome OS doesn't have xmessage, so we don't want to try to pop up a message using that mechanism. BUG=None TEST=Run a binary that doesn't initialize CommandLine (a chrome os unittest binary, for example) and make it CHECK(false). Instead of looping until the stack explodes, it should print messages for the check failures and exit. Review URL: http://codereview.chromium.org/3151016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/logging.cc11
-rw-r--r--base/logging.h5
2 files changed, 14 insertions, 2 deletions
diff --git a/base/logging.cc b/base/logging.cc
index 7622fbee..b123a0a 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -100,6 +100,9 @@ bool log_thread_id = false;
bool log_timestamp = true;
bool log_tickcount = false;
+// Should we pop up fatal debug messages in a dialog?
+bool show_error_dialogs = 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;
@@ -307,6 +310,10 @@ void SetLogItems(bool enable_process_id, bool enable_thread_id,
log_tickcount = enable_tickcount;
}
+void SetShowErrorDialogs(bool enable_dialogs) {
+ show_error_dialogs = enable_dialogs;
+}
+
void SetLogAssertHandler(LogAssertHandlerFunction handler) {
log_assert_handler = handler;
}
@@ -326,7 +333,7 @@ void DisplayDebugMessageInDialog(const std::string& str) {
if (str.empty())
return;
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoErrorDialogs))
+ if (!show_error_dialogs)
return;
#if defined(OS_WIN)
@@ -362,7 +369,7 @@ void DisplayDebugMessageInDialog(const std::string& str) {
MessageBoxW(NULL, &cmdline[0], L"Fatal error",
MB_OK | MB_ICONHAND | MB_TOPMOST);
}
-#elif defined(USE_X11)
+#elif defined(USE_X11) && !defined(OS_CHROMEOS)
// Shell out to xmessage, which behaves like debug_message.exe, but is
// way more retro. We could use zenity/kdialog but then we're starting
// to get into needing to check the desktop env and this dialog should
diff --git a/base/logging.h b/base/logging.h
index c63d827..69c67f4 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -167,6 +167,11 @@ void SetLogFilterPrefix(const char* filter);
void SetLogItems(bool enable_process_id, bool enable_thread_id,
bool enable_timestamp, bool enable_tickcount);
+// Sets whether or not you'd like to see fatal debug messages popped up in
+// a dialog box or not.
+// Dialogs are not shown by default.
+void SetShowErrorDialogs(bool enable_dialogs);
+
// Sets the Log Assert Handler that will be used to notify of check failures.
// The default handler shows a dialog box and then terminate the process,
// however clients can use this function to override with their own handling