Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2011 University of Szeged. All rights reserved. | 4 * Copyright (C) 2011 University of Szeged. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 formatWithNewline[formatLength] = '\n'; | 121 formatWithNewline[formatLength] = '\n'; |
| 122 formatWithNewline[formatLength + 1] = 0; | 122 formatWithNewline[formatLength + 1] = 0; |
| 123 | 123 |
| 124 vprintf_stderr_common(formatWithNewline.get(), args); | 124 vprintf_stderr_common(formatWithNewline.get(), args); |
| 125 } | 125 } |
| 126 | 126 |
| 127 #if COMPILER(GCC) | 127 #if COMPILER(GCC) |
| 128 #pragma GCC diagnostic pop | 128 #pragma GCC diagnostic pop |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 namespace { | |
| 132 | |
| 133 class FrameToNameScope { | |
|
Nico
2017/05/03 14:55:35
The last client of this was removed in https://cod
| |
| 134 public: | |
| 135 explicit FrameToNameScope(void*); | |
| 136 ~FrameToNameScope(); | |
| 137 const char* nullableName() { return m_name; } | |
| 138 | |
| 139 private: | |
| 140 const char* m_name; | |
| 141 char* m_cxaDemangled; | |
| 142 }; | |
| 143 | |
| 144 FrameToNameScope::FrameToNameScope(void* addr) : m_name(0), m_cxaDemangled(0) { | |
| 145 #if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__)) | |
| 146 Dl_info info; | |
| 147 if (!dladdr(addr, &info) || !info.dli_sname) | |
| 148 return; | |
| 149 const char* mangledName = info.dli_sname; | |
| 150 if ((m_cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0))) | |
| 151 m_name = m_cxaDemangled; | |
| 152 else | |
| 153 m_name = mangledName; | |
| 154 #else | |
| 155 (void)addr; | |
| 156 #endif | |
| 157 } | |
| 158 | |
| 159 FrameToNameScope::~FrameToNameScope() { | |
| 160 free(m_cxaDemangled); | |
| 161 } | |
| 162 | |
| 163 } // anonymous namespace | |
| 164 | |
| 165 #if !LOG_DISABLED | 131 #if !LOG_DISABLED |
| 166 namespace WTF { | 132 namespace WTF { |
| 167 | 133 |
| 168 ScopedLogger::ScopedLogger(bool condition, const char* format, ...) | 134 ScopedLogger::ScopedLogger(bool condition, const char* format, ...) |
| 169 : parent_(condition ? Current() : 0), multiline_(false) { | 135 : parent_(condition ? Current() : 0), multiline_(false) { |
| 170 if (!condition) | 136 if (!condition) |
| 171 return; | 137 return; |
| 172 | 138 |
| 173 va_list args; | 139 va_list args; |
| 174 va_start(args, format); | 140 va_start(args, format); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 218 |
| 253 } // namespace WTF | 219 } // namespace WTF |
| 254 #endif // !LOG_DISABLED | 220 #endif // !LOG_DISABLED |
| 255 | 221 |
| 256 void WTFLogAlways(const char* format, ...) { | 222 void WTFLogAlways(const char* format, ...) { |
| 257 va_list args; | 223 va_list args; |
| 258 va_start(args, format); | 224 va_start(args, format); |
| 259 vprintf_stderr_with_trailing_newline(format, args); | 225 vprintf_stderr_with_trailing_newline(format, args); |
| 260 va_end(args); | 226 va_end(args); |
| 261 } | 227 } |
| OLD | NEW |