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

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: Change the PostMultipleDelayed test to fire tasks targeted at different intervals 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') | webrtc/base/task_queue_win.cc » ('J')
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> 16 #include <vector>
the sun 2017/03/07 11:24:24 Hmm. I don't find a reference to vector in this fi
tommi 2017/03/09 20:27:42 Removed. (I added it while it was supposed to have
17 17
18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_BUILD_LIBEVENT) 18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_BUILD_LIBEVENT)
19 #include <dispatch/dispatch.h> 19 #include <dispatch/dispatch.h>
20 #endif 20 #endif
21 21
22 #include "webrtc/base/constructormagic.h" 22 #include "webrtc/base/constructormagic.h"
23 #include "webrtc/base/criticalsection.h" 23 #include "webrtc/base/criticalsection.h"
24 24
25 #if defined(WEBRTC_WIN) || defined(WEBRTC_BUILD_LIBEVENT) 25 #if defined(WEBRTC_WIN) || defined(WEBRTC_BUILD_LIBEVENT)
26 #include "webrtc/base/platform_thread.h" 26 #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_); 267 std::list<std::unique_ptr<QueuedTask>> pending_ GUARDED_BY(pending_lock_);
268 std::list<scoped_refptr<ReplyTaskOwnerRef>> pending_replies_ 268 std::list<scoped_refptr<ReplyTaskOwnerRef>> pending_replies_
269 GUARDED_BY(pending_lock_); 269 GUARDED_BY(pending_lock_);
270 #elif defined(WEBRTC_MAC) 270 #elif defined(WEBRTC_MAC)
271 struct QueueContext; 271 struct QueueContext;
272 struct TaskContext; 272 struct TaskContext;
273 struct PostTaskAndReplyContext; 273 struct PostTaskAndReplyContext;
274 dispatch_queue_t queue_; 274 dispatch_queue_t queue_;
275 QueueContext* const context_; 275 QueueContext* const context_;
276 #elif defined(WEBRTC_WIN) 276 #elif defined(WEBRTC_WIN)
277 class MultimediaTimer; 277 class ThreadState;
278 typedef std::unordered_map<UINT_PTR, std::unique_ptr<QueuedTask>>
279 DelayedTasks;
280 static void ThreadMain(void* context); 278 static void ThreadMain(void* context);
281 static bool ProcessQueuedMessages(DelayedTasks* delayed_tasks,
282 std::vector<MultimediaTimer>* timers);
283 279
284 class WorkerThread : public PlatformThread { 280 class WorkerThread : public PlatformThread {
285 public: 281 public:
286 WorkerThread(ThreadRunFunction func, 282 WorkerThread(ThreadRunFunction func,
287 void* obj, 283 void* obj,
288 const char* thread_name, 284 const char* thread_name,
289 ThreadPriority priority) 285 ThreadPriority priority)
290 : PlatformThread(func, obj, thread_name, priority) {} 286 : PlatformThread(func, obj, thread_name, priority) {}
291 287
292 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) { 288 bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) {
293 return PlatformThread::QueueAPC(apc_function, data); 289 return PlatformThread::QueueAPC(apc_function, data);
294 } 290 }
295 }; 291 };
296 WorkerThread thread_; 292 WorkerThread thread_;
297 #else 293 #else
298 #error not supported. 294 #error not supported.
299 #endif 295 #endif
300 296
301 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue); 297 RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue);
302 }; 298 };
303 299
304 } // namespace rtc 300 } // namespace rtc
305 301
306 #endif // WEBRTC_BASE_TASK_QUEUE_H_ 302 #endif // WEBRTC_BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/task_queue_unittest.cc » ('j') | webrtc/base/task_queue_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698