Index: content/renderer/raster_worker_pool.cc |
diff --git a/content/renderer/raster_worker_pool.cc b/content/renderer/raster_worker_pool.cc |
index ddeb57dfc709f60c9240ae0b402fcdb16dd5bc65..89ed6d62b91c65a83fe32912336df4cdf8ebd4d4 100644 |
--- a/content/renderer/raster_worker_pool.cc |
+++ b/content/renderer/raster_worker_pool.cc |
@@ -3,8 +3,6 @@ |
// found in the LICENSE file. |
#include "content/renderer/raster_worker_pool.h" |
- |
-#include <utility> |
#include "base/strings/stringprintf.h" |
#include "base/threading/thread_restrictions.h" |
@@ -49,8 +47,7 @@ |
if (!graph_.nodes.empty()) |
dependencies = 1; |
- cc::TaskGraph::Node node(graph_task.get(), 0u /* category */, |
- 0u /* priority */, dependencies); |
+ cc::TaskGraph::Node node(graph_task.get(), 0, dependencies); |
if (dependencies) { |
graph_.edges.push_back( |
cc::TaskGraph::Edge(graph_.nodes.back().task, node.task)); |
@@ -151,9 +148,7 @@ |
tasks_.push_back(make_scoped_refptr(new ClosureTask(task))); |
graph_.Reset(); |
for (const auto& graph_task : tasks_) |
- graph_.nodes.push_back( |
- cc::TaskGraph::Node(graph_task.get(), 0u /* category */, |
- 0u /* priority */, 0u /* dependencies */)); |
+ graph_.nodes.push_back(cc::TaskGraph::Node(graph_task.get(), 0, 0)); |
ScheduleTasksWithLockAcquired(namespace_token_, &graph_); |
completed_tasks_.clear(); |
@@ -169,7 +164,7 @@ |
base::AutoLock lock(lock_); |
while (true) { |
- if (!RunTaskWithLockAcquired()) { |
+ if (!work_queue_.HasReadyToRunTasks()) { |
// Exit when shutdown is set and no more tasks are pending. |
if (shutdown_) |
break; |
@@ -178,6 +173,8 @@ |
has_ready_to_run_tasks_cv_.Wait(); |
continue; |
} |
+ |
+ RunTaskWithLockAcquired(); |
} |
} |
@@ -261,28 +258,12 @@ |
work_queue_.CollectCompletedTasks(token, completed_tasks); |
} |
-bool RasterWorkerPool::RunTaskWithLockAcquired() { |
+void RasterWorkerPool::RunTaskWithLockAcquired() { |
TRACE_EVENT0("toplevel", "TaskGraphRunner::RunTask"); |
lock_.AssertAcquired(); |
- // Find the first category with any tasks to run. This task graph runner |
- // treats categories as an additional priority. |
- // TODO(ericrk): Add more category/thread logic. |
- const auto& ready_to_run_namespaces = work_queue_.ready_to_run_namespaces(); |
- auto found = std::find_if( |
- ready_to_run_namespaces.cbegin(), ready_to_run_namespaces.cend(), |
- [](const std::pair<uint16_t, |
- cc::TaskGraphWorkQueue::TaskNamespace::Vector>& pair) { |
- return !pair.second.empty(); |
- }); |
- |
- if (found == ready_to_run_namespaces.cend()) { |
- return false; |
- } |
- |
- const uint16_t category = found->first; |
- auto prioritized_task = work_queue_.GetNextTaskToRun(category); |
+ auto prioritized_task = work_queue_.GetNextTaskToRun(); |
cc::Task* task = prioritized_task.task; |
// There may be more work available, so wake up another worker thread. |
@@ -307,8 +288,6 @@ |
if (work_queue_.HasFinishedRunningTasksInNamespace( |
prioritized_task.task_namespace)) |
has_namespaces_with_finished_running_tasks_cv_.Broadcast(); |
- |
- return true; |
} |
RasterWorkerPool::ClosureTask::ClosureTask(const base::Closure& closure) |