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

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

Issue 1890163003: TaskScheduler: Add delayed run time to the constructor of Task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@7_sequenced
Patch Set: self review Created 4 years, 8 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 | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/task_scheduler/utils_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 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/task_scheduler/utils.h" 5 #include "base/task_scheduler/utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 SchedulerTaskExecutor* executor, 26 SchedulerTaskExecutor* executor,
27 TaskTracker* task_tracker) { 27 TaskTracker* task_tracker) {
28 DCHECK(!closure.is_null()); 28 DCHECK(!closure.is_null());
29 DCHECK(sequence); 29 DCHECK(sequence);
30 DCHECK(executor); 30 DCHECK(executor);
31 DCHECK(task_tracker); 31 DCHECK(task_tracker);
32 32
33 // TODO(fdoray): Support delayed tasks. 33 // TODO(fdoray): Support delayed tasks.
34 DCHECK(delay.is_zero()); 34 DCHECK(delay.is_zero());
35 35
36 std::unique_ptr<Task> task(new Task(posted_from, closure, traits)); 36 std::unique_ptr<Task> task(
37 new Task(posted_from, closure, traits, TimeTicks()));
37 38
38 if (!task_tracker->WillPostTask(task.get())) 39 if (!task_tracker->WillPostTask(task.get()))
39 return false; 40 return false;
40 41
41 executor->PostTaskWithSequence(std::move(task), std::move(sequence)); 42 executor->PostTaskWithSequence(std::move(task), std::move(sequence));
42 return true; 43 return true;
43 } 44 }
44 45
45 bool AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task, 46 bool AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task,
46 scoped_refptr<Sequence> sequence, 47 scoped_refptr<Sequence> sequence,
(...skipping 18 matching lines...) Expand all
65 priority_queue->BeginTransaction()->Push( 66 priority_queue->BeginTransaction()->Push(
66 WrapUnique(new PriorityQueue::SequenceAndSortKey(std::move(sequence), 67 WrapUnique(new PriorityQueue::SequenceAndSortKey(std::move(sequence),
67 sequence_sort_key))); 68 sequence_sort_key)));
68 } 69 }
69 70
70 return sequence_was_empty; 71 return sequence_was_empty;
71 } 72 }
72 73
73 } // namespace internal 74 } // namespace internal
74 } // namespace base 75 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/task_scheduler/utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698