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

Side by Side Diff: webrtc/rtc_base/task_queue.h

Issue 3013433002: Convert mac/ios TaskQueue implementation to pimpl convention. (Closed)
Patch Set: Adding lost TaskQueue::Current method. Created 3 years, 3 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/rtc_base/task_queue_gcd.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 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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
11 #ifndef WEBRTC_RTC_BASE_TASK_QUEUE_H_ 11 #ifndef WEBRTC_RTC_BASE_TASK_QUEUE_H_
12 #define WEBRTC_RTC_BASE_TASK_QUEUE_H_ 12 #define WEBRTC_RTC_BASE_TASK_QUEUE_H_
13 13
14 #include <list> 14 #include <list>
15 #include <memory> 15 #include <memory>
16 #include <queue> 16 #include <queue>
17 #include <type_traits> 17 #include <type_traits>
18 18
19 #if defined(WEBRTC_MAC)
20 #include <dispatch/dispatch.h>
21 #endif
22
23 #include "webrtc/rtc_base/constructormagic.h" 19 #include "webrtc/rtc_base/constructormagic.h"
24 #include "webrtc/rtc_base/criticalsection.h" 20 #include "webrtc/rtc_base/criticalsection.h"
25 #include "webrtc/rtc_base/scoped_ref_ptr.h" 21 #include "webrtc/rtc_base/scoped_ref_ptr.h"
26 22
27 namespace rtc { 23 namespace rtc {
28 24
29 // Base interface for asynchronously executed tasks. 25 // Base interface for asynchronously executed tasks.
30 // The interface basically consists of a single function, Run(), that executes 26 // The interface basically consists of a single function, Run(), that executes
31 // on the target queue. For more details see the Run() method and TaskQueue. 27 // on the target queue. For more details see the Run() method and TaskQueue.
32 class QueuedTask { 28 class QueuedTask {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 225 }
230 226
231 template <class Closure1, class Closure2> 227 template <class Closure1, class Closure2>
232 void PostTaskAndReply(const Closure1& task, const Closure2& reply) { 228 void PostTaskAndReply(const Closure1& task, const Closure2& reply) {
233 PostTaskAndReply( 229 PostTaskAndReply(
234 std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)), 230 std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)),
235 std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply))); 231 std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply)));
236 } 232 }
237 233
238 private: 234 private:
239 #if defined(WEBRTC_MAC)
240 struct QueueContext;
241 struct TaskContext;
242 struct PostTaskAndReplyContext;
243 dispatch_queue_t queue_;
244 QueueContext* const context_;
245 #else
246 class Impl; 235 class Impl;
247 const scoped_refptr<Impl> impl_; 236 const scoped_refptr<Impl> impl_;
248 #endif
249 237
250 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue); 238 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue);
251 }; 239 };
252 240
253 } // namespace rtc 241 } // namespace rtc
254 242
255 #endif // WEBRTC_RTC_BASE_TASK_QUEUE_H_ 243 #endif // WEBRTC_RTC_BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/rtc_base/task_queue_gcd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698