OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "base/debug/stack_trace.h" | 52 #include "base/debug/stack_trace.h" |
53 #include "base/posix/eintr_wrapper.h" | 53 #include "base/posix/eintr_wrapper.h" |
54 #include "base/strings/string_piece.h" | 54 #include "base/strings/string_piece.h" |
55 #include "base/strings/string_util.h" | 55 #include "base/strings/string_util.h" |
56 #include "base/strings/stringprintf.h" | 56 #include "base/strings/stringprintf.h" |
57 #include "base/strings/utf_string_conversions.h" | 57 #include "base/strings/utf_string_conversions.h" |
58 #include "base/synchronization/lock_impl.h" | 58 #include "base/synchronization/lock_impl.h" |
59 #include "base/threading/platform_thread.h" | 59 #include "base/threading/platform_thread.h" |
60 #include "base/vlog.h" | 60 #include "base/vlog.h" |
61 #if defined(OS_POSIX) | 61 #if defined(OS_POSIX) |
62 #include "base/safe_strerror_posix.h" | 62 #include "base/posix/safe_strerror.h" |
63 #endif | 63 #endif |
64 | 64 |
65 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
66 #include <android/log.h> | 66 #include <android/log.h> |
67 #endif | 67 #endif |
68 | 68 |
69 namespace logging { | 69 namespace logging { |
70 | 70 |
71 namespace { | 71 namespace { |
72 | 72 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 if (len) { | 712 if (len) { |
713 // Messages returned by system end with line breaks. | 713 // Messages returned by system end with line breaks. |
714 return base::CollapseWhitespaceASCII(msgbuf, true) + | 714 return base::CollapseWhitespaceASCII(msgbuf, true) + |
715 base::StringPrintf(" (0x%X)", error_code); | 715 base::StringPrintf(" (0x%X)", error_code); |
716 } | 716 } |
717 return base::StringPrintf("Error (0x%X) while retrieving error. (0x%X)", | 717 return base::StringPrintf("Error (0x%X) while retrieving error. (0x%X)", |
718 GetLastError(), error_code); | 718 GetLastError(), error_code); |
719 } | 719 } |
720 #elif defined(OS_POSIX) | 720 #elif defined(OS_POSIX) |
721 BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) { | 721 BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) { |
722 return safe_strerror(error_code); | 722 return base::safe_strerror(error_code); |
723 } | 723 } |
724 #else | 724 #else |
725 #error Not implemented | 725 #error Not implemented |
726 #endif // defined(OS_WIN) | 726 #endif // defined(OS_WIN) |
727 | 727 |
728 | 728 |
729 #if defined(OS_WIN) | 729 #if defined(OS_WIN) |
730 Win32ErrorLogMessage::Win32ErrorLogMessage(const char* file, | 730 Win32ErrorLogMessage::Win32ErrorLogMessage(const char* file, |
731 int line, | 731 int line, |
732 LogSeverity severity, | 732 LogSeverity severity, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { | 806 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { |
807 LogMessage(file, line, LOG_ERROR).stream() | 807 LogMessage(file, line, LOG_ERROR).stream() |
808 << "NOTREACHED() hit."; | 808 << "NOTREACHED() hit."; |
809 } | 809 } |
810 | 810 |
811 } // namespace logging | 811 } // namespace logging |
812 | 812 |
813 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { | 813 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { |
814 return out << base::WideToUTF8(wstr); | 814 return out << base::WideToUTF8(wstr); |
815 } | 815 } |
OLD | NEW |