| 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/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "cc/playback/raster_source.h" | 13 #include "cc/playback/raster_source.h" |
| 14 #include "cc/raster/gpu_rasterizer.h" | 14 #include "cc/raster/gpu_rasterizer.h" |
| 15 #include "cc/raster/raster_buffer.h" | |
| 16 #include "cc/raster/scoped_gpu_raster.h" | 15 #include "cc/raster/scoped_gpu_raster.h" |
| 17 #include "cc/resources/resource.h" | 16 #include "cc/resources/resource.h" |
| 18 #include "gpu/command_buffer/client/gles2_interface.h" | 17 #include "gpu/command_buffer/client/gles2_interface.h" |
| 19 #include "third_party/skia/include/core/SkMultiPictureDraw.h" | 18 #include "third_party/skia/include/core/SkMultiPictureDraw.h" |
| 20 #include "third_party/skia/include/core/SkPictureRecorder.h" | 19 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 21 #include "third_party/skia/include/core/SkSurface.h" | 20 #include "third_party/skia/include/core/SkSurface.h" |
| 22 #include "third_party/skia/include/gpu/GrContext.h" | 21 #include "third_party/skia/include/gpu/GrContext.h" |
| 23 | 22 |
| 24 namespace cc { | 23 namespace cc { |
| 25 namespace { | 24 namespace { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::Shutdown"); | 127 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::Shutdown"); |
| 129 | 128 |
| 130 TaskGraph empty; | 129 TaskGraph empty; |
| 131 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); | 130 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); |
| 132 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); | 131 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void GpuTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { | 134 void GpuTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { |
| 136 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::ScheduleTasks"); | 135 TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::ScheduleTasks"); |
| 137 | 136 |
| 138 ScheduleTasksOnOriginThread(this, graph); | 137 ScheduleTasksOnOriginThread(graph); |
| 139 | 138 |
| 140 // Barrier to sync any new resources to the worker context. | 139 // Barrier to sync any new resources to the worker context. |
| 141 rasterizer_->resource_provider() | 140 rasterizer_->resource_provider() |
| 142 ->output_surface() | 141 ->output_surface() |
| 143 ->context_provider() | 142 ->context_provider() |
| 144 ->ContextGL() | 143 ->ContextGL() |
| 145 ->OrderingBarrierCHROMIUM(); | 144 ->OrderingBarrierCHROMIUM(); |
| 146 | 145 |
| 147 task_graph_runner_->ScheduleTasks(namespace_token_, graph); | 146 task_graph_runner_->ScheduleTasks(namespace_token_, graph); |
| 148 } | 147 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 162 } | 161 } |
| 163 | 162 |
| 164 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle( | 163 bool GpuTileTaskWorkerPool::GetResourceRequiresSwizzle( |
| 165 bool must_support_alpha) const { | 164 bool must_support_alpha) const { |
| 166 // This doesn't require a swizzle because we rasterize to the correct format. | 165 // This doesn't require a swizzle because we rasterize to the correct format. |
| 167 return false; | 166 return false; |
| 168 } | 167 } |
| 169 | 168 |
| 170 void GpuTileTaskWorkerPool::CompleteTasks(const Task::Vector& tasks) { | 169 void GpuTileTaskWorkerPool::CompleteTasks(const Task::Vector& tasks) { |
| 171 for (auto& task : tasks) { | 170 for (auto& task : tasks) { |
| 172 TileTask* tile_task = static_cast<TileTask*>(task.get()); | 171 task->WillComplete(); |
| 173 | 172 task->CompleteOnOriginThread(); |
| 174 tile_task->WillComplete(); | 173 task->DidComplete(); |
| 175 tile_task->CompleteOnOriginThread(this); | |
| 176 tile_task->DidComplete(); | |
| 177 } | 174 } |
| 178 completed_tasks_.clear(); | 175 completed_tasks_.clear(); |
| 179 } | 176 } |
| 180 | 177 |
| 181 scoped_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( | 178 scoped_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster( |
| 182 const Resource* resource, | 179 const Resource* resource, |
| 183 uint64_t resource_content_id, | 180 uint64_t resource_content_id, |
| 184 uint64_t previous_content_id) { | 181 uint64_t previous_content_id) { |
| 185 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 182 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
| 186 rasterizer_.get(), resource, resource_content_id, previous_content_id)); | 183 rasterizer_.get(), resource, resource_content_id, previous_content_id)); |
| 187 } | 184 } |
| 188 | 185 |
| 189 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( | 186 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( |
| 190 scoped_ptr<RasterBuffer> buffer) { | 187 scoped_ptr<RasterBuffer> buffer) { |
| 191 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 188 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 192 } | 189 } |
| 193 | 190 |
| 194 } // namespace cc | 191 } // namespace cc |
| OLD | NEW |