OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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_RTC_BASE_RACE_CHECKER_H_ | 11 #ifndef WEBRTC_RTC_BASE_RACE_CHECKER_H_ |
12 #define WEBRTC_RTC_BASE_RACE_CHECKER_H_ | 12 #define WEBRTC_RTC_BASE_RACE_CHECKER_H_ |
13 | 13 |
14 #include "webrtc/base/checks.h" | 14 #include "webrtc/rtc_base/checks.h" |
15 #include "webrtc/base/platform_thread.h" | 15 #include "webrtc/rtc_base/platform_thread.h" |
16 #include "webrtc/base/thread_annotations.h" | 16 #include "webrtc/rtc_base/thread_annotations.h" |
17 | 17 |
18 namespace rtc { | 18 namespace rtc { |
19 | 19 |
20 namespace internal { | 20 namespace internal { |
21 class RaceCheckerScope; | 21 class RaceCheckerScope; |
22 } // namespace internal | 22 } // namespace internal |
23 | 23 |
24 // Best-effort race-checking implementation. This primitive uses no | 24 // Best-effort race-checking implementation. This primitive uses no |
25 // synchronization at all to be as-fast-as-possible in the non-racy case. | 25 // synchronization at all to be as-fast-as-possible in the non-racy case. |
26 class LOCKABLE RaceChecker { | 26 class LOCKABLE RaceChecker { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #if RTC_DCHECK_IS_ON | 69 #if RTC_DCHECK_IS_ON |
70 #define RTC_DCHECK_RUNS_SERIALIZED(x) \ | 70 #define RTC_DCHECK_RUNS_SERIALIZED(x) \ |
71 rtc::internal::RaceCheckerScope race_checker(x); \ | 71 rtc::internal::RaceCheckerScope race_checker(x); \ |
72 RTC_DCHECK(!race_checker.RaceDetected()) | 72 RTC_DCHECK(!race_checker.RaceDetected()) |
73 #else | 73 #else |
74 #define RTC_DCHECK_RUNS_SERIALIZED(x) \ | 74 #define RTC_DCHECK_RUNS_SERIALIZED(x) \ |
75 rtc::internal::RaceCheckerScopeDoNothing race_checker(x) | 75 rtc::internal::RaceCheckerScopeDoNothing race_checker(x) |
76 #endif | 76 #endif |
77 | 77 |
78 #endif // WEBRTC_RTC_BASE_RACE_CHECKER_H_ | 78 #endif // WEBRTC_RTC_BASE_RACE_CHECKER_H_ |
OLD | NEW |