OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 Thread* thread, | 113 Thread* thread, |
114 std::unique_ptr<AsyncClosure> closure, | 114 std::unique_ptr<AsyncClosure> closure, |
115 uint32_t id); | 115 uint32_t id); |
116 void DoInvokeDelayed(const Location& posted_from, | 116 void DoInvokeDelayed(const Location& posted_from, |
117 Thread* thread, | 117 Thread* thread, |
118 std::unique_ptr<AsyncClosure> closure, | 118 std::unique_ptr<AsyncClosure> closure, |
119 uint32_t delay_ms, | 119 uint32_t delay_ms, |
120 uint32_t id); | 120 uint32_t id); |
121 volatile int pending_invocations_ = 0; | 121 volatile int pending_invocations_ = 0; |
122 Event invocation_complete_; | 122 Event invocation_complete_; |
123 int destroying_ = 0; | 123 bool destroying_ = false; |
124 friend class AsyncClosure; | 124 friend class AsyncClosure; |
125 | 125 |
126 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); | 126 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); |
127 }; | 127 }; |
128 | 128 |
129 // Similar to AsyncInvoker, but guards against the Thread being destroyed while | 129 // Similar to AsyncInvoker, but guards against the Thread being destroyed while |
130 // there are outstanding dangling pointers to it. It will connect to the current | 130 // there are outstanding dangling pointers to it. It will connect to the current |
131 // thread in the constructor, and will get notified when that thread is | 131 // thread in the constructor, and will get notified when that thread is |
132 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from | 132 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from |
133 // other threads to post functors to the thread it was constructed on. If that | 133 // other threads to post functors to the thread it was constructed on. If that |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void ThreadDestroyed(); | 212 void ThreadDestroyed(); |
213 | 213 |
214 CriticalSection crit_; | 214 CriticalSection crit_; |
215 Thread* thread_ GUARDED_BY(crit_); | 215 Thread* thread_ GUARDED_BY(crit_); |
216 AsyncInvoker invoker_ GUARDED_BY(crit_); | 216 AsyncInvoker invoker_ GUARDED_BY(crit_); |
217 }; | 217 }; |
218 | 218 |
219 } // namespace rtc | 219 } // namespace rtc |
220 | 220 |
221 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ | 221 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ |
OLD | NEW |