| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/pixel_buffer_tile_task_worker_pool.h" | 5 #include "cc/raster/pixel_buffer_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 resource_provider_->AcquirePixelBuffer(resource_->id()); | 29 resource_provider_->AcquirePixelBuffer(resource_->id()); |
| 30 memory_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); | 30 memory_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ~RasterBufferImpl() override { | 33 ~RasterBufferImpl() override { |
| 34 resource_provider_->ReleasePixelBuffer(resource_->id()); | 34 resource_provider_->ReleasePixelBuffer(resource_->id()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Overridden from RasterBuffer: | 37 // Overridden from RasterBuffer: |
| 38 void Playback(const RasterSource* raster_source, | 38 void Playback(const RasterSource* raster_source, |
| 39 const gfx::Rect& rect, | 39 const gfx::Rect& raster_full_rect, |
| 40 const gfx::Rect& raster_dirty_rect, |
| 40 float scale) override { | 41 float scale) override { |
| 41 if (!memory_) | 42 if (!memory_) |
| 42 return; | 43 return; |
| 43 | 44 |
| 44 TileTaskWorkerPool::PlaybackToMemory(memory_, resource_->format(), | 45 TileTaskWorkerPool::PlaybackToMemory( |
| 45 resource_->size(), stride_, | 46 memory_, resource_->format(), resource_->size(), stride_, raster_source, |
| 46 raster_source, rect, scale); | 47 raster_full_rect, raster_full_rect, scale); |
| 47 } | 48 } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 ResourceProvider* resource_provider_; | 51 ResourceProvider* resource_provider_; |
| 51 const Resource* resource_; | 52 const Resource* resource_; |
| 52 uint8_t* memory_; | 53 uint8_t* memory_; |
| 53 int stride_; | 54 int stride_; |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 56 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 56 }; | 57 }; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 task->RunReplyOnOriginThread(); | 306 task->RunReplyOnOriginThread(); |
| 306 } | 307 } |
| 307 completed_raster_tasks_.clear(); | 308 completed_raster_tasks_.clear(); |
| 308 } | 309 } |
| 309 | 310 |
| 310 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() { | 311 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() { |
| 311 return resource_provider_->memory_efficient_texture_format(); | 312 return resource_provider_->memory_efficient_texture_format(); |
| 312 } | 313 } |
| 313 | 314 |
| 314 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( | 315 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( |
| 315 const Resource* resource) { | 316 const TileTaskData& data) { |
| 316 return make_scoped_ptr<RasterBuffer>( | 317 return make_scoped_ptr<RasterBuffer>( |
| 317 new RasterBufferImpl(resource_provider_, resource)); | 318 new RasterBufferImpl(resource_provider_, data.resource)); |
| 318 } | 319 } |
| 319 | 320 |
| 320 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( | 321 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( |
| 321 scoped_ptr<RasterBuffer> buffer) { | 322 scoped_ptr<RasterBuffer> buffer) { |
| 322 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 323 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 323 } | 324 } |
| 324 | 325 |
| 325 void PixelBufferTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { | 326 void PixelBufferTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { |
| 326 TRACE_EVENT2("cc", "PixelBufferTileTaskWorkerPool::OnTaskSetFinished", | 327 TRACE_EVENT2("cc", "PixelBufferTileTaskWorkerPool::OnTaskSetFinished", |
| 327 "task_set", task_set, | 328 "task_set", task_set, |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( | 722 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( |
| 722 base::trace_event::TracedValue* throttle_state) const { | 723 base::trace_event::TracedValue* throttle_state) const { |
| 723 throttle_state->SetInteger("bytes_available_for_upload", | 724 throttle_state->SetInteger("bytes_available_for_upload", |
| 724 max_bytes_pending_upload_ - bytes_pending_upload_); | 725 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 725 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 726 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 726 throttle_state->SetInteger("scheduled_raster_task_count", | 727 throttle_state->SetInteger("scheduled_raster_task_count", |
| 727 scheduled_raster_task_count_); | 728 scheduled_raster_task_count_); |
| 728 } | 729 } |
| 729 | 730 |
| 730 } // namespace cc | 731 } // namespace cc |
| OLD | NEW |