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

Side by Side Diff: base/logging.cc

Issue 2847085: GTTF: Ensure that when we're testing the logging system will not display dialogs. (Closed)
Patch Set: use the flag Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "base/logging.h" 5 #include "base/logging.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #include <windows.h> 9 #include <windows.h>
10 typedef HANDLE FileHandle; 10 typedef HANDLE FileHandle;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 log_message_handler = handler; 318 log_message_handler = handler;
319 } 319 }
320 320
321 321
322 // Displays a message box to the user with the error message in it. 322 // Displays a message box to the user with the error message in it.
323 // Used for fatal messages, where we close the app simultaneously. 323 // Used for fatal messages, where we close the app simultaneously.
324 void DisplayDebugMessageInDialog(const std::string& str) { 324 void DisplayDebugMessageInDialog(const std::string& str) {
325 if (str.empty()) 325 if (str.empty())
326 return; 326 return;
327 327
328 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoErrorDialogs))
329 return;
330
328 #if defined(OS_WIN) 331 #if defined(OS_WIN)
329 // For Windows programs, it's possible that the message loop is 332 // For Windows programs, it's possible that the message loop is
330 // messed up on a fatal error, and creating a MessageBox will cause 333 // messed up on a fatal error, and creating a MessageBox will cause
331 // that message loop to be run. Instead, we try to spawn another 334 // that message loop to be run. Instead, we try to spawn another
332 // process that displays its command line. We look for "Debug 335 // process that displays its command line. We look for "Debug
333 // Message.exe" in the same directory as the application. If it 336 // Message.exe" in the same directory as the application. If it
334 // exists, we use it, otherwise, we use a regular message box. 337 // exists, we use it, otherwise, we use a regular message box.
335 wchar_t prog_name[MAX_PATH]; 338 wchar_t prog_name[MAX_PATH];
336 GetModuleFileNameW(NULL, prog_name, MAX_PATH); 339 GetModuleFileNameW(NULL, prog_name, MAX_PATH);
337 wchar_t* backslash = wcsrchr(prog_name, '\\'); 340 wchar_t* backslash = wcsrchr(prog_name, '\\');
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 724
722 if (level == LOG_FATAL) 725 if (level == LOG_FATAL)
723 DebugUtil::BreakDebugger(); 726 DebugUtil::BreakDebugger();
724 } 727 }
725 728
726 } // namespace logging 729 } // namespace logging
727 730
728 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { 731 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
729 return out << WideToUTF8(std::wstring(wstr)); 732 return out << WideToUTF8(std::wstring(wstr));
730 } 733 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698