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

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

Issue 2637843002: Migrate base::TaskRunner from Closure to OnceClosure (Closed)
Patch Set: rebase Created 3 years, 8 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/public/child/worker_thread.h ('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_CATEGORIZED_WORKER_POOL_H_ 5 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
6 #define CONTENT_RENDERER_CATEGORIZED_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"
(...skipping 18 matching lines...) Expand all
29 // schedule a graph of tasks with their dependencies. 29 // schedule a graph of tasks with their dependencies.
30 // 3. CreateSequencedTaskRunner() creates a sequenced task runner that might run 30 // 3. CreateSequencedTaskRunner() creates a sequenced task runner that might run
31 // in parallel with other instances of sequenced task runners. 31 // in parallel with other instances of sequenced task runners.
32 class CONTENT_EXPORT CategorizedWorkerPool : public base::TaskRunner, 32 class CONTENT_EXPORT CategorizedWorkerPool : public base::TaskRunner,
33 public cc::TaskGraphRunner { 33 public cc::TaskGraphRunner {
34 public: 34 public:
35 CategorizedWorkerPool(); 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 base::Closure task, 39 base::OnceClosure 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 GenerateNamespaceToken() override; 44 cc::NamespaceToken GenerateNamespaceToken() override;
45 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override; 45 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override;
46 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override; 46 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override;
47 void CollectCompletedTasks(cc::NamespaceToken token, 47 void CollectCompletedTasks(cc::NamespaceToken token,
48 cc::Task::Vector* completed_tasks) override; 48 cc::Task::Vector* completed_tasks) override;
49 49
(...skipping 28 matching lines...) Expand all
78 78
79 private: 79 private:
80 class CategorizedWorkerPoolSequencedTaskRunner; 80 class CategorizedWorkerPoolSequencedTaskRunner;
81 friend class CategorizedWorkerPoolSequencedTaskRunner; 81 friend class CategorizedWorkerPoolSequencedTaskRunner;
82 82
83 // Simple Task for the TaskGraphRunner that wraps a closure. 83 // Simple Task for the TaskGraphRunner that wraps a closure.
84 // This class is used to schedule TaskRunner tasks on the 84 // This class is used to schedule TaskRunner tasks on the
85 // |task_graph_runner_|. 85 // |task_graph_runner_|.
86 class ClosureTask : public cc::Task { 86 class ClosureTask : public cc::Task {
87 public: 87 public:
88 explicit ClosureTask(base::Closure closure); 88 explicit ClosureTask(base::OnceClosure closure);
89 89
90 // Overridden from cc::Task: 90 // Overridden from cc::Task:
91 void RunOnWorkerThread() override; 91 void RunOnWorkerThread() override;
92 92
93 protected: 93 protected:
94 ~ClosureTask() override; 94 ~ClosureTask() override;
95 95
96 private: 96 private:
97 base::Closure closure_; 97 base::OnceClosure closure_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(ClosureTask); 99 DISALLOW_COPY_AND_ASSIGN(ClosureTask);
100 }; 100 };
101 101
102 void ScheduleTasksWithLockAcquired(cc::NamespaceToken token, 102 void ScheduleTasksWithLockAcquired(cc::NamespaceToken token,
103 cc::TaskGraph* graph); 103 cc::TaskGraph* graph);
104 void CollectCompletedTasksWithLockAcquired(cc::NamespaceToken token, 104 void CollectCompletedTasksWithLockAcquired(cc::NamespaceToken token,
105 cc::Task::Vector* completed_tasks); 105 cc::Task::Vector* completed_tasks);
106 106
107 // Runs a task from one of the provided categories. Categories listed first 107 // Runs a task from one of the provided categories. Categories listed first
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Condition variable that is waited on by origin threads until a namespace 143 // Condition variable that is waited on by origin threads until a namespace
144 // has finished running all associated tasks. 144 // has finished running all associated tasks.
145 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; 145 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_;
146 // Set during shutdown. Tells Run() to return when no more tasks are pending. 146 // Set during shutdown. Tells Run() to return when no more tasks are pending.
147 bool shutdown_; 147 bool shutdown_;
148 }; 148 };
149 149
150 } // namespace content 150 } // namespace content
151 151
152 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ 152 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « content/public/child/worker_thread.h ('k') | content/renderer/categorized_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698