#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_resource_provider_cache.h"
#include "base/containers/adapters.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
RecyclableCanvasResource::RecyclableCanvasResource(
std::unique_ptr<CanvasResourceProvider> resource_provider,
base::WeakPtr<WebGPURecyclableResourceCache> cache)
: … { … }
RecyclableCanvasResource::~RecyclableCanvasResource() { … }
WebGPURecyclableResourceCache::WebGPURecyclableResourceCache(
base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
std::unique_ptr<RecyclableCanvasResource>
WebGPURecyclableResourceCache::GetOrCreateCanvasResource(
const SkImageInfo& info) { … }
void WebGPURecyclableResourceCache::OnDestroyRecyclableResource(
std::unique_ptr<CanvasResourceProvider> resource_provider,
const gpu::SyncToken& completion_sync_token) { … }
WebGPURecyclableResourceCache::Resource::Resource(
std::unique_ptr<CanvasResourceProvider> resource_provider,
unsigned int timer_id,
int resource_size)
: … { … }
WebGPURecyclableResourceCache::Resource::Resource(Resource&& that) noexcept =
default;
WebGPURecyclableResourceCache::Resource::~Resource() = default;
std::unique_ptr<CanvasResourceProvider>
WebGPURecyclableResourceCache::AcquireCachedProvider(
const SkImageInfo& image_info) { … }
void WebGPURecyclableResourceCache::ReleaseStaleResources() { … }
void WebGPURecyclableResourceCache::StartResourceCleanUpTimer() { … }
wtf_size_t
WebGPURecyclableResourceCache::CleanUpResourcesAndReturnSizeForTesting() { … }
}