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/one_copy_raster_buffer_provider.h" | 5 #include "cc/raster/one_copy_raster_buffer_provider.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // implementation, it cannot directly partial raster into the externally | 161 // implementation, it cannot directly partial raster into the externally |
162 // owned resource provided in AcquireBufferForRaster. | 162 // owned resource provided in AcquireBufferForRaster. |
163 return false; | 163 return false; |
164 } | 164 } |
165 | 165 |
166 bool OneCopyRasterBufferProvider::IsResourceReadyToDraw( | 166 bool OneCopyRasterBufferProvider::IsResourceReadyToDraw( |
167 ResourceId resource_id) const { | 167 ResourceId resource_id) const { |
168 if (!async_worker_context_enabled_) | 168 if (!async_worker_context_enabled_) |
169 return true; | 169 return true; |
170 | 170 |
171 ResourceProvider::ResourceIdArray resources; | |
172 resources.push_back(resource_id); | |
173 gpu::SyncToken sync_token = | 171 gpu::SyncToken sync_token = |
174 resource_provider_->GetSyncTokenForResources(resources); | 172 resource_provider_->GetSyncTokenForResources({resource_id}); |
175 if (!sync_token.HasData()) | 173 if (!sync_token.HasData()) |
176 return true; | 174 return true; |
177 | 175 |
178 // IsSyncTokenSignalled is threadsafe, no need for worker context lock. | 176 // IsSyncTokenSignalled is threadsafe, no need for worker context lock. |
179 return worker_context_provider_->ContextSupport()->IsSyncTokenSignalled( | 177 return worker_context_provider_->ContextSupport()->IsSyncTokenSignalled( |
180 sync_token); | 178 sync_token); |
181 } | 179 } |
182 | 180 |
183 uint64_t OneCopyRasterBufferProvider::SetReadyToDrawCallback( | 181 uint64_t OneCopyRasterBufferProvider::SetReadyToDrawCallback( |
184 const ResourceProvider::ResourceIdArray& resource_ids, | 182 const ResourceProvider::ResourceIdArray& resource_ids, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 resource_lock->set_synchronized(!async_worker_context_enabled_); | 427 resource_lock->set_synchronized(!async_worker_context_enabled_); |
430 } | 428 } |
431 | 429 |
432 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 430 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
433 return use_partial_raster_ | 431 return use_partial_raster_ |
434 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 432 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
435 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 433 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
436 } | 434 } |
437 | 435 |
438 } // namespace cc | 436 } // namespace cc |
OLD | NEW |