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/resources/pixel_buffer_tile_task_worker_pool.h" | 5 #include "cc/resources/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 25 matching lines...) Expand all Loading... |
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& rect, |
40 float scale) override { | 40 float scale) override { |
41 if (!memory_) | 41 if (!memory_) |
42 return; | 42 return; |
43 | 43 |
44 TileTaskWorkerPool::PlaybackToMemory(memory_, resource_->format(), | 44 TileTaskWorkerPool::PlaybackToMemory(memory_, resource_->format(), |
45 resource_->size(), stride_, | 45 resource_->size(), stride_, |
46 raster_source, rect, scale); | 46 raster_source, rect, rect, scale); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 ResourceProvider* resource_provider_; | 50 ResourceProvider* resource_provider_; |
51 const Resource* resource_; | 51 const Resource* resource_; |
52 uint8_t* memory_; | 52 uint8_t* memory_; |
53 int stride_; | 53 int stride_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 55 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
56 }; | 56 }; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 task->RunReplyOnOriginThread(); | 305 task->RunReplyOnOriginThread(); |
306 } | 306 } |
307 completed_raster_tasks_.clear(); | 307 completed_raster_tasks_.clear(); |
308 } | 308 } |
309 | 309 |
310 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() { | 310 ResourceFormat PixelBufferTileTaskWorkerPool::GetResourceFormat() { |
311 return resource_provider_->memory_efficient_texture_format(); | 311 return resource_provider_->memory_efficient_texture_format(); |
312 } | 312 } |
313 | 313 |
314 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( | 314 scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster( |
315 const Resource* resource) { | 315 const TileTaskData& data) { |
316 return make_scoped_ptr<RasterBuffer>( | 316 return make_scoped_ptr<RasterBuffer>( |
317 new RasterBufferImpl(resource_provider_, resource)); | 317 new RasterBufferImpl(resource_provider_, data.resource)); |
318 } | 318 } |
319 | 319 |
320 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( | 320 void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster( |
321 scoped_ptr<RasterBuffer> buffer) { | 321 scoped_ptr<RasterBuffer> buffer) { |
322 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 322 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
323 } | 323 } |
324 | 324 |
325 void PixelBufferTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { | 325 void PixelBufferTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { |
326 TRACE_EVENT2("cc", "PixelBufferTileTaskWorkerPool::OnTaskSetFinished", | 326 TRACE_EVENT2("cc", "PixelBufferTileTaskWorkerPool::OnTaskSetFinished", |
327 "task_set", task_set, | 327 "task_set", task_set, |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( | 721 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( |
722 base::trace_event::TracedValue* throttle_state) const { | 722 base::trace_event::TracedValue* throttle_state) const { |
723 throttle_state->SetInteger("bytes_available_for_upload", | 723 throttle_state->SetInteger("bytes_available_for_upload", |
724 max_bytes_pending_upload_ - bytes_pending_upload_); | 724 max_bytes_pending_upload_ - bytes_pending_upload_); |
725 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 725 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
726 throttle_state->SetInteger("scheduled_raster_task_count", | 726 throttle_state->SetInteger("scheduled_raster_task_count", |
727 scheduled_raster_task_count_); | 727 scheduled_raster_task_count_); |
728 } | 728 } |
729 | 729 |
730 } // namespace cc | 730 } // namespace cc |
OLD | NEW |