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

Side by Side Diff: cc/raster/one_copy_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/one_copy_tile_task_worker_pool.h" 5 #include "cc/raster/one_copy_tile_task_worker_pool.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return; 249 return;
250 250
251 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); 251 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max());
252 DCHECK_EQ(staging_buffer_usage_in_bytes_, 0); 252 DCHECK_EQ(staging_buffer_usage_in_bytes_, 0);
253 DCHECK_EQ(free_staging_buffer_usage_in_bytes_, 0); 253 DCHECK_EQ(free_staging_buffer_usage_in_bytes_, 0);
254 } 254 }
255 255
256 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { 256 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
257 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks"); 257 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks");
258 258
259 ScheduleTasksOnOriginThread(this, graph);
260
261 // Barrier to sync any new resources to the worker context. 259 // Barrier to sync any new resources to the worker context.
262 resource_provider_->output_surface() 260 resource_provider_->output_surface()
263 ->context_provider() 261 ->context_provider()
264 ->ContextGL() 262 ->ContextGL()
265 ->OrderingBarrierCHROMIUM(); 263 ->OrderingBarrierCHROMIUM();
266 264
267 task_graph_runner_->ScheduleTasks(namespace_token_, graph); 265 task_graph_runner_->ScheduleTasks(namespace_token_, graph);
268 } 266 }
269 267
270 void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { 268 void OneCopyTileTaskWorkerPool::CollectCompletedTasks(
269 Task::Vector* completed_tasks) {
271 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks"); 270 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks");
272 271
273 task_graph_runner_->CollectCompletedTasks(namespace_token_, 272 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks);
274 &completed_tasks_);
275
276 for (Task::Vector::const_iterator it = completed_tasks_.begin();
277 it != completed_tasks_.end(); ++it) {
278 TileTask* task = static_cast<TileTask*>(it->get());
279
280 task->WillComplete();
281 task->CompleteOnOriginThread(this);
282 task->DidComplete();
283 }
284 completed_tasks_.clear();
285 } 273 }
286 274
287 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( 275 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat(
288 bool must_support_alpha) const { 276 bool must_support_alpha) const {
289 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && 277 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) &&
290 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || 278 (DoesResourceFormatSupportAlpha(preferred_tile_format_) ||
291 !must_support_alpha)) { 279 !must_support_alpha)) {
292 return preferred_tile_format_; 280 return preferred_tile_format_;
293 } 281 }
294 282
295 return resource_provider_->best_texture_format(); 283 return resource_provider_->best_texture_format();
296 } 284 }
297 285
298 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( 286 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
299 bool must_support_alpha) const { 287 bool must_support_alpha) const {
300 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); 288 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
301 } 289 }
302 290
291 TileTaskClient* OneCopyTileTaskWorkerPool::AsTileTaskClient() {
292 return this;
293 }
294
303 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( 295 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster(
304 const Resource* resource, 296 const Resource* resource,
305 uint64_t resource_content_id, 297 uint64_t resource_content_id,
306 uint64_t previous_content_id) { 298 uint64_t previous_content_id) {
307 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload 299 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload
308 // the dirty rect. 300 // the dirty rect.
309 return make_scoped_ptr<RasterBuffer>( 301 return make_scoped_ptr<RasterBuffer>(
310 new RasterBufferImpl(this, resource_provider_, resource->format(), 302 new RasterBufferImpl(this, resource_provider_, resource->format(),
311 resource, previous_content_id)); 303 resource, previous_content_id));
312 } 304 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return; 729 return;
738 730
739 busy_buffers_.front()->DestroyGLResources(gl); 731 busy_buffers_.front()->DestroyGLResources(gl);
740 RemoveStagingBuffer(busy_buffers_.front().get()); 732 RemoveStagingBuffer(busy_buffers_.front().get());
741 busy_buffers_.pop_front(); 733 busy_buffers_.pop_front();
742 } 734 }
743 } 735 }
744 } 736 }
745 737
746 } // namespace cc 738 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698