chromium/net/disk_cache/memory/mem_entry_impl.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/memory/mem_entry_impl.h"

#include <algorithm>
#include <memory>
#include <utility>

#include "base/check_op.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_math.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "net/base/interval.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/memory/mem_backend_impl.h"
#include "net/disk_cache/net_log_parameters.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source_type.h"

Time;

namespace disk_cache {

namespace {

const int kSparseData =;

// Maximum size of a child of sparse entry is 2 to the power of this number.
const int kMaxChildEntryBits =;

// Sparse entry children have maximum size of 4KB.
const int kMaxChildEntrySize =;

// Convert global offset to child index.
int64_t ToChildIndex(int64_t offset) {}

// Convert global offset to offset in child entry.
int ToChildOffset(int64_t offset) {}

// Returns a name for a child entry given the base_name of the parent and the
// child_id.  This name is only used for logging purposes.
// If the entry is called entry_name, child entries will be named something
// like Range_entry_name:YYY where YYY is the number of the particular child.
std::string GenerateChildName(const std::string& base_name, int64_t child_id) {}

// Returns NetLog parameters for the creation of a MemEntryImpl. A separate
// function is needed because child entries don't store their key().
base::Value::Dict NetLogEntryCreationParams(const MemEntryImpl* entry) {}

}  // namespace

MemEntryImpl::MemEntryImpl(base::WeakPtr<MemBackendImpl> backend,
                           const std::string& key,
                           net::NetLog* net_log)
    :{}

MemEntryImpl::MemEntryImpl(base::WeakPtr<MemBackendImpl> backend,
                           int64_t child_id,
                           MemEntryImpl* parent,
                           net::NetLog* net_log)
    :{}

void MemEntryImpl::Open() {}

bool MemEntryImpl::InUse() const {}

int MemEntryImpl::GetStorageSize() const {}

void MemEntryImpl::UpdateStateOnUse(EntryModified modified_enum) {}

void MemEntryImpl::Doom() {}

void MemEntryImpl::Close() {}

std::string MemEntryImpl::GetKey() const {}

Time MemEntryImpl::GetLastUsed() const {}

Time MemEntryImpl::GetLastModified() const {}

int32_t MemEntryImpl::GetDataSize(int index) const {}

int MemEntryImpl::ReadData(int index,
                           int offset,
                           IOBuffer* buf,
                           int buf_len,
                           CompletionOnceCallback callback) {}

int MemEntryImpl::WriteData(int index,
                            int offset,
                            IOBuffer* buf,
                            int buf_len,
                            CompletionOnceCallback callback,
                            bool truncate) {}

int MemEntryImpl::ReadSparseData(int64_t offset,
                                 IOBuffer* buf,
                                 int buf_len,
                                 CompletionOnceCallback callback) {}

int MemEntryImpl::WriteSparseData(int64_t offset,
                                  IOBuffer* buf,
                                  int buf_len,
                                  CompletionOnceCallback callback) {}

RangeResult MemEntryImpl::GetAvailableRange(int64_t offset,
                                            int len,
                                            RangeResultCallback callback) {}

bool MemEntryImpl::CouldBeSparse() const {}

net::Error MemEntryImpl::ReadyForSparseIO(CompletionOnceCallback callback) {}

void MemEntryImpl::SetLastUsedTimeForTest(base::Time time) {}

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

MemEntryImpl::MemEntryImpl(base::WeakPtr<MemBackendImpl> backend,
                           const ::std::string& key,
                           int64_t child_id,
                           MemEntryImpl* parent,
                           net::NetLog* net_log)
    :{}

MemEntryImpl::~MemEntryImpl() {}

int MemEntryImpl::InternalReadData(int index, int offset, IOBuffer* buf,
                                   int buf_len) {}

int MemEntryImpl::InternalWriteData(int index, int offset, IOBuffer* buf,
                                    int buf_len, bool truncate) {}

int MemEntryImpl::InternalReadSparseData(int64_t offset,
                                         IOBuffer* buf,
                                         int buf_len) {}

int MemEntryImpl::InternalWriteSparseData(int64_t offset,
                                          IOBuffer* buf,
                                          int buf_len) {}

RangeResult MemEntryImpl::InternalGetAvailableRange(int64_t offset, int len) {}

bool MemEntryImpl::InitSparseInfo() {}

MemEntryImpl* MemEntryImpl::GetChild(int64_t offset, bool create) {}

net::Interval<int64_t> MemEntryImpl::ChildInterval(
    MemEntryImpl::EntryMap::const_iterator i) {}

void MemEntryImpl::Compact() {}

}  // namespace disk_cache