#include "components/offline_pages/core/model/persistent_page_consistency_check_task.h"
#include <string>
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "components/offline_pages/core/archive_manager.h"
#include "components/offline_pages/core/model/delete_page_task.h"
#include "components/offline_pages/core/model/get_pages_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/page_criteria.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace base {
class Time;
}
namespace offline_pages {
namespace {
const base::TimeDelta kExpireThreshold = …;
std::vector<OfflinePageItem> GetPersistentPages(
sql::Database* db) { … }
bool SetItemsFileMissingTimeSync(const std::vector<int64_t>& item_ids,
base::Time missing_time,
sql::Database* db) { … }
bool MarkPagesAsMissing(const std::vector<int64_t>& ids_of_missing_pages,
base::Time missing_time,
sql::Database* db) { … }
bool MarkPagesAsReappeared(const std::vector<int64_t>& ids_of_reappeared_pages,
sql::Database* db) { … }
PersistentPageConsistencyCheckTask::CheckResult
PersistentPageConsistencyCheckSync(
OfflinePageMetadataStore* store,
const base::FilePath& private_dir,
const base::FilePath& public_dir,
base::Time check_time,
sql::Database* db) { … }
}
PersistentPageConsistencyCheckTask::CheckResult::CheckResult() = default;
PersistentPageConsistencyCheckTask::CheckResult::CheckResult(
SyncOperationResult result,
const std::vector<PublishedArchiveId>& ids_of_deleted_pages)
: … { … }
PersistentPageConsistencyCheckTask::CheckResult::CheckResult(
const CheckResult& other) = default;
PersistentPageConsistencyCheckTask::CheckResult&
PersistentPageConsistencyCheckTask::CheckResult::operator=(
const CheckResult& other) = default;
PersistentPageConsistencyCheckTask::CheckResult::~CheckResult() { … }
PersistentPageConsistencyCheckTask::PersistentPageConsistencyCheckTask(
OfflinePageMetadataStore* store,
ArchiveManager* archive_manager,
base::Time check_time,
PersistentPageConsistencyCheckCallback callback)
: … { … }
PersistentPageConsistencyCheckTask::~PersistentPageConsistencyCheckTask() =
default;
void PersistentPageConsistencyCheckTask::Run() { … }
void PersistentPageConsistencyCheckTask::OnPersistentPageConsistencyCheckDone(
CheckResult check_result) { … }
}