| 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/resources/image_copy_raster_worker_pool.h" | 5 #include "cc/resources/image_copy_raster_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/debug/trace_event_argument.h" | 10 #include "base/debug/trace_event_argument.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 task->CompleteOnOriginThread(this); | 159 task->CompleteOnOriginThread(this); |
| 160 task->DidComplete(); | 160 task->DidComplete(); |
| 161 | 161 |
| 162 task->RunReplyOnOriginThread(); | 162 task->RunReplyOnOriginThread(); |
| 163 } | 163 } |
| 164 completed_tasks_.clear(); | 164 completed_tasks_.clear(); |
| 165 | 165 |
| 166 FlushCopies(); | 166 FlushCopies(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 SkCanvas* ImageCopyRasterWorkerPool::AcquireCanvasForRaster(RasterTask* task) { | 169 RasterCanvas* ImageCopyRasterWorkerPool::AcquireCanvasForRaster( |
| 170 RasterTask* task) { |
| 170 DCHECK_EQ(task->resource()->format(), resource_pool_->resource_format()); | 171 DCHECK_EQ(task->resource()->format(), resource_pool_->resource_format()); |
| 171 scoped_ptr<ScopedResource> resource( | 172 scoped_ptr<ScopedResource> resource( |
| 172 resource_pool_->AcquireResource(task->resource()->size())); | 173 resource_pool_->AcquireResource(task->resource()->size())); |
| 173 SkCanvas* canvas = resource_provider_->MapImageRasterBuffer(resource->id()); | 174 RasterCanvas* canvas = |
| 175 resource_provider_->MapImageRasterBuffer(resource->id()); |
| 174 DCHECK(std::find_if(raster_task_states_.begin(), | 176 DCHECK(std::find_if(raster_task_states_.begin(), |
| 175 raster_task_states_.end(), | 177 raster_task_states_.end(), |
| 176 RasterTaskState::TaskComparator(task)) == | 178 RasterTaskState::TaskComparator(task)) == |
| 177 raster_task_states_.end()); | 179 raster_task_states_.end()); |
| 178 raster_task_states_.push_back(RasterTaskState(task, resource.release())); | 180 raster_task_states_.push_back(RasterTaskState(task, resource.release())); |
| 179 return canvas; | 181 return canvas; |
| 180 } | 182 } |
| 181 | 183 |
| 182 void ImageCopyRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) { | 184 void ImageCopyRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) { |
| 183 RasterTaskState::Vector::iterator it = | 185 RasterTaskState::Vector::iterator it = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 resource_pool_->total_memory_usage_bytes()); | 255 resource_pool_->total_memory_usage_bytes()); |
| 254 staging_state->SetInteger("pending_copy_count", | 256 staging_state->SetInteger("pending_copy_count", |
| 255 resource_pool_->total_resource_count() - | 257 resource_pool_->total_resource_count() - |
| 256 resource_pool_->acquired_resource_count()); | 258 resource_pool_->acquired_resource_count()); |
| 257 staging_state->SetInteger("bytes_pending_copy", | 259 staging_state->SetInteger("bytes_pending_copy", |
| 258 resource_pool_->total_memory_usage_bytes() - | 260 resource_pool_->total_memory_usage_bytes() - |
| 259 resource_pool_->acquired_memory_usage_bytes()); | 261 resource_pool_->acquired_memory_usage_bytes()); |
| 260 } | 262 } |
| 261 | 263 |
| 262 } // namespace cc | 264 } // namespace cc |
| OLD | NEW |