summaryrefslogtreecommitdiffstats
path: root/cc/raster
diff options
context:
space:
mode:
authordcastagna <dcastagna@chromium.org>2015-08-05 12:51:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-05 19:51:31 +0000
commit4517a189421126a3162db7d3aa3341d724e3f62d (patch)
treeaebcc28f39cb9c6196fbcbbd5a7b99ac01b28db1 /cc/raster
parenta2d607bc7746bcc6b2cc30998570eec6d89cd6e0 (diff)
downloadchromium_src-4517a189421126a3162db7d3aa3341d724e3f62d.zip
chromium_src-4517a189421126a3162db7d3aa3341d724e3f62d.tar.gz
chromium_src-4517a189421126a3162db7d3aa3341d724e3f62d.tar.bz2
Reland: Implement and test task runners in RasterWorkerPool.
This CL moves RasterWorkerPool outside render_thread_impl.h and in its own file, implements TaskRunner and SequencedTaskRunner on top of it and properly tests the two implementations. BUG= CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Committed: https://crrev.com/6526c209494a5176f82b5f400fd1e66a426c840f Cr-Commit-Position: refs/heads/master@{#341827} Review URL: https://codereview.chromium.org/1254003003 Cr-Commit-Position: refs/heads/master@{#341946}
Diffstat (limited to 'cc/raster')
-rw-r--r--cc/raster/task_graph_runner.cc12
-rw-r--r--cc/raster/task_graph_runner.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/cc/raster/task_graph_runner.cc b/cc/raster/task_graph_runner.cc
index 5ffe6c4..4fbf56e 100644
--- a/cc/raster/task_graph_runner.cc
+++ b/cc/raster/task_graph_runner.cc
@@ -332,6 +332,18 @@ void TaskGraphRunner::Shutdown() {
has_ready_to_run_tasks_cv_.Signal();
}
+void TaskGraphRunner::FlushForTesting() {
+ base::AutoLock lock(lock_);
+
+ while (std::find_if(namespaces_.begin(), namespaces_.end(),
+ [](const TaskNamespaceMap::value_type& entry) {
+ return !HasFinishedRunningTasksInNamespace(
+ &entry.second);
+ }) != namespaces_.end()) {
+ has_namespaces_with_finished_running_tasks_cv_.Wait();
+ }
+}
+
void TaskGraphRunner::Run() {
base::AutoLock lock(lock_);
diff --git a/cc/raster/task_graph_runner.h b/cc/raster/task_graph_runner.h
index bb55afc..d6d4191 100644
--- a/cc/raster/task_graph_runner.h
+++ b/cc/raster/task_graph_runner.h
@@ -137,6 +137,9 @@ class CC_EXPORT TaskGraphRunner {
// Warning: if the TaskGraphRunner remains busy, it may never quit.
void Shutdown();
+ // Wait for all the tasks to finish running on all the namespaces.
+ void FlushForTesting();
+
private:
struct PrioritizedTask {
typedef std::vector<PrioritizedTask> Vector;