OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 // Borrowed from Chromium's src/base/threading/thread_checker_impl.h. | 11 // Borrowed from Chromium's src/base/threading/thread_checker_impl.h. |
12 | 12 |
13 #ifndef WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ | 13 #ifndef WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ |
14 #define WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ | 14 #define WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ |
15 | 15 |
16 #include "webrtc/rtc_base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
17 #include "webrtc/rtc_base/platform_thread_types.h" | 17 #include "webrtc/base/platform_thread_types.h" |
18 | 18 |
19 namespace rtc { | 19 namespace rtc { |
20 | 20 |
21 // Real implementation of ThreadChecker, for use in debug mode, or | 21 // Real implementation of ThreadChecker, for use in debug mode, or |
22 // for temporary use in release mode (e.g. to RTC_CHECK on a threading issue | 22 // for temporary use in release mode (e.g. to RTC_CHECK on a threading issue |
23 // seen only in the wild). | 23 // seen only in the wild). |
24 // | 24 // |
25 // Note: You should almost always use the ThreadChecker class to get the | 25 // Note: You should almost always use the ThreadChecker class to get the |
26 // right version for your build configuration. | 26 // right version for your build configuration. |
27 class ThreadCheckerImpl { | 27 class ThreadCheckerImpl { |
(...skipping 11 matching lines...) Expand all Loading... |
39 private: | 39 private: |
40 CriticalSection lock_; | 40 CriticalSection lock_; |
41 // This is mutable so that CalledOnValidThread can set it. | 41 // This is mutable so that CalledOnValidThread can set it. |
42 // It's guarded by |lock_|. | 42 // It's guarded by |lock_|. |
43 mutable PlatformThreadRef valid_thread_; | 43 mutable PlatformThreadRef valid_thread_; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace rtc | 46 } // namespace rtc |
47 | 47 |
48 #endif // WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ | 48 #endif // WEBRTC_RTC_BASE_THREAD_CHECKER_IMPL_H_ |
OLD | NEW |