chromium/net/tools/dump_cache/dump_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

// Performs basic inspection of the disk cache files with minimal disruption
// to the actual files (they still may change if an error is detected on the
// files).

#include "net/tools/dump_cache/dump_files.h"

#include <stdio.h>

#include <memory>
#include <set>
#include <string>

#include "base/command_line.h"
#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/i18n/time_formatting.h"
#include "base/message_loop/message_pump_type.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/time/time.h"
#include "net/disk_cache/blockfile/block_files.h"
#include "net/disk_cache/blockfile/disk_format.h"
#include "net/disk_cache/blockfile/mapped_file.h"
#include "net/disk_cache/blockfile/stats.h"
#include "net/disk_cache/blockfile/storage_block-inl.h"
#include "net/disk_cache/blockfile/storage_block.h"
#include "net/url_request/view_cache_helper.h"

namespace {

const base::FilePath::CharType kIndexName[] =);

// Reads the |header_size| bytes from the beginning of file |name|.
bool ReadHeader(const base::FilePath& name, char* header, int header_size) {}

int GetMajorVersionFromIndexFile(const base::FilePath& name) {}

int GetMajorVersionFromBlockFile(const base::FilePath& name) {}

// Dumps the contents of the Stats record.
void DumpStats(const base::FilePath& path, disk_cache::CacheAddr addr) {}

// Dumps the contents of the Index-file header.
void DumpIndexHeader(const base::FilePath& name,
                     disk_cache::CacheAddr* stats_addr) {}

// Dumps the contents of a block-file header.
void DumpBlockHeader(const base::FilePath& name) {}

// Simple class that interacts with the set of cache files.
class CacheDumper {};

bool CacheDumper::Init() {}

bool CacheDumper::GetEntry(disk_cache::EntryStore* entry,
                           disk_cache::CacheAddr* addr) {}

bool CacheDumper::LoadEntry(disk_cache::CacheAddr addr,
                            disk_cache::EntryStore* entry) {}

bool CacheDumper::LoadRankings(disk_cache::CacheAddr addr,
                               disk_cache::RankingsNode* rankings) {}

bool CacheDumper::HexDump(disk_cache::CacheAddr addr, std::string* out) {}

std::string ToLocalTime(int64_t time_us) {}

void DumpEntry(disk_cache::CacheAddr addr,
               const disk_cache::EntryStore& entry,
               bool verbose) {}

void DumpRankings(disk_cache::CacheAddr addr,
                  const disk_cache::RankingsNode& rankings,
                  bool verbose) {}

void PrintCSVHeader() {}

void DumpCSV(disk_cache::CacheAddr addr,
             const disk_cache::EntryStore& entry,
             const disk_cache::RankingsNode& rankings) {}

bool CanDump(disk_cache::CacheAddr addr) {}

}  // namespace.

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

bool CheckFileVersion(const base::FilePath& input_path) {}

// Dumps the headers of all files.
int DumpHeaders(const base::FilePath& input_path) {}

// Dumps all entries from the cache.
int DumpContents(const base::FilePath& input_path) {}

int DumpLists(const base::FilePath& input_path) {}

int DumpEntryAt(const base::FilePath& input_path, const std::string& at) {}

int DumpAllocation(const base::FilePath& file) {}