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

Side by Side Diff: webrtc/base/criticalsection.h

Issue 2384693002: Test RTC_DCHECK_IS_ON instead of checking DCHECK_ALWAYS_ON everywhere (Closed)
Patch Set: !!! Created 4 years, 2 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/checks.h ('k') | webrtc/base/sequenced_task_checker.h » ('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 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 #ifndef WEBRTC_BASE_CRITICALSECTION_H_ 11 #ifndef WEBRTC_BASE_CRITICALSECTION_H_
12 #define WEBRTC_BASE_CRITICALSECTION_H_ 12 #define WEBRTC_BASE_CRITICALSECTION_H_
13 13
14 #include "webrtc/base/atomicops.h" 14 #include "webrtc/base/atomicops.h"
15 #include "webrtc/base/checks.h"
15 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
16 #include "webrtc/base/thread_annotations.h" 17 #include "webrtc/base/thread_annotations.h"
17 #include "webrtc/base/platform_thread_types.h" 18 #include "webrtc/base/platform_thread_types.h"
18 19
19 #if defined(WEBRTC_WIN) 20 #if defined(WEBRTC_WIN)
20 // Include winsock2.h before including <windows.h> to maintain consistency with 21 // Include winsock2.h before including <windows.h> to maintain consistency with
21 // win32.h. We can't include win32.h directly here since it pulls in 22 // win32.h. We can't include win32.h directly here since it pulls in
22 // headers such as basictypes.h which causes problems in Chromium where webrtc 23 // headers such as basictypes.h which causes problems in Chromium where webrtc
23 // exists as two separate projects, webrtc and libjingle. 24 // exists as two separate projects, webrtc and libjingle.
24 #include <winsock2.h> 25 #include <winsock2.h>
25 #include <windows.h> 26 #include <windows.h>
26 #include <sal.h> // must come after windows headers. 27 #include <sal.h> // must come after windows headers.
27 #endif // defined(WEBRTC_WIN) 28 #endif // defined(WEBRTC_WIN)
28 29
29 #if defined(WEBRTC_POSIX) 30 #if defined(WEBRTC_POSIX)
30 #include <pthread.h> 31 #include <pthread.h>
31 #endif 32 #endif
32 33
33 // See notes in the 'Performance' unit test for the effects of this flag. 34 // See notes in the 'Performance' unit test for the effects of this flag.
34 #define USE_NATIVE_MUTEX_ON_MAC 0 35 #define USE_NATIVE_MUTEX_ON_MAC 0
35 36
36 #if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC 37 #if defined(WEBRTC_MAC) && !USE_NATIVE_MUTEX_ON_MAC
37 #include <dispatch/dispatch.h> 38 #include <dispatch/dispatch.h>
38 #endif 39 #endif
39 40
40 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) 41 #define CS_DEBUG_CHECKS RTC_DCHECK_IS_ON
41 #define CS_DEBUG_CHECKS 1
42 #else
43 #define CS_DEBUG_CHECKS 0
44 #endif
45 42
46 #if CS_DEBUG_CHECKS 43 #if CS_DEBUG_CHECKS
47 #define CS_DEBUG_CODE(x) x 44 #define CS_DEBUG_CODE(x) x
48 #else // !CS_DEBUG_CHECKS 45 #else // !CS_DEBUG_CHECKS
49 #define CS_DEBUG_CODE(x) 46 #define CS_DEBUG_CODE(x)
50 #endif // !CS_DEBUG_CHECKS 47 #endif // !CS_DEBUG_CHECKS
51 48
52 namespace rtc { 49 namespace rtc {
53 50
54 // Locking methods (Enter, TryEnter, Leave)are const to permit protecting 51 // Locking methods (Enter, TryEnter, Leave)are const to permit protecting
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 explicit GlobalLockScope(GlobalLockPod* lock) EXCLUSIVE_LOCK_FUNCTION(lock); 142 explicit GlobalLockScope(GlobalLockPod* lock) EXCLUSIVE_LOCK_FUNCTION(lock);
146 ~GlobalLockScope() UNLOCK_FUNCTION(); 143 ~GlobalLockScope() UNLOCK_FUNCTION();
147 private: 144 private:
148 GlobalLockPod* const lock_; 145 GlobalLockPod* const lock_;
149 RTC_DISALLOW_COPY_AND_ASSIGN(GlobalLockScope); 146 RTC_DISALLOW_COPY_AND_ASSIGN(GlobalLockScope);
150 }; 147 };
151 148
152 } // namespace rtc 149 } // namespace rtc
153 150
154 #endif // WEBRTC_BASE_CRITICALSECTION_H_ 151 #endif // WEBRTC_BASE_CRITICALSECTION_H_
OLDNEW
« no previous file with comments | « webrtc/base/checks.h ('k') | webrtc/base/sequenced_task_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698