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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Simple class to exercise the basics of ThreadChecker. | 32 // Simple class to exercise the basics of ThreadChecker. |
33 // Both the destructor and DoStuff should verify that they were | 33 // Both the destructor and DoStuff should verify that they were |
34 // called on the same thread as the constructor. | 34 // called on the same thread as the constructor. |
35 class ThreadCheckerClass : public ThreadChecker { | 35 class ThreadCheckerClass : public ThreadChecker { |
36 public: | 36 public: |
37 ThreadCheckerClass() {} | 37 ThreadCheckerClass() {} |
38 | 38 |
39 // Verifies that it was called on the same thread as the constructor. | 39 // Verifies that it was called on the same thread as the constructor. |
40 void DoStuff() { | 40 void DoStuff() { RTC_DCHECK(CalledOnValidThread()); } |
41 DCHECK(CalledOnValidThread()); | |
42 } | |
43 | 41 |
44 void DetachFromThread() { | 42 void DetachFromThread() { |
45 ThreadChecker::DetachFromThread(); | 43 ThreadChecker::DetachFromThread(); |
46 } | 44 } |
47 | 45 |
48 static void MethodOnDifferentThreadImpl(); | 46 static void MethodOnDifferentThreadImpl(); |
49 static void DetachThenCallFromDifferentThreadImpl(); | 47 static void DetachThenCallFromDifferentThreadImpl(); |
50 | 48 |
51 private: | 49 private: |
52 RTC_DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass); | 50 RTC_DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); | 190 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); |
193 } | 191 } |
194 #endif // ENABLE_THREAD_CHECKER | 192 #endif // ENABLE_THREAD_CHECKER |
195 | 193 |
196 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER | 194 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER |
197 | 195 |
198 // Just in case we ever get lumped together with other compilation units. | 196 // Just in case we ever get lumped together with other compilation units. |
199 #undef ENABLE_THREAD_CHECKER | 197 #undef ENABLE_THREAD_CHECKER |
200 | 198 |
201 } // namespace rtc | 199 } // namespace rtc |
OLD | NEW |