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

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

Issue 1173353002: Remove all glue interfaces and use existing webrtc interfaces (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | webrtc/base/asyncinvoker.cc » ('j') | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // completion. Returns immediately. 75 // completion. Returns immediately.
76 template <class ReturnT, class FunctorT> 76 template <class ReturnT, class FunctorT>
77 void AsyncInvoke(Thread* thread, 77 void AsyncInvoke(Thread* thread,
78 const FunctorT& functor, 78 const FunctorT& functor,
79 uint32 id = 0) { 79 uint32 id = 0) {
80 scoped_refptr<AsyncClosure> closure( 80 scoped_refptr<AsyncClosure> closure(
81 new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor)); 81 new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
82 DoInvoke(thread, closure, id); 82 DoInvoke(thread, closure, id);
83 } 83 }
84 84
85 // Call |functor| asynchronously on |thread| with |delay_ms|, with no callback
86 // upon completion. Returns immediately.
87 template <class ReturnT, class FunctorT>
88 void AsyncInvokeDelayed(Thread* thread,
89 const FunctorT& functor,
90 uint32 delay_ms,
91 uint32 id = 0) {
92 scoped_refptr<AsyncClosure> closure(
93 new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
94 DoInvokeDelayed(thread, closure, delay_ms, id);
95 }
96
85 // Call |functor| asynchronously on |thread|, calling |callback| when done. 97 // Call |functor| asynchronously on |thread|, calling |callback| when done.
86 template <class ReturnT, class FunctorT, class HostT> 98 template <class ReturnT, class FunctorT, class HostT>
87 void AsyncInvoke(Thread* thread, 99 void AsyncInvoke(Thread* thread,
88 const FunctorT& functor, 100 const FunctorT& functor,
89 void (HostT::*callback)(ReturnT), 101 void (HostT::*callback)(ReturnT),
90 HostT* callback_host, 102 HostT* callback_host,
91 uint32 id = 0) { 103 uint32 id = 0) {
92 scoped_refptr<AsyncClosure> closure( 104 scoped_refptr<AsyncClosure> closure(
93 new RefCountedObject<NotifyingAsyncClosure<ReturnT, FunctorT, HostT> >( 105 new RefCountedObject<NotifyingAsyncClosure<ReturnT, FunctorT, HostT> >(
94 this, Thread::Current(), functor, callback, callback_host)); 106 this, Thread::Current(), functor, callback, callback_host));
(...skipping 21 matching lines...) Expand all
116 // behavior is desired, call Flush() before destroying this object. 128 // behavior is desired, call Flush() before destroying this object.
117 void Flush(Thread* thread, uint32 id = MQID_ANY); 129 void Flush(Thread* thread, uint32 id = MQID_ANY);
118 130
119 // Signaled when this object is destructed. 131 // Signaled when this object is destructed.
120 sigslot::signal0<> SignalInvokerDestroyed; 132 sigslot::signal0<> SignalInvokerDestroyed;
121 133
122 private: 134 private:
123 void OnMessage(Message* msg) override; 135 void OnMessage(Message* msg) override;
124 void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure, 136 void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure,
125 uint32 id); 137 uint32 id);
126 138 void DoInvokeDelayed(Thread* thread,
139 const scoped_refptr<AsyncClosure>& closure,
140 uint32 delay_ms,
141 uint32 id);
127 bool destroying_; 142 bool destroying_;
128 143
129 DISALLOW_COPY_AND_ASSIGN(AsyncInvoker); 144 DISALLOW_COPY_AND_ASSIGN(AsyncInvoker);
130 }; 145 };
131 146
132 } // namespace rtc 147 } // namespace rtc
133 148
134 149
135 #endif // WEBRTC_BASE_ASYNCINVOKER_H_ 150 #endif // WEBRTC_BASE_ASYNCINVOKER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/asyncinvoker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698