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

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: 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
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..a4222c7938d85eda0a1aacc71d1366acc836cdd7 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,14 +46,16 @@ 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();
// Spawn |num_threads| number of threads and start running work on the
// worker threads.
void Start(int num_threads,
+ bool use_single_thread_for_background_raster_tasks,
const base::SimpleThread::Options& thread_options);
// Finish running all the posted tasks (and nested task posted by those tasks)
@@ -75,9 +76,9 @@ 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();
+ // Run next task. Caller must acquire |lock_| prior to calling this function
+ // and make sure at least one task is ready to run.
+ void RunTaskWithLockAcquired(cc::TaskCategory category);
// Simple Task for the TaskGraphRunner that wraps a closure.
// This class is used to schedule TaskRunner tasks on the
@@ -104,7 +105,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.

Powered by Google App Engine
This is Rietveld 408576698