OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 #else // !WEBRTC_WIN | 38 #else // !WEBRTC_WIN |
39 // On POSIX systems, SIGTRAP signals debuggers to break without killing the | 39 // On POSIX systems, SIGTRAP signals debuggers to break without killing the |
40 // process. If a debugger isn't attached, the uncaught SIGTRAP will crash the | 40 // process. If a debugger isn't attached, the uncaught SIGTRAP will crash the |
41 // app. | 41 // app. |
42 raise(SIGTRAP); | 42 raise(SIGTRAP); |
43 #endif | 43 #endif |
44 // If a debugger wasn't attached, we will have crashed by this point. If a | 44 // If a debugger wasn't attached, we will have crashed by this point. If a |
45 // debugger is attached, we'll continue from here. | 45 // debugger is attached, we'll continue from here. |
46 } | 46 } |
47 | 47 |
48 static AssertLogger custom_assert_logger_ = NULL; | 48 static AssertLogger custom_assert_logger_ = nullptr; |
49 | 49 |
50 void SetCustomAssertLogger(AssertLogger logger) { | 50 void SetCustomAssertLogger(AssertLogger logger) { |
51 custom_assert_logger_ = logger; | 51 custom_assert_logger_ = logger; |
52 } | 52 } |
53 | 53 |
54 void LogAssert(const char* function, const char* file, int line, | 54 void LogAssert(const char* function, const char* file, int line, |
55 const char* expression) { | 55 const char* expression) { |
56 if (custom_assert_logger_) { | 56 if (custom_assert_logger_) { |
57 custom_assert_logger_(function, file, line, expression); | 57 custom_assert_logger_(function, file, line, expression); |
58 } else { | 58 } else { |
59 LOG(LS_ERROR) << file << "(" << line << ")" << ": ASSERT FAILED: " | 59 LOG(LS_ERROR) << file << "(" << line << ")" << ": ASSERT FAILED: " |
60 << expression << " @ " << function; | 60 << expression << " @ " << function; |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 bool IsOdd(int n) { | 64 bool IsOdd(int n) { |
65 return (n & 0x1); | 65 return (n & 0x1); |
66 } | 66 } |
67 | 67 |
68 bool IsEven(int n) { | 68 bool IsEven(int n) { |
69 return !IsOdd(n); | 69 return !IsOdd(n); |
70 } | 70 } |
71 | 71 |
72 } // namespace rtc | 72 } // namespace rtc |
OLD | NEW |