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/memory/ptr_util.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "cc/playback/raster_source.h" | 14 #include "cc/playback/raster_source.h" |
15 #include "cc/raster/gpu_rasterizer.h" | 15 #include "cc/raster/gpu_rasterizer.h" |
16 #include "cc/raster/raster_buffer.h" | |
17 #include "cc/raster/scoped_gpu_raster.h" | 16 #include "cc/raster/scoped_gpu_raster.h" |
18 #include "cc/resources/resource.h" | 17 #include "cc/resources/resource.h" |
19 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
20 #include "third_party/skia/include/core/SkMultiPictureDraw.h" | 19 #include "third_party/skia/include/core/SkMultiPictureDraw.h" |
21 #include "third_party/skia/include/core/SkPictureRecorder.h" | 20 #include "third_party/skia/include/core/SkPictureRecorder.h" |
22 #include "third_party/skia/include/core/SkSurface.h" | 21 #include "third_party/skia/include/core/SkSurface.h" |
23 #include "third_party/skia/include/gpu/GrContext.h" | 22 #include "third_party/skia/include/gpu/GrContext.h" |
24 | 23 |
25 namespace cc { | 24 namespace cc { |
26 namespace { | 25 namespace { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool must_support_alpha) const { | 160 bool must_support_alpha) const { |
162 return rasterizer_->resource_provider()->best_render_buffer_format(); | 161 return rasterizer_->resource_provider()->best_render_buffer_format(); |
163 } | 162 } |
164 | 163 |
165 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle( | 164 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle( |
166 bool must_support_alpha) const { | 165 bool must_support_alpha) const { |
167 // This doesn't require a swizzle because we rasterize to the correct format. | 166 // This doesn't require a swizzle because we rasterize to the correct format. |
168 return false; | 167 return false; |
169 } | 168 } |
170 | 169 |
| 170 RasterBufferProvider* GpuTileTaskWorkerPool::AsRasterBufferProvider() { |
| 171 return this; |
| 172 } |
| 173 |
171 void GpuTileTaskWorkerPool::CompleteTasks(const Task::Vector& tasks) { | 174 void GpuTileTaskWorkerPool::CompleteTasks(const Task::Vector& tasks) { |
172 for (auto& task : tasks) { | 175 for (auto& task : tasks) { |
173 TileTask* tile_task = static_cast<TileTask*>(task.get()); | 176 TileTask* tile_task = static_cast<TileTask*>(task.get()); |
174 | 177 |
175 tile_task->WillComplete(); | 178 tile_task->WillComplete(); |
176 tile_task->CompleteOnOriginThread(this); | 179 tile_task->CompleteOnOriginThread(this); |
177 tile_task->DidComplete(); | 180 tile_task->DidComplete(); |
178 } | 181 } |
179 completed_tasks_.clear(); | 182 completed_tasks_.clear(); |
180 } | 183 } |
181 | 184 |
182 std::unique_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( | 185 std::unique_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( |
183 const Resource* resource, | 186 const Resource* resource, |
184 uint64_t resource_content_id, | 187 uint64_t resource_content_id, |
185 uint64_t previous_content_id) { | 188 uint64_t previous_content_id) { |
186 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( | 189 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( |
187 rasterizer_.get(), resource, resource_content_id, previous_content_id)); | 190 rasterizer_.get(), resource, resource_content_id, previous_content_id)); |
188 } | 191 } |
189 | 192 |
190 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( | 193 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( |
191 std::unique_ptr<RasterBuffer> buffer) { | 194 std::unique_ptr<RasterBuffer> buffer) { |
192 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 195 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
193 } | 196 } |
194 | 197 |
195 } // namespace cc | 198 } // namespace cc |
OLD | NEW |