#include "content/browser/background_fetch/storage/database_task.h"
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/background_fetch_data_manager_observer.h"
#include "content/browser/background_fetch/storage/database_helpers.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/service_worker_context.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
namespace content {
namespace background_fetch {
namespace {
void DidGetUsageAndQuota(DatabaseTask::IsQuotaAvailableCallback callback,
int64_t size,
blink::mojom::QuotaStatusCode status,
int64_t usage,
int64_t quota) { … }
}
DatabaseTaskHost::DatabaseTaskHost() = default;
DatabaseTaskHost::~DatabaseTaskHost() = default;
DatabaseTask::DatabaseTask(DatabaseTaskHost* host) : … { … }
DatabaseTask::~DatabaseTask() = default;
base::WeakPtr<DatabaseTaskHost> DatabaseTask::GetWeakPtr() { … }
void DatabaseTask::Finished() { … }
void DatabaseTask::OnTaskFinished(DatabaseTask* finished_subtask) { … }
void DatabaseTask::AddDatabaseTask(std::unique_ptr<DatabaseTask> task) { … }
void DatabaseTask::AddSubTask(std::unique_ptr<DatabaseTask> task) { … }
void DatabaseTask::AbandonFetches(int64_t service_worker_registration_id) { … }
void DatabaseTask::IsQuotaAvailable(const blink::StorageKey& storage_key,
int64_t size,
IsQuotaAvailableCallback callback) { … }
void DatabaseTask::GetStorageVersion(int64_t service_worker_registration_id,
const std::string& unique_id,
StorageVersionCallback callback) { … }
void DatabaseTask::DidGetStorageVersion(StorageVersionCallback callback,
const std::vector<std::string>& data,
blink::ServiceWorkerStatusCode status) { … }
void DatabaseTask::SetStorageError(BackgroundFetchStorageError error) { … }
void DatabaseTask::SetStorageErrorAndFinish(BackgroundFetchStorageError error) { … }
bool DatabaseTask::HasStorageError() { … }
ServiceWorkerContextWrapper* DatabaseTask::service_worker_context() { … }
std::set<std::string>& DatabaseTask::ref_counted_unique_ids() { … }
ChromeBlobStorageContext* DatabaseTask::blob_storage_context() { … }
BackgroundFetchDataManager* DatabaseTask::data_manager() { … }
const scoped_refptr<storage::QuotaManagerProxy>&
DatabaseTask::quota_manager_proxy() { … }
void DatabaseTask::OpenCache(
const BackgroundFetchRegistrationId& registration_id,
int64_t trace_id,
base::OnceCallback<void(blink::mojom::CacheStorageError)> callback) { … }
void DatabaseTask::DidOpenCache(
base::OnceCallback<void(blink::mojom::CacheStorageError)> callback,
blink::mojom::OpenResultPtr result) { … }
void DatabaseTask::DeleteCache(
const blink::StorageKey& storage_key,
const std::string& unique_id,
int64_t trace_id,
blink::mojom::CacheStorage::DeleteCallback callback) { … }
}
}