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

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

Issue 2733723002: Refactor Windows TaskQueue code to only need a single high res timer. (Closed)
Patch Set: use greater<> and not greater_or_equal Created 3 years, 9 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/task_queue_unittest.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_BASE_TASK_QUEUE_H_ 11 #ifndef WEBRTC_BASE_TASK_QUEUE_H_
12 #define WEBRTC_BASE_TASK_QUEUE_H_ 12 #define WEBRTC_BASE_TASK_QUEUE_H_
13 13
14 #include <list> 14 #include <list>
15 #include <memory> 15 #include <memory>
16 #include <unordered_map>
17 16
18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_BUILD_LIBEVENT) 17 #if defined(WEBRTC_MAC) && !defined(WEBRTC_BUILD_LIBEVENT)
19 #include <dispatch/dispatch.h> 18 #include <dispatch/dispatch.h>
20 #endif 19 #endif
21 20
22 #include "webrtc/base/constructormagic.h" 21 #include "webrtc/base/constructormagic.h"
23 #include "webrtc/base/criticalsection.h" 22 #include "webrtc/base/criticalsection.h"
24 23
25 #if defined(WEBRTC_WIN) || defined(WEBRTC_BUILD_LIBEVENT) 24 #if defined(WEBRTC_WIN) || defined(WEBRTC_BUILD_LIBEVENT)
26 #include "webrtc/base/platform_thread.h" 25 #include "webrtc/base/platform_thread.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 std::list<std::unique_ptr<QueuedTask>> pending_ GUARDED_BY(pending_lock_); 266 std::list<std::unique_ptr<QueuedTask>> pending_ GUARDED_BY(pending_lock_);
268 std::list<scoped_refptr<ReplyTaskOwnerRef>> pending_replies_ 267 std::list<scoped_refptr<ReplyTaskOwnerRef>> pending_replies_
269 GUARDED_BY(pending_lock_); 268 GUARDED_BY(pending_lock_);
270 #elif defined(WEBRTC_MAC) 269 #elif defined(WEBRTC_MAC)
271 struct QueueContext; 270 struct QueueContext;
272 struct TaskContext; 271 struct TaskContext;
273 struct PostTaskAndReplyContext; 272 struct PostTaskAndReplyContext;
274 dispatch_queue_t queue_; 273 dispatch_queue_t queue_;
275 QueueContext* const context_; 274 QueueContext* const context_;
276 #elif defined(WEBRTC_WIN) 275 #elif defined(WEBRTC_WIN)
277 class MultimediaTimer; 276 class ThreadState;
278 typedef std::unordered_map<UINT_PTR, std::unique_ptr<QueuedTask>>
279 DelayedTasks;
280 static void ThreadMain(void* context); 277 static void ThreadMain(void* context);
281 static bool ProcessQueuedMessages(DelayedTasks* delayed_tasks,
282 std::vector<MultimediaTimer>* timers);
283 278
284 class WorkerThread : public PlatformThread { 279 class WorkerThread : public PlatformThread {
285 public: 280 public:
286 WorkerThread(ThreadRunFunction func, 281 WorkerThread(ThreadRunFunction func,
287 void* obj, 282 void* obj,
288 const char* thread_name, 283 const char* thread_name,
289 ThreadPriority priority) 284 ThreadPriority priority)
290 : PlatformThread(func, obj, thread_name, priority) {} 285 : PlatformThread(func, obj, thread_name, priority) {}
291 286
292 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) { 287 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) {
293 return PlatformThread::QueueAPC(apc_function, data); 288 return PlatformThread::QueueAPC(apc_function, data);
294 } 289 }
295 }; 290 };
296 WorkerThread thread_; 291 WorkerThread thread_;
297 #else 292 #else
298 #error not supported. 293 #error not supported.
299 #endif 294 #endif
300 295
301 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue); 296 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue);
302 }; 297 };
303 298
304 } // namespace rtc 299 } // namespace rtc
305 300
306 #endif // WEBRTC_BASE_TASK_QUEUE_H_ 301 #endif // WEBRTC_BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/task_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698