#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include <utility>
#include "base/auto_reset.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loading_log.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
namespace blink {
static Persistent<MemoryCache>* g_memory_cache;
static const unsigned kCDefaultCacheCapacity = …;
static const base::TimeDelta kCMinDelayBeforeLiveDecodedPrune = …;
static const base::TimeDelta kCMaxPruneDeferralDelay = …;
static const base::TimeDelta kCUnloadPageResourceSaveTime = …;
static constexpr char kPageSavedResourceStrongReferenceSize[] = …;
static const float kCTargetPrunePercentage = …;
MemoryCache* ReplaceMemoryCacheForTesting(MemoryCache* cache) { … }
void MemoryCacheEntry::Trace(Visitor* visitor) const { … }
void MemoryCacheEntry::ClearResourceWeak(const LivenessBroker& info) { … }
MemoryCache* MemoryCache::Get() { … }
MemoryCache::MemoryCache(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
MemoryCache::~MemoryCache() = default;
void MemoryCache::Trace(Visitor* visitor) const { … }
KURL MemoryCache::RemoveFragmentIdentifierIfNeeded(const KURL& original_url) { … }
String MemoryCache::DefaultCacheIdentifier() { … }
MemoryCache::ResourceMap* MemoryCache::EnsureResourceMap(
const String& cache_identifier) { … }
void MemoryCache::Add(Resource* resource) { … }
void MemoryCache::AddInternal(ResourceMap* resource_map,
MemoryCacheEntry* entry) { … }
void MemoryCache::Remove(Resource* resource) { … }
void MemoryCache::RemoveInternal(ResourceMap* resource_map,
const ResourceMap::iterator& it) { … }
bool MemoryCache::Contains(const Resource* resource) const { … }
Resource* MemoryCache::ResourceForURLForTesting(
const KURL& resource_url) const { … }
Resource* MemoryCache::ResourceForURL(const KURL& resource_url,
const String& cache_identifier) const { … }
HeapVector<Member<Resource>> MemoryCache::ResourcesForURL(
const KURL& resource_url) const { … }
void MemoryCache::PruneResources(PruneStrategy strategy) { … }
void MemoryCache::SetCapacity(size_t total_bytes) { … }
void MemoryCache::Update(Resource* resource, size_t old_size, size_t new_size) { … }
void MemoryCache::RemoveURLFromCache(const KURL& url) { … }
void MemoryCache::TypeStatistic::AddResource(Resource* o) { … }
MemoryCache::Statistics MemoryCache::GetStatistics() const { … }
void MemoryCache::EvictResources() { … }
void MemoryCache::Prune() { … }
void MemoryCache::PruneAll() { … }
void MemoryCache::PruneNow(PruneStrategy strategy) { … }
void MemoryCache::UpdateFramePaintTimestamp() { … }
bool MemoryCache::OnMemoryDump(WebMemoryDumpLevelOfDetail level_of_detail,
WebProcessMemoryDump* memory_dump) { … }
void MemoryCache::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel level) { … }
void MemoryCache::SavePageResourceStrongReferences(
HeapVector<Member<Resource>> resources) { … }
void MemoryCache::SaveStrongReference(Resource* resource) { … }
void MemoryCache::PruneStrongReferences() { … }
void MemoryCache::ClearStrongReferences() { … }
}