OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/categorized_worker_pool.h" | 5 #include "content/renderer/categorized_worker_pool.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 base::Closure task, | 56 base::Closure task, |
57 base::TimeDelta delay) override { | 57 base::TimeDelta delay) override { |
58 return PostNonNestableDelayedTask(from_here, std::move(task), delay); | 58 return PostNonNestableDelayedTask(from_here, std::move(task), delay); |
59 } | 59 } |
60 bool RunsTasksOnCurrentThread() const override { return true; } | 60 bool RunsTasksOnCurrentThread() const override { return true; } |
61 | 61 |
62 // Overridden from base::SequencedTaskRunner: | 62 // Overridden from base::SequencedTaskRunner: |
63 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 63 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
64 base::Closure task, | 64 base::Closure task, |
65 base::TimeDelta delay) override { | 65 base::TimeDelta delay) override { |
| 66 DCHECK(task); |
66 base::AutoLock lock(lock_); | 67 base::AutoLock lock(lock_); |
67 | 68 |
68 // Remove completed tasks. | 69 // Remove completed tasks. |
69 DCHECK(completed_tasks_.empty()); | 70 DCHECK(completed_tasks_.empty()); |
70 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 71 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
71 &completed_tasks_); | 72 &completed_tasks_); |
72 | 73 |
73 tasks_.erase(tasks_.begin(), tasks_.begin() + completed_tasks_.size()); | 74 tasks_.erase(tasks_.begin(), tasks_.begin() + completed_tasks_.size()); |
74 | 75 |
75 tasks_.push_back(make_scoped_refptr(new ClosureTask(std::move(task)))); | 76 tasks_.push_back(make_scoped_refptr(new ClosureTask(std::move(task)))); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 : closure_(std::move(closure)) {} | 419 : closure_(std::move(closure)) {} |
419 | 420 |
420 // Overridden from cc::Task: | 421 // Overridden from cc::Task: |
421 void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() { | 422 void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() { |
422 std::move(closure_).Run(); | 423 std::move(closure_).Run(); |
423 } | 424 } |
424 | 425 |
425 CategorizedWorkerPool::ClosureTask::~ClosureTask() {} | 426 CategorizedWorkerPool::ClosureTask::~ClosureTask() {} |
426 | 427 |
427 } // namespace content | 428 } // namespace content |
OLD | NEW |