chromium/third_party/blink/renderer/platform/loader/fetch/memory_cache.cc

/*
    Copyright (C) 1998 Lars Knoll ([email protected])
    Copyright (C) 2001 Dirk Mueller ([email protected])
    Copyright (C) 2002 Waldo Bastian ([email protected])
    Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#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[] =;

// Percentage of capacity toward which we prune, to avoid immediately pruning
// again.
static const float kCTargetPrunePercentage =;

MemoryCache* ReplaceMemoryCacheForTesting(MemoryCache* cache) {}

void MemoryCacheEntry::Trace(Visitor* visitor) const {}

void MemoryCacheEntry::ClearResourceWeak(const LivenessBroker& info) {}

// static
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() {}

}  // namespace blink