#include <cstdlib>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "net/base/cache_type.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/simple/simple_backend_impl.h"
#include "net/disk_cache/simple/simple_index.h"
namespace disk_cache {
namespace {
const char kBlockFileBackendType[] = …;
const char kSimpleBackendType[] = …;
const char kDiskCacheType[] = …;
const char kAppCacheType[] = …;
const char kPrivateDirty[] = …;
const char kReadWrite[] = …;
const char kHeap[] = …;
const char kKb[] = …;
struct CacheSpec { … };
void SetSuccessCodeOnCompletion(base::RunLoop* run_loop,
bool* succeeded,
int net_error) { … }
std::unique_ptr<Backend> CreateAndInitBackend(const CacheSpec& spec) { … }
bool ParseRangeLine(const std::string& line,
std::vector<std::string>* tokens,
bool* is_anonymous_read_write) { … }
bool ParseRangeProperty(const std::string& line,
std::vector<std::string>* tokens,
uint64_t* size,
bool* is_private_dirty) { … }
uint64_t GetMemoryConsumption() { … }
bool CacheMemTest(const std::vector<std::unique_ptr<CacheSpec>>& specs) { … }
void PrintUsage(std::ostream* stream) { … }
bool ParseAndStoreSpec(const std::string& spec_str,
std::vector<std::unique_ptr<CacheSpec>>* specs) { … }
bool Main(int argc, char** argv) { … }
}
}
int main(int argc, char** argv) { … }