OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "base/command_line.h" | 49 #include "base/command_line.h" |
50 #include "base/debug/debugger.h" | 50 #include "base/debug/debugger.h" |
51 #include "base/debug/stack_trace.h" | 51 #include "base/debug/stack_trace.h" |
52 #include "base/eintr_wrapper.h" | 52 #include "base/eintr_wrapper.h" |
53 #include "base/lock_impl.h" | 53 #include "base/lock_impl.h" |
54 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
55 #include "base/safe_strerror_posix.h" | 55 #include "base/safe_strerror_posix.h" |
56 #endif | 56 #endif |
57 #include "base/process_util.h" | 57 #include "base/process_util.h" |
58 #include "base/string_piece.h" | 58 #include "base/string_piece.h" |
| 59 #include "base/thread_restrictions.h" |
59 #include "base/utf_string_conversions.h" | 60 #include "base/utf_string_conversions.h" |
60 #include "base/vlog.h" | 61 #include "base/vlog.h" |
61 | 62 |
62 namespace logging { | 63 namespace logging { |
63 | 64 |
64 bool g_enable_dcheck = false; | 65 bool g_enable_dcheck = false; |
65 VlogInfo* g_vlog_info = NULL; | 66 VlogInfo* g_vlog_info = NULL; |
66 | 67 |
67 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { | 68 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { |
68 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; | 69 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 } else { | 496 } else { |
496 // debug process broken, let's just do a message box | 497 // debug process broken, let's just do a message box |
497 MessageBoxW(NULL, &cmdline[0], L"Fatal error", | 498 MessageBoxW(NULL, &cmdline[0], L"Fatal error", |
498 MB_OK | MB_ICONHAND | MB_TOPMOST); | 499 MB_OK | MB_ICONHAND | MB_TOPMOST); |
499 } | 500 } |
500 #elif defined(USE_X11) && !defined(OS_CHROMEOS) | 501 #elif defined(USE_X11) && !defined(OS_CHROMEOS) |
501 // Shell out to xmessage, which behaves like debug_message.exe, but is | 502 // Shell out to xmessage, which behaves like debug_message.exe, but is |
502 // way more retro. We could use zenity/kdialog but then we're starting | 503 // way more retro. We could use zenity/kdialog but then we're starting |
503 // to get into needing to check the desktop env and this dialog should | 504 // to get into needing to check the desktop env and this dialog should |
504 // only be coming up in Very Bad situations. | 505 // only be coming up in Very Bad situations. |
| 506 // It is tolerable to allow IO from this function when on any thread, given |
| 507 // we're about to core dump anyway. |
| 508 base::ThreadRestrictions::ScopedAllowIO allow_io; |
505 std::vector<std::string> argv; | 509 std::vector<std::string> argv; |
506 argv.push_back("xmessage"); | 510 argv.push_back("xmessage"); |
507 argv.push_back(str); | 511 argv.push_back(str); |
508 base::LaunchApp(argv, base::file_handle_mapping_vector(), true /* wait */, | 512 base::LaunchApp(argv, base::file_handle_mapping_vector(), true /* wait */, |
509 NULL); | 513 NULL); |
510 #else | 514 #else |
511 // http://code.google.com/p/chromium/issues/detail?id=37026 | 515 // http://code.google.com/p/chromium/issues/detail?id=37026 |
512 NOTIMPLEMENTED(); | 516 NOTIMPLEMENTED(); |
513 #endif | 517 #endif |
514 } | 518 } |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 819 |
816 if (level == LOG_FATAL) | 820 if (level == LOG_FATAL) |
817 base::debug::BreakDebugger(); | 821 base::debug::BreakDebugger(); |
818 } | 822 } |
819 | 823 |
820 } // namespace logging | 824 } // namespace logging |
821 | 825 |
822 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 826 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
823 return out << WideToUTF8(std::wstring(wstr)); | 827 return out << WideToUTF8(std::wstring(wstr)); |
824 } | 828 } |
OLD | NEW |