| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 uint64_t pending_callback_id) const { | 184 uint64_t pending_callback_id) const { |
| 185 if (!async_worker_context_enabled_) | 185 if (!async_worker_context_enabled_) |
| 186 return 0; | 186 return 0; |
| 187 | 187 |
| 188 gpu::SyncToken sync_token = | 188 gpu::SyncToken sync_token = |
| 189 resource_provider_->GetSyncTokenForResources(resource_ids); | 189 resource_provider_->GetSyncTokenForResources(resource_ids); |
| 190 uint64_t callback_id = sync_token.release_count(); | 190 uint64_t callback_id = sync_token.release_count(); |
| 191 DCHECK_NE(callback_id, 0u); | 191 DCHECK_NE(callback_id, 0u); |
| 192 | 192 |
| 193 // If the callback is different from the one the caller is already waiting on, | 193 // If the callback is different from the one the caller is already waiting on, |
| 194 // pass the callback through to SignalSinkToken. Otherwise the request is | 194 // pass the callback through to SignalSyncToken. Otherwise the request is |
| 195 // redundant. | 195 // redundant. |
| 196 if (callback_id != pending_callback_id) { | 196 if (callback_id != pending_callback_id) { |
| 197 // SignalSyncToken is threadsafe, no need for worker context lock. | 197 // Use the compositor context because we want this callback on the impl |
| 198 worker_context_provider_->ContextSupport()->SignalSyncToken(sync_token, | 198 // thread. |
| 199 callback); | 199 compositor_context_provider_->ContextSupport()->SignalSyncToken(sync_token, |
| 200 callback); |
| 200 } | 201 } |
| 201 | 202 |
| 202 return callback_id; | 203 return callback_id; |
| 203 } | 204 } |
| 204 | 205 |
| 205 void OneCopyRasterBufferProvider::Shutdown() { | 206 void OneCopyRasterBufferProvider::Shutdown() { |
| 206 staging_pool_.Shutdown(); | 207 staging_pool_.Shutdown(); |
| 207 pending_raster_buffers_.clear(); | 208 pending_raster_buffers_.clear(); |
| 208 } | 209 } |
| 209 | 210 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 resource_lock->set_synchronized(!async_worker_context_enabled_); | 428 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 428 } | 429 } |
| 429 | 430 |
| 430 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 431 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
| 431 return use_partial_raster_ | 432 return use_partial_raster_ |
| 432 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 433 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 433 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 434 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
| 434 } | 435 } |
| 435 | 436 |
| 436 } // namespace cc | 437 } // namespace cc |
| OLD | NEW |