#include "content/browser/tracing/trace_report/trace_report_database.h"
#include <optional>
#include <string>
#include <vector>
#include "base/files/file_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "base/token.h"
#include "sql/database.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
namespace content {
namespace {
const base::FilePath::CharType kLocalTracesDatabasePath[] = …);
const char kLocalTracesTableName[] = …;
constexpr int kCurrentVersionNumber = …;
ClientTraceReport GetReportFromStatement(sql::Statement& statement) { … }
constexpr char kLocalTracesTableSql[] = …;
}
BaseTraceReport::BaseTraceReport() = default;
BaseTraceReport::BaseTraceReport(const BaseTraceReport& other) = default;
BaseTraceReport::~BaseTraceReport() = default;
NewTraceReport::NewTraceReport() = default;
NewTraceReport::~NewTraceReport() = default;
ClientTraceReport::ClientTraceReport() = default;
ClientTraceReport::~ClientTraceReport() = default;
TraceReportDatabase::TraceReportDatabase()
: … { … }
bool TraceReportDatabase::OpenDatabase(const base::FilePath& path) { … }
bool TraceReportDatabase::OpenDatabaseInMemoryForTesting() { … }
bool TraceReportDatabase::OpenDatabaseIfExists(const base::FilePath& path) { … }
bool TraceReportDatabase::AddTrace(const NewTraceReport& new_report) { … }
bool TraceReportDatabase::UserRequestedUpload(const base::Token& uuid) { … }
bool TraceReportDatabase::UploadComplete(const base::Token& uuid,
base::Time time) { … }
bool TraceReportDatabase::UploadSkipped(const base::Token& uuid,
SkipUploadReason skip_reason) { … }
std::optional<std::string> TraceReportDatabase::GetTraceContent(
const base::Token& uuid) { … }
std::optional<std::string> TraceReportDatabase::GetSystemProfile(
const base::Token& uuid) { … }
bool TraceReportDatabase::DeleteTrace(const base::Token& uuid) { … }
bool TraceReportDatabase::DeleteAllTraces() { … }
bool TraceReportDatabase::DeleteTracesInDateRange(const base::Time start,
const base::Time end) { … }
bool TraceReportDatabase::DeleteTraceReportsOlderThan(base::TimeDelta age) { … }
bool TraceReportDatabase::DeleteOldTraceContent(size_t max_traces) { … }
bool TraceReportDatabase::AllPendingUploadSkipped(
SkipUploadReason skip_reason) { … }
bool TraceReportDatabase::EnsureTableCreated() { … }
std::vector<ClientTraceReport> TraceReportDatabase::GetAllReports() { … }
std::optional<ClientTraceReport>
TraceReportDatabase::GetNextReportPendingUpload() { … }
std::optional<size_t> TraceReportDatabase::UploadCountSince(
std::string scenario_name,
base::Time since) { … }
base::flat_map<std::string, size_t> TraceReportDatabase::GetScenarioCountsSince(
base::Time since) { … }
}