| OLD | NEW |
| 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/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown"); | 96 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown"); |
| 97 | 97 |
| 98 TaskGraph empty; | 98 TaskGraph empty; |
| 99 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); | 99 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); |
| 100 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); | 100 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void BitmapTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { | 103 void BitmapTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { |
| 104 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks"); | 104 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks"); |
| 105 | 105 |
| 106 ScheduleTasksOnOriginThread(this, graph); | |
| 107 task_graph_runner_->ScheduleTasks(namespace_token_, graph); | 106 task_graph_runner_->ScheduleTasks(namespace_token_, graph); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void BitmapTileTaskWorkerPool::CheckForCompletedTasks() { | 109 void BitmapTileTaskWorkerPool::CollectCompletedTasks( |
| 110 Task::Vector* completed_tasks) { |
| 111 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::CheckForCompletedTasks"); | 111 TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::CheckForCompletedTasks"); |
| 112 | 112 |
| 113 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 113 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks); |
| 114 &completed_tasks_); | |
| 115 for (Task::Vector::const_iterator it = completed_tasks_.begin(); | |
| 116 it != completed_tasks_.end(); ++it) { | |
| 117 TileTask* task = static_cast<TileTask*>(it->get()); | |
| 118 | |
| 119 task->WillComplete(); | |
| 120 task->CompleteOnOriginThread(this); | |
| 121 task->DidComplete(); | |
| 122 } | |
| 123 completed_tasks_.clear(); | |
| 124 } | 114 } |
| 125 | 115 |
| 126 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( | 116 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( |
| 127 bool must_support_alpha) const { | 117 bool must_support_alpha) const { |
| 128 return resource_provider_->best_texture_format(); | 118 return resource_provider_->best_texture_format(); |
| 129 } | 119 } |
| 130 | 120 |
| 131 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( | 121 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( |
| 132 bool must_support_alpha) const { | 122 bool must_support_alpha) const { |
| 133 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 123 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
| 134 } | 124 } |
| 135 | 125 |
| 126 TileTaskClient* BitmapTileTaskWorkerPool::AsTileTaskClient() { |
| 127 return this; |
| 128 } |
| 129 |
| 136 std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( | 130 std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( |
| 137 const Resource* resource, | 131 const Resource* resource, |
| 138 uint64_t resource_content_id, | 132 uint64_t resource_content_id, |
| 139 uint64_t previous_content_id) { | 133 uint64_t previous_content_id) { |
| 140 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( | 134 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( |
| 141 resource_provider_, resource, resource_content_id, previous_content_id)); | 135 resource_provider_, resource, resource_content_id, previous_content_id)); |
| 142 } | 136 } |
| 143 | 137 |
| 144 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 138 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
| 145 std::unique_ptr<RasterBuffer> buffer) { | 139 std::unique_ptr<RasterBuffer> buffer) { |
| 146 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 140 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 147 } | 141 } |
| 148 | 142 |
| 149 } // namespace cc | 143 } // namespace cc |
| OLD | NEW |