#include "components/services/storage/service_worker/service_worker_disk_cache.h"
#include <limits>
#include <utility>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/cache_type.h"
#include "net/base/completion_once_callback.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/net_errors.h"
namespace storage {
class ServiceWorkerDiskCache::CreateBackendCallbackShim
: public base::RefCounted<CreateBackendCallbackShim> { … };
ServiceWorkerDiskCacheEntry::ServiceWorkerDiskCacheEntry(
disk_cache::Entry* disk_cache_entry,
ServiceWorkerDiskCache* cache)
: … { … }
ServiceWorkerDiskCacheEntry::~ServiceWorkerDiskCacheEntry() { … }
int ServiceWorkerDiskCacheEntry::Read(int index,
int64_t offset,
net::IOBuffer* buf,
int buf_len,
net::CompletionOnceCallback callback) { … }
int ServiceWorkerDiskCacheEntry::Write(int index,
int64_t offset,
net::IOBuffer* buf,
int buf_len,
net::CompletionOnceCallback callback) { … }
int64_t ServiceWorkerDiskCacheEntry::GetSize(int index) { … }
void ServiceWorkerDiskCacheEntry::Abandon() { … }
ServiceWorkerDiskCache::ServiceWorkerDiskCache() = default;
ServiceWorkerDiskCache::~ServiceWorkerDiskCache() { … }
net::Error ServiceWorkerDiskCache::InitWithDiskBackend(
const base::FilePath& disk_cache_directory,
base::OnceClosure post_cleanup_callback,
net::CompletionOnceCallback callback) { … }
net::Error ServiceWorkerDiskCache::InitWithMemBackend(
int64_t mem_cache_size,
net::CompletionOnceCallback callback) { … }
void ServiceWorkerDiskCache::Disable() { … }
void ServiceWorkerDiskCache::CreateEntry(int64_t key, EntryCallback callback) { … }
void ServiceWorkerDiskCache::OpenEntry(int64_t key, EntryCallback callback) { … }
void ServiceWorkerDiskCache::DoomEntry(int64_t key,
net::CompletionOnceCallback callback) { … }
base::WeakPtr<ServiceWorkerDiskCache> ServiceWorkerDiskCache::GetWeakPtr() { … }
net::Error ServiceWorkerDiskCache::Init(net::CacheType cache_type,
const base::FilePath& cache_directory,
int64_t cache_size,
base::OnceClosure post_cleanup_callback,
net::CompletionOnceCallback callback) { … }
void ServiceWorkerDiskCache::OnCreateBackendComplete(
disk_cache::BackendResult result) { … }
uint64_t ServiceWorkerDiskCache::GetNextCallId() { … }
void ServiceWorkerDiskCache::DidGetEntryResult(uint64_t call_id,
disk_cache::EntryResult result) { … }
void ServiceWorkerDiskCache::DidDoomEntry(uint64_t call_id, int net_error) { … }
void ServiceWorkerDiskCache::AddOpenEntry(ServiceWorkerDiskCacheEntry* entry) { … }
void ServiceWorkerDiskCache::RemoveOpenEntry(
ServiceWorkerDiskCacheEntry* entry) { … }
}