Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: webrtc/base/asyncinvoker-inl.h

Issue 2876273002: Fixing race between ~AsyncInvoker and ~AsyncClosure. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« webrtc/base/asyncinvoker.cc ('K') | « webrtc/base/asyncinvoker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 #include "webrtc/base/thread_annotations.h" 21 #include "webrtc/base/thread_annotations.h"
22 22
23 namespace rtc { 23 namespace rtc {
24 24
25 class AsyncInvoker; 25 class AsyncInvoker;
26 26
27 // Helper class for AsyncInvoker. Runs a task and triggers a callback 27 // Helper class for AsyncInvoker. Runs a task and triggers a callback
28 // on the calling thread if necessary. 28 // on the calling thread if necessary.
29 class AsyncClosure { 29 class AsyncClosure {
30 public: 30 public:
31 explicit AsyncClosure(AsyncInvoker* invoker) : invoker_(invoker) {} 31 explicit AsyncClosure(AsyncInvoker* invoker);
32 virtual ~AsyncClosure(); 32 virtual ~AsyncClosure();
33 // Runs the asynchronous task, and triggers a callback to the calling 33 // Runs the asynchronous task, and triggers a callback to the calling
34 // thread if needed. Should be called from the target thread. 34 // thread if needed. Should be called from the target thread.
35 virtual void Execute() = 0; 35 virtual void Execute() = 0;
36 36
37 protected: 37 protected:
38 AsyncInvoker* invoker_; 38 AsyncInvoker* invoker_;
39 }; 39 };
40 40
41 // Simple closure that doesn't trigger a callback for the calling thread. 41 // Simple closure that doesn't trigger a callback for the calling thread.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 TriggerCallback(); 135 TriggerCallback();
136 } 136 }
137 137
138 private: 138 private:
139 FunctorT functor_; 139 FunctorT functor_;
140 }; 140 };
141 141
142 } // namespace rtc 142 } // namespace rtc
143 143
144 #endif // WEBRTC_BASE_ASYNCINVOKER_INL_H_ 144 #endif // WEBRTC_BASE_ASYNCINVOKER_INL_H_
OLDNEW
« webrtc/base/asyncinvoker.cc ('K') | « webrtc/base/asyncinvoker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698