#include "components/offline_pages/core/model/startup_maintenance_task.h"
#include <map>
#include <set>
#include <string>
#include <vector>
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
#include "components/offline_pages/core/archive_manager.h"
#include "components/offline_pages/core/model/delete_page_task.h"
#include "components/offline_pages/core/offline_page_client_policy.h"
#include "components/offline_pages/core/offline_page_metadata_store.h"
#include "components/offline_pages/core/offline_store_utils.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace offline_pages {
namespace {
#define OFFLINE_PAGES_TABLE_NAME …
struct PageInfo { … };
std::vector<PageInfo> GetPageInfosByNamespaces(
const std::vector<std::string>& temp_namespaces,
sql::Database* db) { … }
std::set<base::FilePath> GetAllArchives(const base::FilePath& archives_dir) { … }
bool DeleteFiles(const std::vector<base::FilePath>& file_paths) { … }
SyncOperationResult ClearLegacyPagesInPrivateDirSync(
sql::Database* db,
const base::FilePath& private_dir) { … }
SyncOperationResult CheckTemporaryPageConsistencySync(
sql::Database* db,
const base::FilePath& archives_dir) { … }
void ReportStorageUsageSync(sql::Database* db) { … }
bool StartupMaintenanceSync(
const base::FilePath& temporary_archives_dir,
const base::FilePath& private_archives_dir,
sql::Database* db) { … }
}
StartupMaintenanceTask::StartupMaintenanceTask(OfflinePageMetadataStore* store,
ArchiveManager* archive_manager)
: … { … }
StartupMaintenanceTask::~StartupMaintenanceTask() = default;
void StartupMaintenanceTask::Run() { … }
void StartupMaintenanceTask::OnStartupMaintenanceDone(bool result) { … }
}