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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 private: | 134 private: |
135 void OnMessage(Message* msg) override; | 135 void OnMessage(Message* msg) override; |
136 void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure, | 136 void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure, |
137 uint32 id); | 137 uint32 id); |
138 void DoInvokeDelayed(Thread* thread, | 138 void DoInvokeDelayed(Thread* thread, |
139 const scoped_refptr<AsyncClosure>& closure, | 139 const scoped_refptr<AsyncClosure>& closure, |
140 uint32 delay_ms, | 140 uint32 delay_ms, |
141 uint32 id); | 141 uint32 id); |
142 bool destroying_; | 142 bool destroying_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); | 144 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); |
145 }; | 145 }; |
146 | 146 |
147 // Similar to AsyncInvoker, but guards against the Thread being destroyed while | 147 // Similar to AsyncInvoker, but guards against the Thread being destroyed while |
148 // there are outstanding dangling pointers to it. It will connect to the current | 148 // there are outstanding dangling pointers to it. It will connect to the current |
149 // thread in the constructor, and will get notified when that thread is | 149 // thread in the constructor, and will get notified when that thread is |
150 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from | 150 // destroyed. After GuardedAsyncInvoker is constructed, it can be used from |
151 // other threads to post functors to the thread it was constructed on. If that | 151 // other threads to post functors to the thread it was constructed on. If that |
152 // thread dies, any further calls to AsyncInvoke() will be safely ignored. | 152 // thread dies, any further calls to AsyncInvoke() will be safely ignored. |
153 class GuardedAsyncInvoker : public sigslot::has_slots<> { | 153 class GuardedAsyncInvoker : public sigslot::has_slots<> { |
154 public: | 154 public: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 void ThreadDestroyed(); | 221 void ThreadDestroyed(); |
222 | 222 |
223 CriticalSection crit_; | 223 CriticalSection crit_; |
224 Thread* thread_ GUARDED_BY(crit_); | 224 Thread* thread_ GUARDED_BY(crit_); |
225 AsyncInvoker invoker_ GUARDED_BY(crit_); | 225 AsyncInvoker invoker_ GUARDED_BY(crit_); |
226 }; | 226 }; |
227 | 227 |
228 } // namespace rtc | 228 } // namespace rtc |
229 | 229 |
230 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ | 230 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ |
OLD | NEW |