| 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/gpu_tile_task_worker_pool.h" | 5 #include "cc/raster/gpu_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/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 13 #include "cc/playback/raster_source.h" | 14 #include "cc/playback/raster_source.h" |
| 14 #include "cc/raster/gpu_rasterizer.h" | 15 #include "cc/raster/gpu_rasterizer.h" |
| 15 #include "cc/raster/raster_buffer.h" | 16 #include "cc/raster/raster_buffer.h" |
| 16 #include "cc/raster/scoped_gpu_raster.h" | 17 #include "cc/raster/scoped_gpu_raster.h" |
| 17 #include "cc/resources/resource.h" | 18 #include "cc/resources/resource.h" |
| 18 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 19 #include "third_party/skia/include/core/SkMultiPictureDraw.h" | 20 #include "third_party/skia/include/core/SkMultiPictureDraw.h" |
| 20 #include "third_party/skia/include/core/SkPictureRecorder.h" | 21 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 21 #include "third_party/skia/include/core/SkSurface.h" | 22 #include "third_party/skia/include/core/SkSurface.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 GpuRasterizer* rasterizer_; | 83 GpuRasterizer* rasterizer_; |
| 83 ResourceProvider::ScopedWriteLockGr lock_; | 84 ResourceProvider::ScopedWriteLockGr lock_; |
| 84 bool resource_has_previous_content_; | 85 bool resource_has_previous_content_; |
| 85 | 86 |
| 86 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 87 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace | 90 } // namespace |
| 90 | 91 |
| 91 // static | 92 // static |
| 92 scoped_ptr<TileTaskWorkerPool> GpuTileTaskWorkerPool::Create( | 93 std::unique_ptr<TileTaskWorkerPool> GpuTileTaskWorkerPool::Create( |
| 93 base::SequencedTaskRunner* task_runner, | 94 base::SequencedTaskRunner* task_runner, |
| 94 TaskGraphRunner* task_graph_runner, | 95 TaskGraphRunner* task_graph_runner, |
| 95 ContextProvider* context_provider, | 96 ContextProvider* context_provider, |
| 96 ResourceProvider* resource_provider, | 97 ResourceProvider* resource_provider, |
| 97 bool use_distance_field_text, | 98 bool use_distance_field_text, |
| 98 int gpu_rasterization_msaa_sample_count) { | 99 int gpu_rasterization_msaa_sample_count) { |
| 99 return make_scoped_ptr<TileTaskWorkerPool>(new GpuTileTaskWorkerPool( | 100 return base::WrapUnique<TileTaskWorkerPool>(new GpuTileTaskWorkerPool( |
| 100 task_runner, task_graph_runner, context_provider, resource_provider, | 101 task_runner, task_graph_runner, context_provider, resource_provider, |
| 101 use_distance_field_text, gpu_rasterization_msaa_sample_count)); | 102 use_distance_field_text, gpu_rasterization_msaa_sample_count)); |
| 102 } | 103 } |
| 103 | 104 |
| 104 GpuTileTaskWorkerPool::GpuTileTaskWorkerPool( | 105 GpuTileTaskWorkerPool::GpuTileTaskWorkerPool( |
| 105 base::SequencedTaskRunner* task_runner, | 106 base::SequencedTaskRunner* task_runner, |
| 106 TaskGraphRunner* task_graph_runner, | 107 TaskGraphRunner* task_graph_runner, |
| 107 ContextProvider* context_provider, | 108 ContextProvider* context_provider, |
| 108 ResourceProvider* resource_provider, | 109 ResourceProvider* resource_provider, |
| 109 bool use_distance_field_text, | 110 bool use_distance_field_text, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 for (auto& task : tasks) { | 172 for (auto& task : tasks) { |
| 172 TileTask* tile_task = static_cast<TileTask*>(task.get()); | 173 TileTask* tile_task = static_cast<TileTask*>(task.get()); |
| 173 | 174 |
| 174 tile_task->WillComplete(); | 175 tile_task->WillComplete(); |
| 175 tile_task->CompleteOnOriginThread(this); | 176 tile_task->CompleteOnOriginThread(this); |
| 176 tile_task->DidComplete(); | 177 tile_task->DidComplete(); |
| 177 } | 178 } |
| 178 completed_tasks_.clear(); | 179 completed_tasks_.clear(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 scoped_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( | 182 std::unique_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( |
| 182 const Resource* resource, | 183 const Resource* resource, |
| 183 uint64_t resource_content_id, | 184 uint64_t resource_content_id, |
| 184 uint64_t previous_content_id) { | 185 uint64_t previous_content_id) { |
| 185 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 186 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( |
| 186 rasterizer_.get(), resource, resource_content_id, previous_content_id)); | 187 rasterizer_.get(), resource, resource_content_id, previous_content_id)); |
| 187 } | 188 } |
| 188 | 189 |
| 189 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( | 190 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( |
| 190 scoped_ptr<RasterBuffer> buffer) { | 191 std::unique_ptr<RasterBuffer> buffer) { |
| 191 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 192 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace cc | 195 } // namespace cc |
| OLD | NEW |