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

Unified Diff: content/renderer/raster_worker_pool.h

Issue 1576133002: Add category handling to RasterWorkerPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hihi
Patch Set: nit Created 4 years, 11 months 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 | « no previous file | content/renderer/raster_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/raster_worker_pool.h
diff --git a/content/renderer/raster_worker_pool.h b/content/renderer/raster_worker_pool.h
index 1b7cfb1b54320dc848c6806a48ca2356a30bf5c6..1d6fc04ca6719ed8fd22f34093b7a35d3c8b4814 100644
--- a/content/renderer/raster_worker_pool.h
+++ b/content/renderer/raster_worker_pool.h
@@ -13,6 +13,7 @@
#include "base/synchronization/condition_variable.h"
#include "base/task_runner.h"
#include "base/threading/simple_thread.h"
+#include "cc/raster/task_category.h"
#include "cc/raster/task_graph_runner.h"
#include "cc/raster/task_graph_work_queue.h"
#include "content/common/content_export.h"
@@ -27,10 +28,8 @@ namespace content {
// parallel with other instances of sequenced task runners.
// It's also possible to get the underlying TaskGraphRunner to schedule a graph
// of tasks with their dependencies.
-class CONTENT_EXPORT RasterWorkerPool
- : public base::TaskRunner,
- public cc::TaskGraphRunner,
- public base::DelegateSimpleThread::Delegate {
+class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner,
+ public cc::TaskGraphRunner {
public:
RasterWorkerPool();
@@ -47,8 +46,9 @@ class CONTENT_EXPORT RasterWorkerPool
void CollectCompletedTasks(cc::NamespaceToken token,
cc::Task::Vector* completed_tasks) override;
- // Overridden from base::DelegateSimpleThread::Delegate:
- void Run() override;
+ // Runs a task from one of the provided categories. Categories listed first
+ // have higher priority.
+ void Run(const std::vector<cc::TaskCategory>& categories);
void FlushForTesting();
@@ -75,9 +75,13 @@ class CONTENT_EXPORT RasterWorkerPool
class RasterWorkerPoolSequencedTaskRunner;
friend class RasterWorkerPoolSequencedTaskRunner;
- // Run next task. Caller must acquire |lock_| prior to calling this function.
- // Returns true if there was a task available to run.
- bool RunTaskWithLockAcquired();
+ // Runs a task from one of the provided categories. Categories listed first
+ // have higher priority. Returns false if there were no tasks to run.
+ bool RunTaskWithLockAcquired(const std::vector<cc::TaskCategory>& categories);
+
+ // Run next task for the given category. Caller must acquire |lock_| prior to
+ // calling this function and make sure at least one task is ready to run.
+ void RunTaskInCategoryWithLockAcquired(cc::TaskCategory category);
// Simple Task for the TaskGraphRunner that wraps a closure.
// This class is used to schedule TaskRunner tasks on the
@@ -104,7 +108,7 @@ class CONTENT_EXPORT RasterWorkerPool
cc::Task::Vector* completed_tasks);
// The actual threads where work is done.
- ScopedVector<base::DelegateSimpleThread> threads_;
+ std::vector<scoped_ptr<base::SimpleThread>> threads_;
// Lock to exclusively access all the following members that are used to
// implement the TaskRunner and TaskGraphRunner interfaces.
« no previous file with comments | « no previous file | content/renderer/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698