| 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_raster_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_raster_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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 stride_(0) { | 29 stride_(0) { |
| 30 resource_provider_->AcquirePixelBuffer(resource_->id()); | 30 resource_provider_->AcquirePixelBuffer(resource_->id()); |
| 31 buffer_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); | 31 buffer_ = resource_provider_->MapPixelBuffer(resource_->id(), &stride_); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual ~RasterBufferImpl() { | 34 virtual ~RasterBufferImpl() { |
| 35 resource_provider_->ReleasePixelBuffer(resource_->id()); | 35 resource_provider_->ReleasePixelBuffer(resource_->id()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Overridden from RasterBuffer: | 38 // Overridden from RasterBuffer: |
| 39 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() OVERRIDE { | 39 virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { |
| 40 if (!buffer_) | 40 if (!buffer_) |
| 41 return skia::AdoptRef(SkCreateNullCanvas()); | 41 return skia::AdoptRef(SkCreateNullCanvas()); |
| 42 | 42 |
| 43 RasterWorkerPool::AcquireBitmapForBuffer( | 43 RasterWorkerPool::AcquireBitmapForBuffer( |
| 44 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); | 44 &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); |
| 45 return skia::AdoptRef(new SkCanvas(bitmap_)); | 45 return skia::AdoptRef(new SkCanvas(bitmap_)); |
| 46 } | 46 } |
| 47 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) OVERRIDE { | 47 virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { |
| 48 if (!buffer_) | 48 if (!buffer_) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 RasterWorkerPool::ReleaseBitmapForBuffer( | 51 RasterWorkerPool::ReleaseBitmapForBuffer( |
| 52 &bitmap_, buffer_, resource_->format()); | 52 &bitmap_, buffer_, resource_->format()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 ResourceProvider* resource_provider_; | 56 ResourceProvider* resource_provider_; |
| 57 const Resource* resource_; | 57 const Resource* resource_; |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( | 752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( |
| 753 base::debug::TracedValue* throttle_state) const { | 753 base::debug::TracedValue* throttle_state) const { |
| 754 throttle_state->SetInteger("bytes_available_for_upload", | 754 throttle_state->SetInteger("bytes_available_for_upload", |
| 755 max_bytes_pending_upload_ - bytes_pending_upload_); | 755 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 757 throttle_state->SetInteger("scheduled_raster_task_count", | 757 throttle_state->SetInteger("scheduled_raster_task_count", |
| 758 scheduled_raster_task_count_); | 758 scheduled_raster_task_count_); |
| 759 } | 759 } |
| 760 | 760 |
| 761 } // namespace cc | 761 } // namespace cc |
| OLD | NEW |