#include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/predictors/lcp_critical_path_predictor/lcp_critical_path_predictor_util.h"
#include "chrome/browser/predictors/predictors_features.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace {
const char kMetadataTableName[] = …;
const char kHostRedirectTableName[] = …;
const char kOriginTableName[] = …;
const char kCreateGlobalMetadataStatementTemplate[] = …;
const char kCreateProtoTableStatementTemplate[] = …;
}
namespace predictors {
void ResourcePrefetchPredictorTables::TrimRedirects(
RedirectData* data,
size_t max_consecutive_misses) { … }
void ResourcePrefetchPredictorTables::TrimOrigins(
OriginData* data,
size_t max_consecutive_misses) { … }
void ResourcePrefetchPredictorTables::SortOrigins(
OriginData* data,
const std::string& main_frame_origin) { … }
ResourcePrefetchPredictorTables::ResourcePrefetchPredictorTables(
scoped_refptr<base::SequencedTaskRunner> db_task_runner)
: … { … }
ResourcePrefetchPredictorTables::~ResourcePrefetchPredictorTables() = default;
float ResourcePrefetchPredictorTables::ComputeOriginScore(
const OriginStat& origin) { … }
sqlite_proto::KeyValueTable<RedirectData>*
ResourcePrefetchPredictorTables::host_redirect_table() { … }
sqlite_proto::KeyValueTable<OriginData>*
ResourcePrefetchPredictorTables::origin_table() { … }
bool ResourcePrefetchPredictorTables::DropTablesIfOutdated(sql::Database* db) { … }
int ResourcePrefetchPredictorTables::GetDatabaseVersion(sql::Database* db) { … }
bool ResourcePrefetchPredictorTables::SetDatabaseVersion(sql::Database* db,
int version) { … }
void ResourcePrefetchPredictorTables::CreateOrClearTablesIfNecessary() { … }
void ResourcePrefetchPredictorTables::LogDatabaseStats() { … }
}