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

Unified Diff: cc/resources/image_raster_worker_pool.cc

Issue 144463012: cc: Reuse the same TaskGraph and completed tasks vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 6 years, 10 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 | « cc/resources/image_raster_worker_pool.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/image_raster_worker_pool.cc
diff --git a/cc/resources/image_raster_worker_pool.cc b/cc/resources/image_raster_worker_pool.cc
index 61478de3bdf3195c26366a70e520c2b9a97ebabf..593e037ede405f388ead155aee3bd7e4b8ac0eff 100644
--- a/cc/resources/image_raster_worker_pool.cc
+++ b/cc/resources/image_raster_worker_pool.cc
@@ -60,7 +60,8 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
raster_tasks_required_for_activation_pending_ = true;
unsigned priority = kRasterTaskPriorityBase;
- internal::TaskGraph graph;
+
+ graph_.Reset();
scoped_refptr<internal::WorkerPoolTask>
new_raster_required_for_activation_finished_task(
@@ -87,27 +88,27 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
if (IsRasterTaskRequiredForActivation(task)) {
++raster_required_for_activation_finished_dependency_count;
- graph.edges.push_back(internal::TaskGraph::Edge(
+ graph_.edges.push_back(internal::TaskGraph::Edge(
task, new_raster_required_for_activation_finished_task.get()));
}
- InsertNodeForRasterTask(&graph, task, task->dependencies(), priority++);
+ InsertNodeForRasterTask(&graph_, task, task->dependencies(), priority++);
++raster_finished_dependency_count;
- graph.edges.push_back(
+ graph_.edges.push_back(
internal::TaskGraph::Edge(task, new_raster_finished_task.get()));
}
- InsertNodeForTask(&graph,
+ InsertNodeForTask(&graph_,
new_raster_required_for_activation_finished_task.get(),
kRasterRequiredForActivationFinishedTaskPriority,
raster_required_for_activation_finished_dependency_count);
- InsertNodeForTask(&graph,
+ InsertNodeForTask(&graph_,
new_raster_finished_task.get(),
kRasterFinishedTaskPriority,
raster_finished_dependency_count);
- SetTaskGraph(&graph);
+ SetTaskGraph(&graph_);
set_raster_finished_task(new_raster_finished_task);
set_raster_required_for_activation_finished_task(
@@ -136,11 +137,9 @@ ResourceFormat ImageRasterWorkerPool::GetResourceFormat() const {
void ImageRasterWorkerPool::CheckForCompletedTasks() {
TRACE_EVENT0("cc", "ImageRasterWorkerPool::CheckForCompletedTasks");
- internal::Task::Vector completed_tasks;
- CollectCompletedWorkerPoolTasks(&completed_tasks);
-
- for (internal::Task::Vector::const_iterator it = completed_tasks.begin();
- it != completed_tasks.end();
+ CollectCompletedWorkerPoolTasks(&completed_tasks_);
+ for (internal::Task::Vector::const_iterator it = completed_tasks_.begin();
+ it != completed_tasks_.end();
++it) {
internal::WorkerPoolTask* task =
static_cast<internal::WorkerPoolTask*>(it->get());
@@ -151,6 +150,7 @@ void ImageRasterWorkerPool::CheckForCompletedTasks() {
task->RunReplyOnOriginThread();
}
+ completed_tasks_.clear();
CheckForCompletedGpuRasterTasks();
}
« no previous file with comments | « cc/resources/image_raster_worker_pool.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698