Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: webrtc/base/platform_thread.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/network.cc ('k') | webrtc/base/ratetracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 19 matching lines...) Expand all
30 ret = pthread_mach_thread_np(pthread_self()); 30 ret = pthread_mach_thread_np(pthread_self());
31 #elif defined(WEBRTC_LINUX) 31 #elif defined(WEBRTC_LINUX)
32 ret = syscall(__NR_gettid); 32 ret = syscall(__NR_gettid);
33 #elif defined(WEBRTC_ANDROID) 33 #elif defined(WEBRTC_ANDROID)
34 ret = gettid(); 34 ret = gettid();
35 #else 35 #else
36 // Default implementation for nacl and solaris. 36 // Default implementation for nacl and solaris.
37 ret = reinterpret_cast<pid_t>(pthread_self()); 37 ret = reinterpret_cast<pid_t>(pthread_self());
38 #endif 38 #endif
39 #endif // defined(WEBRTC_POSIX) 39 #endif // defined(WEBRTC_POSIX)
40 DCHECK(ret); 40 RTC_DCHECK(ret);
41 return ret; 41 return ret;
42 } 42 }
43 43
44 PlatformThreadRef CurrentThreadRef() { 44 PlatformThreadRef CurrentThreadRef() {
45 #if defined(WEBRTC_WIN) 45 #if defined(WEBRTC_WIN)
46 return GetCurrentThreadId(); 46 return GetCurrentThreadId();
47 #elif defined(WEBRTC_POSIX) 47 #elif defined(WEBRTC_POSIX)
48 return pthread_self(); 48 return pthread_self();
49 #endif 49 #endif
50 } 50 }
51 51
52 bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) { 52 bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) {
53 #if defined(WEBRTC_WIN) 53 #if defined(WEBRTC_WIN)
54 return a == b; 54 return a == b;
55 #elif defined(WEBRTC_POSIX) 55 #elif defined(WEBRTC_POSIX)
56 return pthread_equal(a, b); 56 return pthread_equal(a, b);
57 #endif 57 #endif
58 } 58 }
59 59
60 void SetCurrentThreadName(const char* name) { 60 void SetCurrentThreadName(const char* name) {
61 DCHECK(strlen(name) < 64); 61 RTC_DCHECK(strlen(name) < 64);
62 #if defined(WEBRTC_WIN) 62 #if defined(WEBRTC_WIN)
63 struct { 63 struct {
64 DWORD dwType; 64 DWORD dwType;
65 LPCSTR szName; 65 LPCSTR szName;
66 DWORD dwThreadID; 66 DWORD dwThreadID;
67 DWORD dwFlags; 67 DWORD dwFlags;
68 } threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0}; 68 } threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
69 69
70 __try { 70 __try {
71 ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD), 71 ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
72 reinterpret_cast<ULONG_PTR*>(&threadname_info)); 72 reinterpret_cast<ULONG_PTR*>(&threadname_info));
73 } __except (EXCEPTION_EXECUTE_HANDLER) { 73 } __except (EXCEPTION_EXECUTE_HANDLER) {
74 } 74 }
75 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) 75 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
76 prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); 76 prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
77 #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) 77 #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
78 pthread_setname_np(name); 78 pthread_setname_np(name);
79 #endif 79 #endif
80 } 80 }
81 81
82 } // namespace rtc 82 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/network.cc ('k') | webrtc/base/ratetracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698