OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/deferred_sequenced_task_runner.h" | 5 #include "base/deferred_sequenced_task_runner.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 DCHECK(deferred_tasks_queue_.empty()); | 41 DCHECK(deferred_tasks_queue_.empty()); |
42 return target_task_runner_->PostDelayedTask(from_here, std::move(task), | 42 return target_task_runner_->PostDelayedTask(from_here, std::move(task), |
43 delay); | 43 delay); |
44 } | 44 } |
45 | 45 |
46 QueueDeferredTask(from_here, std::move(task), delay, | 46 QueueDeferredTask(from_here, std::move(task), delay, |
47 false /* is_non_nestable */); | 47 false /* is_non_nestable */); |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 bool DeferredSequencedTaskRunner::RunsTasksOnCurrentThread() const { | 51 bool DeferredSequencedTaskRunner::RunsTasksInCurrentSequence() const { |
52 return target_task_runner_->RunsTasksOnCurrentThread(); | 52 return target_task_runner_->RunsTasksInCurrentSequence(); |
53 } | 53 } |
54 | 54 |
55 bool DeferredSequencedTaskRunner::PostNonNestableDelayedTask( | 55 bool DeferredSequencedTaskRunner::PostNonNestableDelayedTask( |
56 const tracked_objects::Location& from_here, | 56 const tracked_objects::Location& from_here, |
57 OnceClosure task, | 57 OnceClosure task, |
58 TimeDelta delay) { | 58 TimeDelta delay) { |
59 AutoLock lock(lock_); | 59 AutoLock lock(lock_); |
60 if (started_) { | 60 if (started_) { |
61 DCHECK(deferred_tasks_queue_.empty()); | 61 DCHECK(deferred_tasks_queue_.empty()); |
62 return target_task_runner_->PostNonNestableDelayedTask( | 62 return target_task_runner_->PostNonNestableDelayedTask( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 task.posted_from, std::move(task.task), task.delay); | 95 task.posted_from, std::move(task.task), task.delay); |
96 } else { | 96 } else { |
97 target_task_runner_->PostDelayedTask(task.posted_from, | 97 target_task_runner_->PostDelayedTask(task.posted_from, |
98 std::move(task.task), task.delay); | 98 std::move(task.task), task.delay); |
99 } | 99 } |
100 } | 100 } |
101 deferred_tasks_queue_.clear(); | 101 deferred_tasks_queue_.clear(); |
102 } | 102 } |
103 | 103 |
104 } // namespace base | 104 } // namespace base |
OLD | NEW |