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

Side by Side Diff: content/renderer/categorized_worker_pool.h

Issue 2021323002: content: Rename RasterWorkerPool -> CategorizedWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_graph_runner_test_2
Patch Set: rebase Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/categorized_worker_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_RASTER_WORKER_POOL_H_ 5 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
6 #define CONTENT_RENDERER_RASTER_WORKER_POOL_H_ 6 #define CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/synchronization/condition_variable.h" 14 #include "base/synchronization/condition_variable.h"
15 #include "base/task_runner.h" 15 #include "base/task_runner.h"
16 #include "base/threading/simple_thread.h" 16 #include "base/threading/simple_thread.h"
17 #include "cc/raster/task_category.h" 17 #include "cc/raster/task_category.h"
18 #include "cc/raster/task_graph_runner.h" 18 #include "cc/raster/task_graph_runner.h"
19 #include "cc/raster/task_graph_work_queue.h" 19 #include "cc/raster/task_graph_work_queue.h"
20 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 // A pool of threads used to run raster work. 24 // A pool of threads used to run categorized work. The work can be scheduled on
25 // Work can be scheduled on the threads using different interfaces. 25 // the threads using different interfaces.
26 // The pool itself implements TaskRunner interface and tasks posted via that 26 // 1. The pool itself implements TaskRunner interface and tasks posted via that
27 // interface might run in parallel. 27 // interface might run in parallel.
28 // CreateSequencedTaskRunner creates a sequenced task runner that might run in 28 // 2. The pool also implements TaskGraphRunner interface which allows to
29 // parallel with other instances of sequenced task runners. 29 // schedule a graph of tasks with their dependencies.
30 // It's also possible to get the underlying TaskGraphRunner to schedule a graph 30 // 3. CreateSequencedTaskRunner() creates a sequenced task runner that might run
31 // of tasks with their dependencies. 31 // in parallel with other instances of sequenced task runners.
32 class CONTENT_EXPORT RasterWorkerPool : public base::TaskRunner, 32 class CONTENT_EXPORT CategorizedWorkerPool : public base::TaskRunner,
33 public cc::TaskGraphRunner { 33 public cc::TaskGraphRunner {
34 public: 34 public:
35 RasterWorkerPool(); 35 CategorizedWorkerPool();
36 36
37 // Overridden from base::TaskRunner: 37 // Overridden from base::TaskRunner:
38 bool PostDelayedTask(const tracked_objects::Location& from_here, 38 bool PostDelayedTask(const tracked_objects::Location& from_here,
39 const base::Closure& task, 39 const base::Closure& task,
40 base::TimeDelta delay) override; 40 base::TimeDelta delay) override;
41 bool RunsTasksOnCurrentThread() const override; 41 bool RunsTasksOnCurrentThread() const override;
42 42
43 // Overridden from cc::TaskGraphRunner: 43 // Overridden from cc::TaskGraphRunner:
44 cc::NamespaceToken GetNamespaceToken() override; 44 cc::NamespaceToken GetNamespaceToken() override;
45 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override; 45 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override;
(...skipping 17 matching lines...) Expand all
63 // Once all the tasks are executed the method blocks until the threads are 63 // Once all the tasks are executed the method blocks until the threads are
64 // terminated. 64 // terminated.
65 void Shutdown(); 65 void Shutdown();
66 66
67 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; } 67 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; }
68 68
69 // Create a new sequenced task graph runner. 69 // Create a new sequenced task graph runner.
70 scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner(); 70 scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner();
71 71
72 protected: 72 protected:
73 ~RasterWorkerPool() override; 73 ~CategorizedWorkerPool() override;
74 74
75 private: 75 private:
76 class RasterWorkerPoolSequencedTaskRunner; 76 class CategorizedWorkerPoolSequencedTaskRunner;
77 friend class RasterWorkerPoolSequencedTaskRunner; 77 friend class CategorizedWorkerPoolSequencedTaskRunner;
78 78
79 // Simple Task for the TaskGraphRunner that wraps a closure. 79 // Simple Task for the TaskGraphRunner that wraps a closure.
80 // This class is used to schedule TaskRunner tasks on the 80 // This class is used to schedule TaskRunner tasks on the
81 // |task_graph_runner_|. 81 // |task_graph_runner_|.
82 class ClosureTask : public cc::Task { 82 class ClosureTask : public cc::Task {
83 public: 83 public:
84 explicit ClosureTask(const base::Closure& closure); 84 explicit ClosureTask(const base::Closure& closure);
85 85
86 // Overridden from cc::Task: 86 // Overridden from cc::Task:
87 void RunOnWorkerThread() override; 87 void RunOnWorkerThread() override;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 base::ConditionVariable has_ready_to_run_background_tasks_cv_; 138 base::ConditionVariable has_ready_to_run_background_tasks_cv_;
139 // Condition variable that is waited on by origin threads until a namespace 139 // Condition variable that is waited on by origin threads until a namespace
140 // has finished running all associated tasks. 140 // has finished running all associated tasks.
141 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; 141 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_;
142 // Set during shutdown. Tells Run() to return when no more tasks are pending. 142 // Set during shutdown. Tells Run() to return when no more tasks are pending.
143 bool shutdown_; 143 bool shutdown_;
144 }; 144 };
145 145
146 } // namespace content 146 } // namespace content
147 147
148 #endif // CONTENT_RENDERER_RASTER_WORKER_POOL_H_ 148 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/categorized_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698