| 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/zero_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 14 #include "base/trace_event/trace_event_argument.h" | 15 #include "base/trace_event/trace_event_argument.h" |
| 15 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
| 16 #include "cc/raster/raster_buffer.h" | 17 #include "cc/raster/raster_buffer.h" |
| 17 #include "cc/resources/platform_color.h" | 18 #include "cc/resources/platform_color.h" |
| 18 #include "cc/resources/resource.h" | 19 #include "cc/resources/resource.h" |
| 19 #include "ui/gfx/buffer_format_util.h" | 20 #include "ui/gfx/buffer_format_util.h" |
| 20 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
| 21 | 22 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 private: | 59 private: |
| 59 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; | 60 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; |
| 60 const Resource* resource_; | 61 const Resource* resource_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 63 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace | 66 } // namespace |
| 66 | 67 |
| 67 // static | 68 // static |
| 68 scoped_ptr<TileTaskWorkerPool> ZeroCopyTileTaskWorkerPool::Create( | 69 std::unique_ptr<TileTaskWorkerPool> ZeroCopyTileTaskWorkerPool::Create( |
| 69 base::SequencedTaskRunner* task_runner, | 70 base::SequencedTaskRunner* task_runner, |
| 70 TaskGraphRunner* task_graph_runner, | 71 TaskGraphRunner* task_graph_runner, |
| 71 ResourceProvider* resource_provider, | 72 ResourceProvider* resource_provider, |
| 72 ResourceFormat preferred_tile_format) { | 73 ResourceFormat preferred_tile_format) { |
| 73 return make_scoped_ptr<TileTaskWorkerPool>( | 74 return base::WrapUnique<TileTaskWorkerPool>( |
| 74 new ZeroCopyTileTaskWorkerPool(task_runner, task_graph_runner, | 75 new ZeroCopyTileTaskWorkerPool(task_runner, task_graph_runner, |
| 75 resource_provider, preferred_tile_format)); | 76 resource_provider, preferred_tile_format)); |
| 76 } | 77 } |
| 77 | 78 |
| 78 ZeroCopyTileTaskWorkerPool::ZeroCopyTileTaskWorkerPool( | 79 ZeroCopyTileTaskWorkerPool::ZeroCopyTileTaskWorkerPool( |
| 79 base::SequencedTaskRunner* task_runner, | 80 base::SequencedTaskRunner* task_runner, |
| 80 TaskGraphRunner* task_graph_runner, | 81 TaskGraphRunner* task_graph_runner, |
| 81 ResourceProvider* resource_provider, | 82 ResourceProvider* resource_provider, |
| 82 ResourceFormat preferred_tile_format) | 83 ResourceFormat preferred_tile_format) |
| 83 : task_runner_(task_runner), | 84 : task_runner_(task_runner), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 134 } |
| 134 | 135 |
| 135 return resource_provider_->best_texture_format(); | 136 return resource_provider_->best_texture_format(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 bool ZeroCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( | 139 bool ZeroCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( |
| 139 bool must_support_alpha) const { | 140 bool must_support_alpha) const { |
| 140 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 141 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
| 141 } | 142 } |
| 142 | 143 |
| 143 scoped_ptr<RasterBuffer> ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster( | 144 std::unique_ptr<RasterBuffer> |
| 145 ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster( |
| 144 const Resource* resource, | 146 const Resource* resource, |
| 145 uint64_t resource_content_id, | 147 uint64_t resource_content_id, |
| 146 uint64_t previous_content_id) { | 148 uint64_t previous_content_id) { |
| 147 return make_scoped_ptr<RasterBuffer>( | 149 return base::WrapUnique<RasterBuffer>( |
| 148 new RasterBufferImpl(resource_provider_, resource)); | 150 new RasterBufferImpl(resource_provider_, resource)); |
| 149 } | 151 } |
| 150 | 152 |
| 151 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster( | 153 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster( |
| 152 scoped_ptr<RasterBuffer> buffer) { | 154 std::unique_ptr<RasterBuffer> buffer) { |
| 153 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 155 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 154 } | 156 } |
| 155 | 157 |
| 156 } // namespace cc | 158 } // namespace cc |
| OLD | NEW |