| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |