diff options
author | cmasone@google.com <cmasone@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 00:38:12 +0000 |
---|---|---|
committer | cmasone@google.com <cmasone@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 00:38:12 +0000 |
commit | 81e0a85082ccf4b14f48ed5229baa2cbd8642ad4 (patch) | |
tree | 8ba996d8a88dab6c1c9b8a32af78d202e439a254 /base/logging.cc | |
parent | 5c21a2eeaa92326a6a771e27c70b11b1ea52441a (diff) | |
download | chromium_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/logging.cc')
-rw-r--r-- | base/logging.cc | 11 |
1 files changed, 9 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 |