| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/playback/raster_source.h" | 10 #include "cc/playback/raster_source.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); | 43 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); |
| 44 // GPU raster doesn't do low res tiles, so should always include images. | 44 // GPU raster doesn't do low res tiles, so should always include images. |
| 45 DCHECK(include_images); | 45 DCHECK(include_images); |
| 46 ContextProvider* context_provider = rasterizer_->resource_provider() | 46 ContextProvider* context_provider = rasterizer_->resource_provider() |
| 47 ->output_surface() | 47 ->output_surface() |
| 48 ->worker_context_provider(); | 48 ->worker_context_provider(); |
| 49 DCHECK(context_provider); | 49 DCHECK(context_provider); |
| 50 | 50 |
| 51 ContextProvider::ScopedContextLock scoped_context(context_provider); | 51 ContextProvider::ScopedContextLock scoped_context(context_provider); |
| 52 | 52 |
| 53 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); |
| 54 if (!gl) |
| 55 return; |
| 56 |
| 53 gfx::Rect playback_rect = raster_full_rect; | 57 gfx::Rect playback_rect = raster_full_rect; |
| 54 if (resource_has_previous_content_) { | 58 if (resource_has_previous_content_) { |
| 55 playback_rect.Intersect(raster_dirty_rect); | 59 playback_rect.Intersect(raster_dirty_rect); |
| 56 } | 60 } |
| 57 DCHECK(!playback_rect.IsEmpty()) | 61 DCHECK(!playback_rect.IsEmpty()) |
| 58 << "Why are we rastering a tile that's not dirty?"; | 62 << "Why are we rastering a tile that's not dirty?"; |
| 59 | 63 |
| 60 // TODO(danakj): Implement partial raster with raster_dirty_rect. | 64 // TODO(danakj): Implement partial raster with raster_dirty_rect. |
| 61 // Rasterize source into resource. | 65 // Rasterize source into resource. |
| 62 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, | 66 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, |
| 63 playback_rect, scale); | 67 playback_rect, scale); |
| 64 | 68 |
| 65 // Barrier to sync worker context output to cc context. | 69 // Barrier to sync worker context output to cc context. |
| 66 scoped_context.ContextGL()->OrderingBarrierCHROMIUM(); | 70 gl->OrderingBarrierCHROMIUM(); |
| 67 } | 71 } |
| 68 | 72 |
| 69 private: | 73 private: |
| 70 GpuRasterizer* rasterizer_; | 74 GpuRasterizer* rasterizer_; |
| 71 ResourceProvider::ScopedWriteLockGr lock_; | 75 ResourceProvider::ScopedWriteLockGr lock_; |
| 72 bool resource_has_previous_content_; | 76 bool resource_has_previous_content_; |
| 73 | 77 |
| 74 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 78 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 75 }; | 79 }; |
| 76 | 80 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { | 241 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { |
| 238 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set", | 242 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set", |
| 239 task_set); | 243 task_set); |
| 240 | 244 |
| 241 DCHECK(tasks_pending_[task_set]); | 245 DCHECK(tasks_pending_[task_set]); |
| 242 tasks_pending_[task_set] = false; | 246 tasks_pending_[task_set] = false; |
| 243 client_->DidFinishRunningTileTasks(task_set); | 247 client_->DidFinishRunningTileTasks(task_set); |
| 244 } | 248 } |
| 245 | 249 |
| 246 } // namespace cc | 250 } // namespace cc |
| OLD | NEW |