#include "gpu/command_buffer/service/dawn_caching_interface.h"
#include <cstring>
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
#include "gpu/config/gpu_preferences.h"
#include "net/base/io_buffer.h"
namespace gpu::webgpu {
DawnCachingInterface::DawnCachingInterface(
scoped_refptr<detail::DawnCachingBackend> backend,
CacheBlobCallback callback)
: … { … }
DawnCachingInterface::~DawnCachingInterface() = default;
size_t DawnCachingInterface::LoadData(const void* key,
size_t key_size,
void* value_out,
size_t value_size) { … }
void DawnCachingInterface::StoreData(const void* key,
size_t key_size,
const void* value,
size_t value_size) { … }
DawnCachingInterfaceFactory::DawnCachingInterfaceFactory(BackendFactory factory)
: … { … }
DawnCachingInterfaceFactory::DawnCachingInterfaceFactory()
: … { … }
DawnCachingInterfaceFactory::~DawnCachingInterfaceFactory() = default;
std::unique_ptr<DawnCachingInterface>
DawnCachingInterfaceFactory::CreateInstance(
const gpu::GpuDiskCacheHandle& handle,
DawnCachingInterface::CacheBlobCallback callback) { … }
std::unique_ptr<DawnCachingInterface>
DawnCachingInterfaceFactory::CreateInstance() { … }
void DawnCachingInterfaceFactory::ReleaseHandle(
const gpu::GpuDiskCacheHandle& handle) { … }
scoped_refptr<detail::DawnCachingBackend>
DawnCachingInterfaceFactory::CreateDefaultInMemoryBackend() { … }
namespace detail {
DawnCachingBackend::Entry::Entry(const std::string& key,
const void* value,
size_t value_size)
: … { … }
const std::string& DawnCachingBackend::Entry::Key() const { … }
size_t DawnCachingBackend::Entry::TotalSize() const { … }
size_t DawnCachingBackend::Entry::DataSize() const { … }
size_t DawnCachingBackend::Entry::ReadData(void* value_out,
size_t value_size) const { … }
bool operator<(const std::unique_ptr<DawnCachingBackend::Entry>& lhs,
const std::unique_ptr<DawnCachingBackend::Entry>& rhs) { … }
bool operator<(const std::unique_ptr<DawnCachingBackend::Entry>& lhs,
const std::string& rhs) { … }
bool operator<(const std::string& lhs,
const std::unique_ptr<DawnCachingBackend::Entry>& rhs) { … }
DawnCachingBackend::DawnCachingBackend(size_t max_size) : … { … }
DawnCachingBackend::~DawnCachingBackend() = default;
size_t DawnCachingBackend::LoadData(const std::string& key,
void* value_out,
size_t value_size) { … }
void DawnCachingBackend::StoreData(const std::string& key,
const void* value,
size_t value_size) { … }
void DawnCachingBackend::EvictEntry(DawnCachingBackend::Entry* entry) { … }
}
}