Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 #include "base/base_switches.h" | 48 #include "base/base_switches.h" |
| 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 #if defined(OS_MACOSX) | |
|
viettrungluu
2010/12/14 00:03:43
I think the new convention (per some post on chrom
stuartmorgan
2010/12/14 00:04:19
I can't find the email now, but the recollection o
| |
| 58 #include "base/mac/scoped_cftyperef.h" | |
| 59 #endif | |
| 57 #include "base/process_util.h" | 60 #include "base/process_util.h" |
| 58 #include "base/string_piece.h" | 61 #include "base/string_piece.h" |
| 62 #if defined(OS_MACOSX) | |
| 63 #include "base/sys_string_conversions.h" | |
| 64 #endif | |
| 59 #include "base/thread_restrictions.h" | 65 #include "base/thread_restrictions.h" |
| 60 #include "base/utf_string_conversions.h" | 66 #include "base/utf_string_conversions.h" |
| 61 #include "base/vlog.h" | 67 #include "base/vlog.h" |
| 62 | 68 |
| 63 namespace logging { | 69 namespace logging { |
| 64 | 70 |
| 65 bool g_enable_dcheck = false; | 71 bool g_enable_dcheck = false; |
| 66 VlogInfo* g_vlog_info = NULL; | 72 VlogInfo* g_vlog_info = NULL; |
| 67 | 73 |
| 68 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { | 74 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 // to get into needing to check the desktop env and this dialog should | 510 // to get into needing to check the desktop env and this dialog should |
| 505 // only be coming up in Very Bad situations. | 511 // only be coming up in Very Bad situations. |
| 506 // It is tolerable to allow IO from this function when on any thread, given | 512 // It is tolerable to allow IO from this function when on any thread, given |
| 507 // we're about to core dump anyway. | 513 // we're about to core dump anyway. |
| 508 base::ThreadRestrictions::ScopedAllowIO allow_io; | 514 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 509 std::vector<std::string> argv; | 515 std::vector<std::string> argv; |
| 510 argv.push_back("xmessage"); | 516 argv.push_back("xmessage"); |
| 511 argv.push_back(str); | 517 argv.push_back(str); |
| 512 base::LaunchApp(argv, base::file_handle_mapping_vector(), true /* wait */, | 518 base::LaunchApp(argv, base::file_handle_mapping_vector(), true /* wait */, |
| 513 NULL); | 519 NULL); |
| 520 #elif defined(OS_MACOSX) | |
| 521 base::mac::ScopedCFTypeRef<CFStringRef> message( | |
| 522 base::SysUTF8ToCFStringRef(str)); | |
| 523 CFUserNotificationDisplayNotice(0, kCFUserNotificationStopAlertLevel, | |
| 524 NULL, NULL, NULL, CFSTR("Fatal Error"), | |
| 525 message, NULL); | |
| 514 #else | 526 #else |
| 515 // http://code.google.com/p/chromium/issues/detail?id=37026 | 527 // http://code.google.com/p/chromium/issues/detail?id=37026 |
| 516 NOTIMPLEMENTED(); | 528 NOTIMPLEMENTED(); |
| 517 #endif | 529 #endif |
| 518 } | 530 } |
| 519 | 531 |
| 520 #if defined(OS_WIN) | 532 #if defined(OS_WIN) |
| 521 LogMessage::SaveLastError::SaveLastError() : last_error_(::GetLastError()) { | 533 LogMessage::SaveLastError::SaveLastError() : last_error_(::GetLastError()) { |
| 522 } | 534 } |
| 523 | 535 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 | 831 |
| 820 if (level == LOG_FATAL) | 832 if (level == LOG_FATAL) |
| 821 base::debug::BreakDebugger(); | 833 base::debug::BreakDebugger(); |
| 822 } | 834 } |
| 823 | 835 |
| 824 } // namespace logging | 836 } // namespace logging |
| 825 | 837 |
| 826 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 838 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
| 827 return out << WideToUTF8(std::wstring(wstr)); | 839 return out << WideToUTF8(std::wstring(wstr)); |
| 828 } | 840 } |
| OLD | NEW |