chromium/cc/tiles/software_image_decode_cache.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/tiles/software_image_decode_cache.h"

#include <stdint.h>

#include <algorithm>
#include <string>
#include <utility>

#include "base/debug/stack_trace.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/numerics/ostream_operators.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
#include "cc/base/devtools_instrumentation.h"
#include "cc/base/features.h"
#include "cc/base/histograms.h"
#include "cc/raster/tile_task.h"
#include "cc/tiles/mipmap_util.h"
#include "components/miracle_parameter/common/public/miracle_parameter.h"
#include "ui/gfx/geometry/skia_conversions.h"

MemoryAllocatorDump;
MemoryDumpLevelOfDetail;

namespace cc {
namespace {

BASE_FEATURE();

// The number of entries to keep around in the cache. This limit can be breached
// if more items are locked. That is, locked items ignore this limit.
// Depending on the memory state of the system, we limit the amount of items
// differently.
MIRACLE_PARAMETER_FOR_INT(GetNormalMaxItemsInCacheForSoftware,
                          kNormalMaxItemsInCacheForSoftwareFeature,
                          "NormalMaxItemsInCacheForSoftware",
                          1000)

class AutoRemoveKeyFromTaskMap {};

class SoftwareImageDecodeTaskImpl : public TileTask {};

SkSize GetScaleAdjustment(const SoftwareImageDecodeCache::CacheKey& key) {}

// Returns the filter quality to be used with the decoded result of the image.
// Note that in most cases this yields Low filter quality, meaning bilinear
// interpolation. This is because the processing for the image would have
// already been done, including scaling down to a mip level. So what remains is
// to do a bilinear interpolation. The exception to this is if the developer
// specified a pixelated effect, which results in a None filter quality (nearest
// neighbor).
PaintFlags::FilterQuality GetDecodedFilterQuality(
    const SoftwareImageDecodeCache::CacheKey& key) {}

}  // namespace

SoftwareImageDecodeCache::SoftwareImageDecodeCache(
    SkColorType color_type,
    size_t locked_memory_limit_bytes)
    :{}

SoftwareImageDecodeCache::~SoftwareImageDecodeCache() {}

ImageDecodeCache::TaskResult SoftwareImageDecodeCache::GetTaskForImageAndRef(
    ClientId client_id,
    const DrawImage& image,
    const TracingInfo& tracing_info) {}

ImageDecodeCache::TaskResult
SoftwareImageDecodeCache::GetOutOfRasterDecodeTaskForImageAndRef(
    ClientId client_id,
    const DrawImage& image) {}

ImageDecodeCache::TaskResult
SoftwareImageDecodeCache::GetTaskForImageAndRefInternal(
    const DrawImage& image,
    const TracingInfo& tracing_info,
    DecodeTaskType task_type) {}

void SoftwareImageDecodeCache::AddBudgetForImage(const CacheKey& key,
                                                 CacheEntry* entry) {}

void SoftwareImageDecodeCache::RemoveBudgetForImage(const CacheKey& key,
                                                    CacheEntry* entry) {}

void SoftwareImageDecodeCache::UnrefImage(const DrawImage& image) {}

void SoftwareImageDecodeCache::UnrefImage(const CacheKey& key) {}

SoftwareImageDecodeCache::TaskProcessingResult
SoftwareImageDecodeCache::DecodeImageInTask(const CacheKey& key,
                                            const PaintImage& paint_image,
                                            DecodeTaskType task_type) {}

SoftwareImageDecodeCache::TaskProcessingResult
SoftwareImageDecodeCache::DecodeImageIfNecessary(const CacheKey& key,
                                                 const PaintImage& paint_image,
                                                 CacheEntry* entry) {}

std::optional<SoftwareImageDecodeCache::CacheKey>
SoftwareImageDecodeCache::FindCachedCandidate(const CacheKey& key) {}

bool SoftwareImageDecodeCache::UseCacheForDrawImage(
    const DrawImage& draw_image) const {}

ImageDecodeCache::ClientId SoftwareImageDecodeCache::GenerateClientId() {}

DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDraw(
    const DrawImage& draw_image) {}

DecodedDrawImage SoftwareImageDecodeCache::GetDecodedImageForDrawInternal(
    const CacheKey& key,
    const PaintImage& paint_image) {}

void SoftwareImageDecodeCache::DrawWithImageFinished(
    const DrawImage& image,
    const DecodedDrawImage& decoded_image) {}

void SoftwareImageDecodeCache::ReduceCacheUsageUntilWithinLimit(size_t limit) {}

void SoftwareImageDecodeCache::ReduceCacheUsage() {}

void SoftwareImageDecodeCache::ClearCache() {}

size_t SoftwareImageDecodeCache::GetMaximumMemoryLimitBytes() const {}

void SoftwareImageDecodeCache::OnImageDecodeTaskCompleted(
    const CacheKey& key,
    DecodeTaskType task_type) {}

bool SoftwareImageDecodeCache::OnMemoryDump(
    const base::trace_event::MemoryDumpArgs& args,
    base::trace_event::ProcessMemoryDump* pmd) {}

SoftwareImageDecodeCache::CacheEntry* SoftwareImageDecodeCache::AddCacheEntry(
    const CacheKey& key) {}

size_t SoftwareImageDecodeCache::GetNumCacheEntriesForTesting() {}
size_t SoftwareImageDecodeCache::GetMaxNumCacheEntriesForTesting() {}

SkColorType SoftwareImageDecodeCache::GetColorTypeForPaintImage(
    const TargetColorParams& target_color_params,
    const PaintImage& paint_image) {}

// MemoryBudget ----------------------------------------------------------------
SoftwareImageDecodeCache::MemoryBudget::MemoryBudget(size_t limit_bytes)
    :{}

size_t SoftwareImageDecodeCache::MemoryBudget::AvailableMemoryBytes() const {}

void SoftwareImageDecodeCache::MemoryBudget::AddUsage(size_t usage) {}

void SoftwareImageDecodeCache::MemoryBudget::SubtractUsage(size_t usage) {}

void SoftwareImageDecodeCache::MemoryBudget::ResetUsage() {}

size_t SoftwareImageDecodeCache::MemoryBudget::GetCurrentUsageSafe() const {}

}  // namespace cc