OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 8 #include <windows.h> |
9 typedef HANDLE FileHandle; | 9 typedef HANDLE FileHandle; |
10 typedef HANDLE MutexHandle; | 10 typedef HANDLE MutexHandle; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 if (severity_ == LOG_FATAL) { | 484 if (severity_ == LOG_FATAL) { |
485 // display a message or break into the debugger on a fatal error | 485 // display a message or break into the debugger on a fatal error |
486 if (DebugUtil::BeingDebugged()) { | 486 if (DebugUtil::BeingDebugged()) { |
487 DebugUtil::BreakDebugger(); | 487 DebugUtil::BreakDebugger(); |
488 } else { | 488 } else { |
489 if (log_assert_handler) { | 489 if (log_assert_handler) { |
490 // make a copy of the string for the handler out of paranoia | 490 // make a copy of the string for the handler out of paranoia |
491 log_assert_handler(std::string(stream_.str())); | 491 log_assert_handler(std::string(stream_.str())); |
492 } else { | 492 } else { |
493 // don't use the string with the newline, get a fresh version to send to | 493 // Don't use the string with the newline, get a fresh version to send to |
494 // the debug message process | 494 // the debug message process. We also don't display assertions to the |
| 495 // user in release mode. The enduser can't do anything with this |
| 496 // information, and displaying message boxes when the application is |
| 497 // hosed can cause additional problems. |
| 498 #ifndef NDEBUG |
495 DisplayDebugMessage(stream_.str()); | 499 DisplayDebugMessage(stream_.str()); |
| 500 #endif |
496 // Crash the process to generate a dump. | 501 // Crash the process to generate a dump. |
497 DebugUtil::BreakDebugger(); | 502 DebugUtil::BreakDebugger(); |
498 // TODO(mmentovai): when we have breakpad support, generate a breakpad | 503 // TODO(mmentovai): when we have breakpad support, generate a breakpad |
499 // dump, but until then, do not invoke the Apple crash reporter. | 504 // dump, but until then, do not invoke the Apple crash reporter. |
500 } | 505 } |
501 } | 506 } |
502 } | 507 } |
503 } | 508 } |
504 | 509 |
505 void CloseLogFile() { | 510 void CloseLogFile() { |
506 if (!log_file) | 511 if (!log_file) |
507 return; | 512 return; |
508 | 513 |
509 CloseFile(log_file); | 514 CloseFile(log_file); |
510 log_file = NULL; | 515 log_file = NULL; |
511 } | 516 } |
512 | 517 |
513 } // namespace logging | 518 } // namespace logging |
514 | 519 |
515 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 520 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
516 return out << base::SysWideToUTF8(std::wstring(wstr)); | 521 return out << base::SysWideToUTF8(std::wstring(wstr)); |
517 } | 522 } |
518 | |
OLD | NEW |