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

Side by Side Diff: cc/raster/gpu_tile_task_worker_pool.cc

Issue 1866043006: cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 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
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/raster/gpu_tile_task_worker_pool.h" 5 #include "cc/raster/gpu_tile_task_worker_pool.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int gpu_rasterization_msaa_sample_count) 111 int gpu_rasterization_msaa_sample_count)
112 : task_runner_(task_runner), 112 : task_runner_(task_runner),
113 task_graph_runner_(task_graph_runner), 113 task_graph_runner_(task_graph_runner),
114 namespace_token_(task_graph_runner_->GetNamespaceToken()), 114 namespace_token_(task_graph_runner_->GetNamespaceToken()),
115 rasterizer_(new GpuRasterizer(context_provider, 115 rasterizer_(new GpuRasterizer(context_provider,
116 resource_provider, 116 resource_provider,
117 use_distance_field_text, 117 use_distance_field_text,
118 gpu_rasterization_msaa_sample_count)) {} 118 gpu_rasterization_msaa_sample_count)) {}
119 119
120 GpuTileTaskWorkerPool::~GpuTileTaskWorkerPool() { 120 GpuTileTaskWorkerPool::~GpuTileTaskWorkerPool() {
121 DCHECK_EQ(0u, completed_tasks_.size());
122 } 121 }
123 122
124 TileTaskRunner* GpuTileTaskWorkerPool::AsTileTaskRunner() { 123 TileTaskRunner* GpuTileTaskWorkerPool::AsTileTaskRunner() {
125 return this; 124 return this;
126 } 125 }
127 126
128 void GpuTileTaskWorkerPool::Shutdown() { 127 void GpuTileTaskWorkerPool::Shutdown() {
129 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::Shutdown"); 128 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::Shutdown");
130 129
131 TaskGraph empty; 130 TaskGraph empty;
132 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); 131 task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
133 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); 132 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
134 } 133 }
135 134
136 void GpuTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { 135 void GpuTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
137 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::ScheduleTasks"); 136 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::ScheduleTasks");
138 137
139 ScheduleTasksOnOriginThread(this, graph);
140
141 // Barrier to sync any new resources to the worker context. 138 // Barrier to sync any new resources to the worker context.
142 rasterizer_->resource_provider() 139 rasterizer_->resource_provider()
143 ->output_surface() 140 ->output_surface()
144 ->context_provider() 141 ->context_provider()
145 ->ContextGL() 142 ->ContextGL()
146 ->OrderingBarrierCHROMIUM(); 143 ->OrderingBarrierCHROMIUM();
147 144
148 task_graph_runner_->ScheduleTasks(namespace_token_, graph); 145 task_graph_runner_->ScheduleTasks(namespace_token_, graph);
149 } 146 }
150 147
151 void GpuTileTaskWorkerPool::CheckForCompletedTasks() { 148 void GpuTileTaskWorkerPool::CollectCompletedTasks(
152 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::CheckForCompletedTasks"); 149 Task::Vector* completed_tasks) {
150 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::CollectCompletedTasks");
153 151
154 task_graph_runner_->CollectCompletedTasks(namespace_token_, 152 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks);
155 &completed_tasks_);
156 CompleteTasks(completed_tasks_);
157 completed_tasks_.clear();
158 } 153 }
159 154
160 ResourceFormat GpuTileTaskWorkerPool::GetResourceFormat( 155 ResourceFormat GpuTileTaskWorkerPool::GetResourceFormat(
161 bool must_support_alpha) const { 156 bool must_support_alpha) const {
162 return rasterizer_->resource_provider()->best_render_buffer_format(); 157 return rasterizer_->resource_provider()->best_render_buffer_format();
163 } 158 }
164 159
165 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle( 160 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle(
166 bool must_support_alpha) const { 161 bool must_support_alpha) const {
167 // This doesn't require a swizzle because we rasterize to the correct format. 162 // This doesn't require a swizzle because we rasterize to the correct format.
168 return false; 163 return false;
169 } 164 }
170 165
171 void GpuTileTaskWorkerPool::CompleteTasks(const Task::Vector& tasks) { 166 TileTaskClient* GpuTileTaskWorkerPool::AsTileTaskClient() {
172 for (auto& task : tasks) { 167 return this;
173 TileTask* tile_task = static_cast<TileTask*>(task.get());
174
175 tile_task->WillComplete();
176 tile_task->CompleteOnOriginThread(this);
177 tile_task->DidComplete();
178 }
179 completed_tasks_.clear();
180 } 168 }
181 169
182 std::unique_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( 170 std::unique_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster(
183 const Resource* resource, 171 const Resource* resource,
184 uint64_t resource_content_id, 172 uint64_t resource_content_id,
185 uint64_t previous_content_id) { 173 uint64_t previous_content_id) {
186 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( 174 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl(
187 rasterizer_.get(), resource, resource_content_id, previous_content_id)); 175 rasterizer_.get(), resource, resource_content_id, previous_content_id));
188 } 176 }
189 177
190 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( 178 void GpuTileTaskWorkerPool::ReleaseBufferForRaster(
191 std::unique_ptr<RasterBuffer> buffer) { 179 std::unique_ptr<RasterBuffer> buffer) {
192 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. 180 // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
193 } 181 }
194 182
195 } // namespace cc 183 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698