#include "net/disk_cache/memory/mem_backend_impl.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/system/sys_info.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/clock.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/memory/mem_entry_impl.h"
Time;
namespace disk_cache {
namespace {
const int kDefaultInMemoryCacheSize = …;
const int kDefaultEvictionSize = …;
base::LinkNode<MemEntryImpl>* NextSkippingChildren(
const base::LinkedList<MemEntryImpl>& lru_list,
base::LinkNode<MemEntryImpl>* node) { … }
}
MemBackendImpl::MemBackendImpl(net::NetLog* net_log)
: … { … }
MemBackendImpl::~MemBackendImpl() { … }
std::unique_ptr<MemBackendImpl> MemBackendImpl::CreateBackend(
int64_t max_bytes,
net::NetLog* net_log) { … }
bool MemBackendImpl::Init() { … }
bool MemBackendImpl::SetMaxSize(int64_t max_bytes) { … }
int64_t MemBackendImpl::MaxFileSize() const { … }
void MemBackendImpl::OnEntryInserted(MemEntryImpl* entry) { … }
void MemBackendImpl::OnEntryUpdated(MemEntryImpl* entry) { … }
void MemBackendImpl::OnEntryDoomed(MemEntryImpl* entry) { … }
void MemBackendImpl::ModifyStorageSize(int32_t delta) { … }
bool MemBackendImpl::HasExceededStorageSize() const { … }
void MemBackendImpl::SetPostCleanupCallback(base::OnceClosure cb) { … }
base::Time MemBackendImpl::Now(const base::WeakPtr<MemBackendImpl>& self) { … }
void MemBackendImpl::SetClockForTesting(base::Clock* clock) { … }
int32_t MemBackendImpl::GetEntryCount() const { … }
EntryResult MemBackendImpl::OpenOrCreateEntry(const std::string& key,
net::RequestPriority priority,
EntryResultCallback callback) { … }
EntryResult MemBackendImpl::OpenEntry(const std::string& key,
net::RequestPriority request_priority,
EntryResultCallback callback) { … }
EntryResult MemBackendImpl::CreateEntry(const std::string& key,
net::RequestPriority request_priority,
EntryResultCallback callback) { … }
net::Error MemBackendImpl::DoomEntry(const std::string& key,
net::RequestPriority priority,
CompletionOnceCallback callback) { … }
net::Error MemBackendImpl::DoomAllEntries(CompletionOnceCallback callback) { … }
net::Error MemBackendImpl::DoomEntriesBetween(Time initial_time,
Time end_time,
CompletionOnceCallback callback) { … }
net::Error MemBackendImpl::DoomEntriesSince(Time initial_time,
CompletionOnceCallback callback) { … }
int64_t MemBackendImpl::CalculateSizeOfAllEntries(
Int64CompletionOnceCallback callback) { … }
int64_t MemBackendImpl::CalculateSizeOfEntriesBetween(
base::Time initial_time,
base::Time end_time,
Int64CompletionOnceCallback callback) { … }
class MemBackendImpl::MemIterator final : public Backend::Iterator { … };
std::unique_ptr<Backend::Iterator> MemBackendImpl::CreateIterator() { … }
void MemBackendImpl::OnExternalCacheHit(const std::string& key) { … }
void MemBackendImpl::EvictIfNeeded() { … }
void MemBackendImpl::EvictTill(int target_size) { … }
void MemBackendImpl::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { … }
}