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

Side by Side Diff: cc/resources/gpu_raster_worker_pool.cc

Issue 569733002: cc: Remove cc:RasterRequiredForActivation synthetic delays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: post-increment to pre-increment Created 6 years, 3 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 | « no previous file | cc/resources/image_copy_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "cc/resources/gpu_raster_worker_pool.h" 5 #include "cc/resources/gpu_raster_worker_pool.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
9 #include "cc/resources/resource.h" 9 #include "cc/resources/resource.h"
10 #include "cc/resources/resource_provider.h" 10 #include "cc/resources/resource_provider.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 TRACE_EVENT0("cc", "GpuRasterWorkerPool::Shutdown"); 55 TRACE_EVENT0("cc", "GpuRasterWorkerPool::Shutdown");
56 56
57 TaskGraph empty; 57 TaskGraph empty;
58 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); 58 task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
59 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); 59 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
60 } 60 }
61 61
62 void GpuRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) { 62 void GpuRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
63 TRACE_EVENT0("cc", "GpuRasterWorkerPool::ScheduleTasks"); 63 TRACE_EVENT0("cc", "GpuRasterWorkerPool::ScheduleTasks");
64 64
65 DCHECK_EQ(queue->required_for_activation_count,
66 static_cast<size_t>(
67 std::count_if(queue->items.begin(),
68 queue->items.end(),
69 RasterTaskQueue::Item::IsRequiredForActivation)));
70
71 raster_tasks_pending_ = true; 65 raster_tasks_pending_ = true;
72 raster_tasks_required_for_activation_pending_ = true; 66 raster_tasks_required_for_activation_pending_ = true;
73 67
74 unsigned priority = kRasterTaskPriorityBase; 68 unsigned priority = kRasterTaskPriorityBase;
75 69
76 graph_.Reset(); 70 graph_.Reset();
77 71
78 // Cancel existing OnRasterFinished callbacks. 72 // Cancel existing OnRasterFinished callbacks.
79 raster_finished_weak_ptr_factory_.InvalidateWeakPtrs(); 73 raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
80 74
81 scoped_refptr<RasterizerTask> 75 scoped_refptr<RasterizerTask>
82 new_raster_required_for_activation_finished_task( 76 new_raster_required_for_activation_finished_task(CreateRasterFinishedTask(
83 CreateRasterRequiredForActivationFinishedTask( 77 task_runner_.get(),
84 queue->required_for_activation_count, 78 base::Bind(
85 task_runner_.get(), 79 &GpuRasterWorkerPool::OnRasterRequiredForActivationFinished,
86 base::Bind( 80 raster_finished_weak_ptr_factory_.GetWeakPtr())));
87 &GpuRasterWorkerPool::OnRasterRequiredForActivationFinished,
88 raster_finished_weak_ptr_factory_.GetWeakPtr())));
89 scoped_refptr<RasterizerTask> new_raster_finished_task( 81 scoped_refptr<RasterizerTask> new_raster_finished_task(
90 CreateRasterFinishedTask( 82 CreateRasterFinishedTask(
91 task_runner_.get(), 83 task_runner_.get(),
92 base::Bind(&GpuRasterWorkerPool::OnRasterFinished, 84 base::Bind(&GpuRasterWorkerPool::OnRasterFinished,
93 raster_finished_weak_ptr_factory_.GetWeakPtr()))); 85 raster_finished_weak_ptr_factory_.GetWeakPtr())));
94 86
87 size_t required_for_activation_count = 0;
88
95 for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin(); 89 for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
96 it != queue->items.end(); 90 it != queue->items.end();
97 ++it) { 91 ++it) {
98 const RasterTaskQueue::Item& item = *it; 92 const RasterTaskQueue::Item& item = *it;
99 RasterTask* task = item.task; 93 RasterTask* task = item.task;
100 DCHECK(!task->HasCompleted()); 94 DCHECK(!task->HasCompleted());
101 95
102 if (item.required_for_activation) { 96 if (item.required_for_activation) {
97 ++required_for_activation_count;
103 graph_.edges.push_back(TaskGraph::Edge( 98 graph_.edges.push_back(TaskGraph::Edge(
104 task, new_raster_required_for_activation_finished_task.get())); 99 task, new_raster_required_for_activation_finished_task.get()));
105 } 100 }
106 101
107 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++); 102 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++);
108 103
109 graph_.edges.push_back( 104 graph_.edges.push_back(
110 TaskGraph::Edge(task, new_raster_finished_task.get())); 105 TaskGraph::Edge(task, new_raster_finished_task.get()));
111 } 106 }
112 107
113 InsertNodeForTask(&graph_, 108 InsertNodeForTask(&graph_,
114 new_raster_required_for_activation_finished_task.get(), 109 new_raster_required_for_activation_finished_task.get(),
115 kRasterRequiredForActivationFinishedTaskPriority, 110 kRasterRequiredForActivationFinishedTaskPriority,
116 queue->required_for_activation_count); 111 required_for_activation_count);
117 InsertNodeForTask(&graph_, 112 InsertNodeForTask(&graph_,
118 new_raster_finished_task.get(), 113 new_raster_finished_task.get(),
119 kRasterFinishedTaskPriority, 114 kRasterFinishedTaskPriority,
120 queue->items.size()); 115 queue->items.size());
121 116
122 ScheduleTasksOnOriginThread(this, &graph_); 117 ScheduleTasksOnOriginThread(this, &graph_);
123 task_graph_runner_->ScheduleTasks(namespace_token_, &graph_); 118 task_graph_runner_->ScheduleTasks(namespace_token_, &graph_);
124 119
125 ScheduleRunTasksOnOriginThread(); 120 ScheduleRunTasksOnOriginThread();
126 121
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread"); 183 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread");
189 184
190 DCHECK(run_tasks_on_origin_thread_pending_); 185 DCHECK(run_tasks_on_origin_thread_pending_);
191 run_tasks_on_origin_thread_pending_ = false; 186 run_tasks_on_origin_thread_pending_ = false;
192 187
193 ScopedGpuRaster gpu_raster(context_provider_); 188 ScopedGpuRaster gpu_raster(context_provider_);
194 task_graph_runner_->RunUntilIdle(); 189 task_graph_runner_->RunUntilIdle();
195 } 190 }
196 191
197 } // namespace cc 192 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/image_copy_raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698