chromium/components/offline_pages/core/model/startup_maintenance_task.cc

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

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

// This method is clearing the private dir(the legacy dir).
// - For all files associated with temporary pages:
//   The strategy is if any temporary page
//   is still left behind in the legacy dir, delete them.
// - For all files associated with persistent pages:
//   Leave them as-is, since they might be still in use.
// - For all files without any associated DB entry:
//   Delete the files, since they're 'headless' and has no way to be accessed.
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) {}

}  // namespace

StartupMaintenanceTask::StartupMaintenanceTask(OfflinePageMetadataStore* store,
                                               ArchiveManager* archive_manager)
    :{}

StartupMaintenanceTask::~StartupMaintenanceTask() = default;

void StartupMaintenanceTask::Run() {}

void StartupMaintenanceTask::OnStartupMaintenanceDone(bool result) {}

}  // namespace offline_pages