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

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

Issue 1787453003: Test dynamic priorities on android (1F + 1B) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « cc/raster/tile_task_runner.h ('k') | content/renderer/raster_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_RASTER_WORKER_POOL_H_
6 #define CONTENT_RENDERER_RASTER_WORKER_POOL_H_ 6 #define CONTENT_RENDERER_RASTER_WORKER_POOL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 30 matching lines...) Expand all
41 41
42 // Overridden from cc::TaskGraphRunner: 42 // Overridden from cc::TaskGraphRunner:
43 cc::NamespaceToken GetNamespaceToken() override; 43 cc::NamespaceToken GetNamespaceToken() override;
44 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override; 44 void ScheduleTasks(cc::NamespaceToken token, cc::TaskGraph* graph) override;
45 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override; 45 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override;
46 void CollectCompletedTasks(cc::NamespaceToken token, 46 void CollectCompletedTasks(cc::NamespaceToken token,
47 cc::Task::Vector* completed_tasks) override; 47 cc::Task::Vector* completed_tasks) override;
48 48
49 // Runs a task from one of the provided categories. Categories listed first 49 // Runs a task from one of the provided categories. Categories listed first
50 // have higher priority. 50 // have higher priority.
51 void Run(const std::vector<cc::TaskCategory>& categories, 51 void Run(base::TestSimpleThread* runner,
52 const std::vector<cc::TaskCategory>& categories,
52 base::ConditionVariable* has_ready_to_run_tasks_cv); 53 base::ConditionVariable* has_ready_to_run_tasks_cv);
53 54
54 void FlushForTesting(); 55 void FlushForTesting();
55 56
56 // Spawn |num_threads| number of threads and start running work on the 57 // Spawn |num_threads| number of threads and start running work on the
57 // worker threads. 58 // worker threads.
58 void Start(int num_threads); 59 void Start(int num_threads);
59 60
60 // Finish running all the posted tasks (and nested task posted by those tasks) 61 // Finish running all the posted tasks (and nested task posted by those tasks)
61 // of all the associated task runners. 62 // of all the associated task runners.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DISALLOW_COPY_AND_ASSIGN(ClosureTask); 95 DISALLOW_COPY_AND_ASSIGN(ClosureTask);
95 }; 96 };
96 97
97 void ScheduleTasksWithLockAcquired(cc::NamespaceToken token, 98 void ScheduleTasksWithLockAcquired(cc::NamespaceToken token,
98 cc::TaskGraph* graph); 99 cc::TaskGraph* graph);
99 void CollectCompletedTasksWithLockAcquired(cc::NamespaceToken token, 100 void CollectCompletedTasksWithLockAcquired(cc::NamespaceToken token,
100 cc::Task::Vector* completed_tasks); 101 cc::Task::Vector* completed_tasks);
101 102
102 // Runs a task from one of the provided categories. Categories listed first 103 // Runs a task from one of the provided categories. Categories listed first
103 // have higher priority. Returns false if there were no tasks to run. 104 // have higher priority. Returns false if there were no tasks to run.
104 bool RunTaskWithLockAcquired(const std::vector<cc::TaskCategory>& categories); 105 bool RunTaskWithLockAcquired(base::TestSimpleThread* runner,
106 const std::vector<cc::TaskCategory>& categories);
105 107
106 // Run next task for the given category. Caller must acquire |lock_| prior to 108 // Run next task for the given category. Caller must acquire |lock_| prior to
107 // calling this function and make sure at least one task is ready to run. 109 // calling this function and make sure at least one task is ready to run.
108 void RunTaskInCategoryWithLockAcquired(cc::TaskCategory category); 110 void RunTaskInCategoryWithLockAcquired(base::TestSimpleThread* runner,
111 cc::TaskCategory category);
109 112
110 // Helper function which signals worker threads if tasks are ready to run. 113 // Helper function which signals worker threads if tasks are ready to run.
111 void SignalHasReadyToRunTasksWithLockAcquired(); 114 void SignalHasReadyToRunTasksWithLockAcquired();
112 115
113 // Determines if we should run a new task for the given category. This factors 116 // Determines if we should run a new task for the given category. This factors
114 // in whether a task is available and whether the count of running tasks is 117 // in whether a task is available and whether the count of running tasks is
115 // low enough to start a new one. 118 // low enough to start a new one.
116 bool ShouldRunTaskForCategoryWithLockAcquired(cc::TaskCategory category); 119 bool ShouldRunTaskForCategoryWithLockAcquired(cc::TaskCategory category);
117 120
118 // The actual threads where work is done. 121 // The actual threads where work is done.
(...skipping 19 matching lines...) Expand all
138 // Condition variable that is waited on by origin threads until a namespace 141 // Condition variable that is waited on by origin threads until a namespace
139 // has finished running all associated tasks. 142 // has finished running all associated tasks.
140 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; 143 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_;
141 // Set during shutdown. Tells Run() to return when no more tasks are pending. 144 // Set during shutdown. Tells Run() to return when no more tasks are pending.
142 bool shutdown_; 145 bool shutdown_;
143 }; 146 };
144 147
145 } // namespace content 148 } // namespace content
146 149
147 #endif // CONTENT_RENDERER_RASTER_WORKER_POOL_H_ 150 #endif // CONTENT_RENDERER_RASTER_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « cc/raster/tile_task_runner.h ('k') | content/renderer/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698