chromium/content/browser/tracing/trace_report/trace_report_database.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

// create table `local_traces` with following columns:
// `uuid` is the unique ID of the trace.
// `creation_time` The date and time in seconds when the row was created.
// `scenario_name` The trace scenario name.
// `upload_rule_name` The name of the rule that triggered the upload.
// `state` The current upload state of the trace.
// `upload_time` Time at which the trace was uploaded. NULL if not uploaded.
// `skip_reason` Reason why a trace was not uploaded.
// `trace_content` The serialized trace content string
// `system_profile` The serialized system profile string
// `file_size` The size of trace in bytes.
constexpr char kLocalTracesTableSql[] =;

}  // namespace

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) {}

}  // namespace content