| 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_raster_buffer_provider.h" | 5 #include "cc/raster/gpu_raster_buffer_provider.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 uint64_t pending_callback_id) const { | 210 uint64_t pending_callback_id) const { |
| 211 if (!async_worker_context_enabled_) | 211 if (!async_worker_context_enabled_) |
| 212 return 0; | 212 return 0; |
| 213 | 213 |
| 214 gpu::SyncToken sync_token = | 214 gpu::SyncToken sync_token = |
| 215 resource_provider_->GetSyncTokenForResources(resource_ids); | 215 resource_provider_->GetSyncTokenForResources(resource_ids); |
| 216 uint64_t callback_id = sync_token.release_count(); | 216 uint64_t callback_id = sync_token.release_count(); |
| 217 DCHECK_NE(callback_id, 0u); | 217 DCHECK_NE(callback_id, 0u); |
| 218 | 218 |
| 219 // If the callback is different from the one the caller is already waiting on, | 219 // If the callback is different from the one the caller is already waiting on, |
| 220 // pass the callback through to SignalSinkToken. Otherwise the request is | 220 // pass the callback through to SignalSyncToken. Otherwise the request is |
| 221 // redundant. | 221 // redundant. |
| 222 if (callback_id != pending_callback_id) { | 222 if (callback_id != pending_callback_id) { |
| 223 // SignalSyncToken is threadsafe, no need for worker context lock. | 223 // Use the compositor context because we want this callback on the impl |
| 224 worker_context_provider_->ContextSupport()->SignalSyncToken(sync_token, | 224 // thread. |
| 225 callback); | 225 compositor_context_provider_->ContextSupport()->SignalSyncToken(sync_token, |
| 226 callback); |
| 226 } | 227 } |
| 227 | 228 |
| 228 return callback_id; | 229 return callback_id; |
| 229 } | 230 } |
| 230 | 231 |
| 231 void GpuRasterBufferProvider::Shutdown() { | 232 void GpuRasterBufferProvider::Shutdown() { |
| 232 pending_raster_buffers_.clear(); | 233 pending_raster_buffers_.clear(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void GpuRasterBufferProvider::PlaybackOnWorkerThread( | 236 void GpuRasterBufferProvider::PlaybackOnWorkerThread( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 gl->OrderingBarrierCHROMIUM(); | 268 gl->OrderingBarrierCHROMIUM(); |
| 268 | 269 |
| 269 // Generate sync token after the barrier for cross context synchronization. | 270 // Generate sync token after the barrier for cross context synchronization. |
| 270 gpu::SyncToken resource_sync_token; | 271 gpu::SyncToken resource_sync_token; |
| 271 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); | 272 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); |
| 272 resource_lock->set_sync_token(resource_sync_token); | 273 resource_lock->set_sync_token(resource_sync_token); |
| 273 resource_lock->set_synchronized(!async_worker_context_enabled_); | 274 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 274 } | 275 } |
| 275 | 276 |
| 276 } // namespace cc | 277 } // namespace cc |
| OLD | NEW |