#include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_persister.h"
#include <sstream>
#include "base/files/file_util.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
namespace safe_browsing {
namespace {
WriteReportTrigger;
constexpr base::TimeDelta kMaxFileAge = …;
constexpr int kInitialWriteIndex = …;
constexpr int kInitialReadIndex = …;
constexpr char kPersistedFileNamePrefix[] = …;
constexpr int kMaxCacheSize = …;
void RecordWriteResult(bool success, WriteReportTrigger trigger) { … }
void RecordReadResult(bool success) { … }
void RecordPersistedFileSize(size_t size) { … }
void RecordNumberOfFilesInCacheOnStartup(int cache_size) { … }
void RecordAgedFileFound(bool found) { … }
}
ExtensionTelemetryPersister::~ExtensionTelemetryPersister() = default;
ExtensionTelemetryPersister::ExtensionTelemetryPersister(
int max_num_files,
base::FilePath profile_path)
: … { … }
void ExtensionTelemetryPersister::PersisterInit() { … }
void ExtensionTelemetryPersister::WriteReport(const std::string write_string,
WriteReportTrigger trigger) { … }
std::string ExtensionTelemetryPersister::ReadReport() { … }
void ExtensionTelemetryPersister::ClearPersistedFiles() { … }
int ExtensionTelemetryPersister::MaxFilesSupported() { … }
bool ExtensionTelemetryPersister::DeleteFile(const base::FilePath path) { … }
}