| Index: cc/raster/gpu_raster_buffer_provider.cc
|
| diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
|
| index 97fb5812f5f986e4a4dd573b87f21230ddbd5333..d87492844d4e7812079143f3cfbcab8c4f46a602 100644
|
| --- a/cc/raster/gpu_raster_buffer_provider.cc
|
| +++ b/cc/raster/gpu_raster_buffer_provider.cc
|
| @@ -17,6 +17,7 @@
|
| #include "cc/playback/raster_source.h"
|
| #include "cc/raster/scoped_gpu_raster.h"
|
| #include "cc/resources/resource.h"
|
| +#include "gpu/command_buffer/client/context_support.h"
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| #include "third_party/skia/include/core/SkMultiPictureDraw.h"
|
| #include "third_party/skia/include/core/SkPictureRecorder.h"
|
| @@ -186,6 +187,47 @@ bool GpuRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
|
| return msaa_sample_count_ == 0;
|
| }
|
|
|
| +bool GpuRasterBufferProvider::IsResourceReadyToDraw(
|
| + ResourceId resource_id) const {
|
| + if (!async_worker_context_enabled_)
|
| + return true;
|
| +
|
| + ResourceProvider::ResourceIdArray resources;
|
| + resources.push_back(resource_id);
|
| + gpu::SyncToken sync_token =
|
| + resource_provider_->GetSyncTokenForResources(resources);
|
| + if (!sync_token.HasData())
|
| + return true;
|
| +
|
| + // IsSyncTokenSignalled is threadsafe, no need for worker context lock.
|
| + return worker_context_provider_->ContextSupport()->IsSyncTokenSignalled(
|
| + sync_token);
|
| +}
|
| +
|
| +uint64_t GpuRasterBufferProvider::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 is different from the one the caller is already waiting on,
|
| + // pass the callback through to SignalSinkToken. Otherwise the request is
|
| + // redundant.
|
| + if (callback_id != pending_callback_id) {
|
| + // SignalSyncToken is threadsafe, no need for worker context lock.
|
| + worker_context_provider_->ContextSupport()->SignalSyncToken(sync_token,
|
| + callback);
|
| + }
|
| +
|
| + return callback_id;
|
| +}
|
| +
|
| void GpuRasterBufferProvider::Shutdown() {
|
| pending_raster_buffers_.clear();
|
| }
|
|
|