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 |
11 #include <signal.h> | 11 #include <signal.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #if WEBRTC_WIN | 16 #ifdef WEBRTC_WIN |
17 #define WIN32_LEAN_AND_MEAN | 17 #define WIN32_LEAN_AND_MEAN |
18 #include <windows.h> | 18 #include <windows.h> |
19 #endif // WEBRTC_WIN | 19 #endif // WEBRTC_WIN |
20 | 20 |
21 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | 21 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) |
22 #include <CoreServices/CoreServices.h> | 22 #include <CoreServices/CoreServices.h> |
23 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) | 23 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) |
24 | 24 |
25 #include <algorithm> | 25 #include <algorithm> |
26 #include "webrtc/base/common.h" | 26 #include "webrtc/base/common.h" |
27 #include "webrtc/base/logging.h" | 27 #include "webrtc/base/logging.h" |
28 | 28 |
29 ////////////////////////////////////////////////////////////////////// | 29 ////////////////////////////////////////////////////////////////////// |
30 // Assertions | 30 // Assertions |
31 ////////////////////////////////////////////////////////////////////// | 31 ////////////////////////////////////////////////////////////////////// |
32 | 32 |
33 namespace rtc { | 33 namespace rtc { |
34 | 34 |
35 void Break() { | 35 void Break() { |
36 #if WEBRTC_WIN | 36 #ifdef WEBRTC_WIN |
37 ::DebugBreak(); | 37 ::DebugBreak(); |
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 } |
(...skipping 16 matching lines...) Expand all Loading... |
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 |