| Index: cc/raster/one_copy_raster_buffer_provider.cc
|
| diff --git a/cc/raster/one_copy_raster_buffer_provider.cc b/cc/raster/one_copy_raster_buffer_provider.cc
|
| index 8b5acfc114f74491cced19aba7d862fbf9f9132b..cdbe9e639a487df39b1489dc44a171df9c8c7744 100644
|
| --- a/cc/raster/one_copy_raster_buffer_provider.cc
|
| +++ b/cc/raster/one_copy_raster_buffer_provider.cc
|
| @@ -20,6 +20,7 @@
|
| #include "cc/resources/resource_util.h"
|
| #include "cc/resources/scoped_resource.h"
|
| #include "gpu/GLES2/gl2extchromium.h"
|
| +#include "gpu/command_buffer/client/context_support.h"
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
|
| #include "ui/gfx/buffer_format_util.h"
|
| @@ -161,6 +162,42 @@ bool OneCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
|
| return false;
|
| }
|
|
|
| +bool OneCopyRasterBufferProvider::IsResourceReadyToDraw(
|
| + ResourceId resource_id) const {
|
| + if (!async_worker_context_enabled_)
|
| + return true;
|
| +
|
| + gpu::SyncToken sync_token =
|
| + resource_provider_->GetSyncTokenForResource(resource_id);
|
| + if (!sync_token.HasData())
|
| + return true;
|
| +
|
| + return compositor_context_provider_->ContextSupport()->IsFenceSyncReleased(
|
| + sync_token.release_count());
|
| +}
|
| +
|
| +uint64_t OneCopyRasterBufferProvider::SetReadyToDrawCallback(
|
| + const ResourceProvider::ResourceIdArray& resource_ids,
|
| + const base::Closure& callback,
|
| + uint64_t pending_callback_id) const {
|
| + if (!async_worker_context_enabled_)
|
| + return 0;
|
| +
|
| + gpu::SyncToken sync_token =
|
| + resource_provider_->GetSyncTokenForResources(resource_ids);
|
| + uint64_t callback_id = sync_token.release_count();
|
| + DCHECK_NE(callback_id, 0u);
|
| +
|
| + // If the callback we are about to request has the same ID as the one which
|
| + // our caller is waiting on, then the request is redundant.
|
| + if (callback_id != pending_callback_id) {
|
| + compositor_context_provider_->ContextSupport()->SignalSyncToken(sync_token,
|
| + callback);
|
| + }
|
| +
|
| + return callback_id;
|
| +}
|
| +
|
| void OneCopyRasterBufferProvider::Shutdown() {
|
| staging_pool_.Shutdown();
|
| pending_raster_buffers_.clear();
|
|
|