| OLD | NEW |
| 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 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 template <class Closure1, class Closure2> | 226 template <class Closure1, class Closure2> |
| 227 void PostTaskAndReply(const Closure1& task, const Closure2& reply) { | 227 void PostTaskAndReply(const Closure1& task, const Closure2& reply) { |
| 228 PostTaskAndReply( | 228 PostTaskAndReply( |
| 229 std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)), | 229 std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)), |
| 230 std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply))); | 230 std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply))); |
| 231 } | 231 } |
| 232 | 232 |
| 233 private: | 233 private: |
| 234 #if defined(WEBRTC_BUILD_LIBEVENT) | 234 #if defined(WEBRTC_BUILD_LIBEVENT) |
| 235 static bool ThreadMain(void* context); | 235 static void ThreadMain(void* context); |
| 236 static void OnWakeup(int socket, short flags, void* context); // NOLINT | 236 static void OnWakeup(int socket, short flags, void* context); // NOLINT |
| 237 static void RunTask(int fd, short flags, void* context); // NOLINT | 237 static void RunTask(int fd, short flags, void* context); // NOLINT |
| 238 static void RunTimer(int fd, short flags, void* context); // NOLINT | 238 static void RunTimer(int fd, short flags, void* context); // NOLINT |
| 239 | 239 |
| 240 class PostAndReplyTask; | 240 class PostAndReplyTask; |
| 241 class SetTimerTask; | 241 class SetTimerTask; |
| 242 | 242 |
| 243 void PrepareReplyTask(PostAndReplyTask* reply_task); | 243 void PrepareReplyTask(PostAndReplyTask* reply_task); |
| 244 void ReplyTaskDone(PostAndReplyTask* reply_task); | 244 void ReplyTaskDone(PostAndReplyTask* reply_task); |
| 245 | 245 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 256 #elif defined(WEBRTC_MAC) | 256 #elif defined(WEBRTC_MAC) |
| 257 struct QueueContext; | 257 struct QueueContext; |
| 258 struct TaskContext; | 258 struct TaskContext; |
| 259 struct PostTaskAndReplyContext; | 259 struct PostTaskAndReplyContext; |
| 260 dispatch_queue_t queue_; | 260 dispatch_queue_t queue_; |
| 261 QueueContext* const context_; | 261 QueueContext* const context_; |
| 262 #elif defined(WEBRTC_WIN) | 262 #elif defined(WEBRTC_WIN) |
| 263 class MultimediaTimer; | 263 class MultimediaTimer; |
| 264 typedef std::unordered_map<UINT_PTR, std::unique_ptr<QueuedTask>> | 264 typedef std::unordered_map<UINT_PTR, std::unique_ptr<QueuedTask>> |
| 265 DelayedTasks; | 265 DelayedTasks; |
| 266 static bool ThreadMain(void* context); | 266 static void ThreadMain(void* context); |
| 267 static bool ProcessQueuedMessages(DelayedTasks* delayed_tasks, | 267 static bool ProcessQueuedMessages(DelayedTasks* delayed_tasks, |
| 268 std::vector<MultimediaTimer>* timers); | 268 std::vector<MultimediaTimer>* timers); |
| 269 | 269 |
| 270 class WorkerThread : public PlatformThread { | 270 class WorkerThread : public PlatformThread { |
| 271 public: | 271 public: |
| 272 WorkerThread(ThreadRunFunction func, void* obj, const char* thread_name) | 272 WorkerThread(ThreadRunFunction func, void* obj, const char* thread_name) |
| 273 : PlatformThread(func, obj, thread_name) {} | 273 : PlatformThread(func, obj, thread_name) {} |
| 274 | 274 |
| 275 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) { | 275 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) { |
| 276 return PlatformThread::QueueAPC(apc_function, data); | 276 return PlatformThread::QueueAPC(apc_function, data); |
| 277 } | 277 } |
| 278 }; | 278 }; |
| 279 WorkerThread thread_; | 279 WorkerThread thread_; |
| 280 #else | 280 #else |
| 281 #error not supported. | 281 #error not supported. |
| 282 #endif | 282 #endif |
| 283 | 283 |
| 284 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 284 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 285 }; | 285 }; |
| 286 | 286 |
| 287 } // namespace rtc | 287 } // namespace rtc |
| 288 | 288 |
| 289 #endif // WEBRTC_BASE_TASK_QUEUE_H_ | 289 #endif // WEBRTC_BASE_TASK_QUEUE_H_ |
| OLD | NEW |