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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 private: | 47 private: |
48 RTC_DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass); | 48 RTC_DISALLOW_COPY_AND_ASSIGN(ThreadCheckerClass); |
49 }; | 49 }; |
50 | 50 |
51 // Calls ThreadCheckerClass::DoStuff on another thread. | 51 // Calls ThreadCheckerClass::DoStuff on another thread. |
52 class CallDoStuffOnThread : public Thread { | 52 class CallDoStuffOnThread : public Thread { |
53 public: | 53 public: |
54 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class) | 54 explicit CallDoStuffOnThread(ThreadCheckerClass* thread_checker_class) |
55 : Thread(), | 55 : Thread(), |
56 thread_checker_class_(thread_checker_class) { | 56 thread_checker_class_(thread_checker_class) { |
57 SetName("call_do_stuff_on_thread", NULL); | 57 SetName("call_do_stuff_on_thread", nullptr); |
58 } | 58 } |
59 | 59 |
60 void Run() override { thread_checker_class_->DoStuff(); } | 60 void Run() override { thread_checker_class_->DoStuff(); } |
61 | 61 |
62 // New method. Needed since Thread::Join is protected, and it is called by | 62 // New method. Needed since Thread::Join is protected, and it is called by |
63 // the TEST. | 63 // the TEST. |
64 void Join() { | 64 void Join() { |
65 Thread::Join(); | 65 Thread::Join(); |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 ThreadCheckerClass* thread_checker_class_; | 69 ThreadCheckerClass* thread_checker_class_; |
70 | 70 |
71 RTC_DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread); | 71 RTC_DISALLOW_COPY_AND_ASSIGN(CallDoStuffOnThread); |
72 }; | 72 }; |
73 | 73 |
74 // Deletes ThreadCheckerClass on a different thread. | 74 // Deletes ThreadCheckerClass on a different thread. |
75 class DeleteThreadCheckerClassOnThread : public Thread { | 75 class DeleteThreadCheckerClassOnThread : public Thread { |
76 public: | 76 public: |
77 explicit DeleteThreadCheckerClassOnThread( | 77 explicit DeleteThreadCheckerClassOnThread( |
78 ThreadCheckerClass* thread_checker_class) | 78 ThreadCheckerClass* thread_checker_class) |
79 : Thread(), | 79 : Thread(), |
80 thread_checker_class_(thread_checker_class) { | 80 thread_checker_class_(thread_checker_class) { |
81 SetName("delete_thread_checker_class_on_thread", NULL); | 81 SetName("delete_thread_checker_class_on_thread", nullptr); |
82 } | 82 } |
83 | 83 |
84 void Run() override { thread_checker_class_.reset(); } | 84 void Run() override { thread_checker_class_.reset(); } |
85 | 85 |
86 // New method. Needed since Thread::Join is protected, and it is called by | 86 // New method. Needed since Thread::Join is protected, and it is called by |
87 // the TEST. | 87 // the TEST. |
88 void Join() { | 88 void Join() { |
89 Thread::Join(); | 89 Thread::Join(); |
90 } | 90 } |
91 | 91 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 int var_thread_ ACCESS_ON(thread_); | 244 int var_thread_ ACCESS_ON(thread_); |
245 int var_checker_ GUARDED_BY(checker_); | 245 int var_checker_ GUARDED_BY(checker_); |
246 int var_queue_ ACCESS_ON(queue_); | 246 int var_queue_ ACCESS_ON(queue_); |
247 }; | 247 }; |
248 | 248 |
249 // Just in case we ever get lumped together with other compilation units. | 249 // Just in case we ever get lumped together with other compilation units. |
250 #undef ENABLE_THREAD_CHECKER | 250 #undef ENABLE_THREAD_CHECKER |
251 | 251 |
252 } // namespace rtc | 252 } // namespace rtc |
OLD | NEW |