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/resources/image_raster_worker_pool.h" | 5 #include "cc/resources/image_raster_worker_pool.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/debug/traced_value.h" | 8 #include "cc/debug/traced_value.h" |
9 #include "cc/resources/resource.h" | 9 #include "cc/resources/resource.h" |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 completed_tasks_.clear(); | 145 completed_tasks_.clear(); |
146 } | 146 } |
147 | 147 |
148 SkCanvas* ImageRasterWorkerPool::AcquireCanvasForRaster(RasterTask* task) { | 148 SkCanvas* ImageRasterWorkerPool::AcquireCanvasForRaster(RasterTask* task) { |
149 return resource_provider_->MapImageRasterBuffer(task->resource()->id()); | 149 return resource_provider_->MapImageRasterBuffer(task->resource()->id()); |
150 } | 150 } |
151 | 151 |
152 void ImageRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) { | 152 void ImageRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) { |
153 resource_provider_->UnmapImageRasterBuffer(task->resource()->id()); | 153 resource_provider_->UnmapImageRasterBuffer(task->resource()->id()); |
| 154 |
| 155 // Map/UnmapImageRasterBuffer provides direct access to the memory used by the |
| 156 // GPU. Read lock fences are required to ensure that we're not trying to map a |
| 157 // resource that is currently in-use by the GPU. |
| 158 resource_provider_->EnableReadLockFences(task->resource()->id(), true); |
154 } | 159 } |
155 | 160 |
156 void ImageRasterWorkerPool::OnRasterFinished() { | 161 void ImageRasterWorkerPool::OnRasterFinished() { |
157 TRACE_EVENT0("cc", "ImageRasterWorkerPool::OnRasterFinished"); | 162 TRACE_EVENT0("cc", "ImageRasterWorkerPool::OnRasterFinished"); |
158 | 163 |
159 DCHECK(raster_tasks_pending_); | 164 DCHECK(raster_tasks_pending_); |
160 raster_tasks_pending_ = false; | 165 raster_tasks_pending_ = false; |
161 TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this); | 166 TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this); |
162 client_->DidFinishRunningTasks(); | 167 client_->DidFinishRunningTasks(); |
163 } | 168 } |
(...skipping 16 matching lines...) Expand all Loading... |
180 | 185 |
181 scoped_ptr<base::Value> ImageRasterWorkerPool::StateAsValue() const { | 186 scoped_ptr<base::Value> ImageRasterWorkerPool::StateAsValue() const { |
182 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | 187 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); |
183 | 188 |
184 state->SetBoolean("tasks_required_for_activation_pending", | 189 state->SetBoolean("tasks_required_for_activation_pending", |
185 raster_tasks_required_for_activation_pending_); | 190 raster_tasks_required_for_activation_pending_); |
186 return state.PassAs<base::Value>(); | 191 return state.PassAs<base::Value>(); |
187 } | 192 } |
188 | 193 |
189 } // namespace cc | 194 } // namespace cc |
OLD | NEW |