| 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/one_copy_raster_worker_pool.h" | 5 #include "cc/resources/one_copy_raster_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // raster resource. | 44 // raster resource. |
| 45 if (sequence_) | 45 if (sequence_) |
| 46 worker_pool_->AdvanceLastIssuedCopyTo(sequence_); | 46 worker_pool_->AdvanceLastIssuedCopyTo(sequence_); |
| 47 | 47 |
| 48 // Return raster resource to pool so it can be used by another RasterBuffer | 48 // Return raster resource to pool so it can be used by another RasterBuffer |
| 49 // instance. | 49 // instance. |
| 50 resource_pool_->ReleaseResource(raster_resource_.Pass()); | 50 resource_pool_->ReleaseResource(raster_resource_.Pass()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Overridden from RasterBuffer: | 53 // Overridden from RasterBuffer: |
| 54 void Playback(const PicturePileImpl* picture_pile, | 54 void Playback(const RasterSource* raster_source, |
| 55 const gfx::Rect& rect, | 55 const gfx::Rect& rect, |
| 56 float scale, | 56 float scale, |
| 57 RenderingStatsInstrumentation* stats) override { | 57 RenderingStatsInstrumentation* stats) override { |
| 58 gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_->gpu_memory_buffer(); | 58 gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_->gpu_memory_buffer(); |
| 59 if (!gpu_memory_buffer) | 59 if (!gpu_memory_buffer) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(), | 62 RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(), |
| 63 raster_resource_->format(), | 63 raster_resource_->format(), |
| 64 raster_resource_->size(), | 64 raster_resource_->size(), |
| 65 gpu_memory_buffer->GetStride(), | 65 gpu_memory_buffer->GetStride(), |
| 66 picture_pile, | 66 raster_source, |
| 67 rect, | 67 rect, |
| 68 scale, | 68 scale, |
| 69 stats); | 69 stats); |
| 70 gpu_memory_buffer->Unmap(); | 70 gpu_memory_buffer->Unmap(); |
| 71 | 71 |
| 72 sequence_ = worker_pool_->ScheduleCopyOnWorkerThread( | 72 sequence_ = worker_pool_->ScheduleCopyOnWorkerThread( |
| 73 lock_.Pass(), raster_resource_.get(), resource_); | 73 lock_.Pass(), raster_resource_.get(), resource_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 resource_pool_->total_memory_usage_bytes()); | 369 resource_pool_->total_memory_usage_bytes()); |
| 370 staging_state->SetInteger("pending_copy_count", | 370 staging_state->SetInteger("pending_copy_count", |
| 371 resource_pool_->total_resource_count() - | 371 resource_pool_->total_resource_count() - |
| 372 resource_pool_->acquired_resource_count()); | 372 resource_pool_->acquired_resource_count()); |
| 373 staging_state->SetInteger("bytes_pending_copy", | 373 staging_state->SetInteger("bytes_pending_copy", |
| 374 resource_pool_->total_memory_usage_bytes() - | 374 resource_pool_->total_memory_usage_bytes() - |
| 375 resource_pool_->acquired_memory_usage_bytes()); | 375 resource_pool_->acquired_memory_usage_bytes()); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace cc | 378 } // namespace cc |
| OLD | NEW |