chromium/net/disk_cache/blockfile/block_files.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/disk_cache/blockfile/block_files.h"

#include <atomic>
#include <limits>
#include <memory>
#include <optional>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "net/disk_cache/blockfile/file_lock.h"
#include "net/disk_cache/blockfile/stress_support.h"
#include "net/disk_cache/cache_util.h"

TimeTicks;

namespace {

const char kBlockName[] =;

// This array is used to perform a fast lookup of the nibble bit pattern to the
// type of entry that can be stored there (number of consecutive blocks).
const char s_types[16] =;

// Returns the type of block (number of consecutive blocks that can be stored)
// for a given nibble of the bitmap.
inline int GetMapBlockType(uint32_t value) {}

}  // namespace

namespace disk_cache {

BlockHeader::BlockHeader() :{}

BlockHeader::BlockHeader(BlockFileHeader* header) :{}

BlockHeader::BlockHeader(MappedFile* file)
    :{}

BlockHeader::BlockHeader(const BlockHeader& other) = default;

BlockHeader::~BlockHeader() = default;

bool BlockHeader::CreateMapBlock(int size, int* index) {}

void BlockHeader::DeleteMapBlock(int index, int size) {}

// Note that this is a simplified version of DeleteMapBlock().
bool BlockHeader::UsedMapBlock(int index, int size) {}

void BlockHeader::FixAllocationCounters() {}

bool BlockHeader::NeedToGrowBlockFile(int block_count) const {}

bool BlockHeader::CanAllocate(int block_count) const {}

int BlockHeader::EmptyBlocks() const {}

int BlockHeader::MinimumAllocations() const {}

int BlockHeader::Capacity() const {}

bool BlockHeader::ValidateCounters() const {}

int BlockHeader::FileId() const {}

int BlockHeader::NextFileId() const {}

int BlockHeader::Size() const {}

BlockFileHeader* BlockHeader::Header() {}

// ------------------------------------------------------------------------

BlockFiles::BlockFiles(const base::FilePath& path) :{}

BlockFiles::~BlockFiles() {}

bool BlockFiles::Init(bool create_files) {}

MappedFile* BlockFiles::GetFile(Addr address) {}

bool BlockFiles::CreateBlock(FileType block_type, int block_count,
                             Addr* block_address) {}

void BlockFiles::DeleteBlock(Addr address, bool deep) {}

void BlockFiles::CloseFiles() {}

bool BlockFiles::IsValid(Addr address) {}

bool BlockFiles::CreateBlockFile(int index, FileType file_type, bool force) {}

bool BlockFiles::OpenBlockFile(int index) {}

bool BlockFiles::GrowBlockFile(MappedFile* file, BlockFileHeader* header) {}

MappedFile* BlockFiles::FileForNewBlock(FileType block_type, int block_count) {}

MappedFile* BlockFiles::NextFile(MappedFile* file) {}

int16_t BlockFiles::CreateNextBlockFile(FileType block_type) {}

// We walk the list of files for this particular block type, deleting the ones
// that are empty.
bool BlockFiles::RemoveEmptyFile(FileType block_type) {}

// Note that we expect to be called outside of a FileLock... however, we cannot
// DCHECK on header->updating because we may be fixing a crash.
bool BlockFiles::FixBlockFileHeader(MappedFile* file) {}

base::FilePath BlockFiles::Name(int index) {}

}  // namespace disk_cache