| 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/raster/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "base/trace_event/trace_event_argument.h" | 16 #include "base/trace_event/trace_event_argument.h" |
| 17 #include "cc/debug/traced_value.h" | 17 #include "cc/debug/traced_value.h" |
| 18 #include "cc/playback/raster_source.h" | 18 #include "cc/playback/raster_source.h" |
| 19 #include "cc/raster/raster_buffer.h" | |
| 20 #include "cc/resources/platform_color.h" | 19 #include "cc/resources/platform_color.h" |
| 21 #include "cc/resources/resource.h" | 20 #include "cc/resources/resource.h" |
| 22 | 21 |
| 23 namespace cc { | 22 namespace cc { |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 class RasterBufferImpl : public RasterBuffer { | 25 class RasterBufferImpl : public RasterBuffer { |
| 27 public: | 26 public: |
| 28 RasterBufferImpl(ResourceProvider* resource_provider, | 27 RasterBufferImpl(ResourceProvider* resource_provider, |
| 29 const Resource* resource, | 28 const Resource* resource, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( | 125 ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat( |
| 127 bool must_support_alpha) const { | 126 bool must_support_alpha) const { |
| 128 return resource_provider_->best_texture_format(); | 127 return resource_provider_->best_texture_format(); |
| 129 } | 128 } |
| 130 | 129 |
| 131 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( | 130 bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle( |
| 132 bool must_support_alpha) const { | 131 bool must_support_alpha) const { |
| 133 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 132 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
| 134 } | 133 } |
| 135 | 134 |
| 135 RasterBufferProvider* BitmapTileTaskWorkerPool::AsRasterBufferProvider() { |
| 136 return this; |
| 137 } |
| 138 |
| 136 std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( | 139 std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster( |
| 137 const Resource* resource, | 140 const Resource* resource, |
| 138 uint64_t resource_content_id, | 141 uint64_t resource_content_id, |
| 139 uint64_t previous_content_id) { | 142 uint64_t previous_content_id) { |
| 140 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( | 143 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( |
| 141 resource_provider_, resource, resource_content_id, previous_content_id)); | 144 resource_provider_, resource, resource_content_id, previous_content_id)); |
| 142 } | 145 } |
| 143 | 146 |
| 144 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 147 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
| 145 std::unique_ptr<RasterBuffer> buffer) { | 148 std::unique_ptr<RasterBuffer> buffer) { |
| 146 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 149 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 147 } | 150 } |
| 148 | 151 |
| 149 } // namespace cc | 152 } // namespace cc |
| OLD | NEW |