#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <string>
#include <string_view>
#include <vector>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/debug/debugger.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/blockfile/backend_impl.h"
#include "net/disk_cache/blockfile/stress_support.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_util.h"
#if BUILDFLAG(IS_WIN)
#include "base/logging_win.h"
#endif
Time;
const int kError = …;
const int kExpectedCrash = …;
int RunSlave(int iteration) { … }
int MasterCode() { … }
std::string GenerateStressKey() { … }
#ifdef NDEBUG
const int kNumKeys = 4000;
#else
const int kNumKeys = …;
#endif
const int kNumEntries = …;
const int kBufferSize = …;
const int kReadSize = …;
enum Operation { … };
class EntryWrapper { … };
struct Data { … };
Data* g_data = …;
void EntryWrapper::DoOpen(int key) { … }
void EntryWrapper::OnOpenDone(int key, disk_cache::EntryResult result) { … }
void EntryWrapper::DoRead() { … }
void EntryWrapper::OnReadDone(int result) { … }
void EntryWrapper::DoWrite() { … }
void EntryWrapper::OnWriteDone(int size, int result) { … }
void EntryWrapper::DoDelete(const std::string& key) { … }
void EntryWrapper::OnDeleteDone(int result) { … }
void LoopTask();
void EntryWrapper::DoIdle() { … }
void LoopTask() { … }
void StressTheCache(int iteration) { … }
bool g_crashing = …;
void RunSoon(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void CrashCallback() { … }
void RunSoon(scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
bool StartCrashThread() { … }
void CrashHandler(const char* file,
int line,
const std::string_view str,
const std::string_view stack_trace) { … }
#if BUILDFLAG(IS_WIN)
const GUID kStressCacheTraceProviderName = {
0xb9a153d4, 0x31c3, 0x48e4,
{ 0x9a, 0xbf, 0xd5, 0x43, 0x83, 0xf1, 0x4a, 0xd } };
#endif
int main(int argc, const char* argv[]) { … }