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

Unified Diff: content/renderer/raster_worker_pool.cc

Issue 1521423003: Revert of TaskGraphRunner Group support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/raster_worker_pool.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « content/renderer/raster_worker_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698