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

Side by Side Diff: base/task_scheduler/utils.cc

Issue 1704113002: TaskScheduler [6] SchedulerWorkerThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s_4_shutdown
Patch Set: CR from robliao Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/task_scheduler/utils.h"
6
7 #include "base/bind.h"
8 #include "base/task_scheduler/priority_queue.h"
9 #include "base/task_scheduler/task_tracker.h"
10
11 namespace base {
12 namespace internal {
13
14 namespace {
15
16 void PostTaskCallback(scoped_refptr<Sequence> sequence,
17 PriorityQueue* priority_queue,
18 scoped_ptr<Task> task) {
19 if (sequence->PushTask(std::move(task))) {
20 // |sequence| was empty before |task| was inserted into it. That means that
21 // |sequence| must be inserted in |priority_queue|.
22 SequenceSortKey sequence_sort_key = sequence->GetSortKey();
gab 2016/03/21 19:11:53 const
fdoray 2016/03/24 19:21:09 Done.
23 priority_queue->BeginTransaction()->Push(make_scoped_ptr(
24 new PriorityQueue::SequenceAndSortKey(sequence, sequence_sort_key)));
gab 2016/03/21 19:11:53 std::move(sequence) Not sure whether compiler can
fdoray 2016/03/24 19:21:09 Done.
25 }
26 }
27
28 } // namespace
29
30 void PostTaskHelper(scoped_ptr<Task> task,
31 scoped_refptr<Sequence> sequence,
32 PriorityQueue* priority_queue,
33 TaskTracker* task_tracker) {
34 DCHECK(task.get());
gab 2016/03/21 19:11:53 No .get() for bool operations here and below
fdoray 2016/03/24 19:21:09 Done.
35 DCHECK(sequence.get());
36 DCHECK(priority_queue);
37 DCHECK(task_tracker);
38
39 task_tracker->PostTask(Bind(&PostTaskCallback, sequence, priority_queue),
gab 2016/03/21 19:11:53 std::move(sequence)
fdoray 2016/03/24 19:21:09 Done.
40 std::move(task));
41 }
42
43 } // namespace internal
44 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698