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

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

Powered by Google App Engine
This is Rietveld 408576698