#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include <utility>
#include "base/command_line.h"
#include "base/containers/queue.h"
#include "base/observer_list.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/services/storage/public/cpp/buckets/bucket_locator.h"
#include "components/services/storage/public/mojom/cache_storage_control.mojom.h"
#include "content/browser/background_fetch/background_fetch_constants.h"
#include "content/browser/background_fetch/background_fetch_data_manager_observer.h"
#include "content/browser/background_fetch/background_fetch_request_info.h"
#include "content/browser/background_fetch/storage/cleanup_task.h"
#include "content/browser/background_fetch/storage/create_metadata_task.h"
#include "content/browser/background_fetch/storage/database_task.h"
#include "content/browser/background_fetch/storage/delete_registration_task.h"
#include "content/browser/background_fetch/storage/get_developer_ids_task.h"
#include "content/browser/background_fetch/storage/get_metadata_task.h"
#include "content/browser/background_fetch/storage/get_registration_task.h"
#include "content/browser/background_fetch/storage/get_request_blob_task.h"
#include "content/browser/background_fetch/storage/mark_registration_for_deletion_task.h"
#include "content/browser/background_fetch/storage/mark_request_complete_task.h"
#include "content/browser/background_fetch/storage/match_requests_task.h"
#include "content/browser/background_fetch/storage/start_next_pending_request_task.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/storage_partition_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/blob/blob.mojom.h"
namespace content {
BackgroundFetchDataManager::BackgroundFetchDataManager(
base::WeakPtr<StoragePartitionImpl> storage_partition,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy)
: … { … }
void BackgroundFetchDataManager::Initialize() { … }
void BackgroundFetchDataManager::AddObserver(
BackgroundFetchDataManagerObserver* observer) { … }
void BackgroundFetchDataManager::RemoveObserver(
BackgroundFetchDataManagerObserver* observer) { … }
void BackgroundFetchDataManager::Cleanup() { … }
mojo::Remote<blink::mojom::CacheStorage>&
BackgroundFetchDataManager::GetOrOpenCacheStorage(
const blink::StorageKey& storage_key,
const std::string& unique_id) { … }
void BackgroundFetchDataManager::OpenCache(
const blink::StorageKey& storage_key,
const std::string& unique_id,
int64_t trace_id,
blink::mojom::CacheStorage::OpenCallback callback) { … }
void BackgroundFetchDataManager::DeleteCache(
const blink::StorageKey& storage_key,
const std::string& unique_id,
int64_t trace_id,
blink::mojom::CacheStorage::DeleteCallback callback) { … }
void BackgroundFetchDataManager::DidDeleteCache(
const std::string& unique_id,
blink::mojom::CacheStorage::DeleteCallback callback,
blink::mojom::CacheStorageError result) { … }
void BackgroundFetchDataManager::HasCache(
const blink::StorageKey& storage_key,
const std::string& unique_id,
int64_t trace_id,
blink::mojom::CacheStorage::HasCallback callback) { … }
BackgroundFetchDataManager::~BackgroundFetchDataManager() { … }
void BackgroundFetchDataManager::GetInitializationData(
GetInitializationDataCallback callback) { … }
void BackgroundFetchDataManager::CreateRegistration(
const BackgroundFetchRegistrationId& registration_id,
std::vector<blink::mojom::FetchAPIRequestPtr> requests,
blink::mojom::BackgroundFetchOptionsPtr options,
const SkBitmap& icon,
bool start_paused,
const net::IsolationInfo& isolation_info,
CreateRegistrationCallback callback) { … }
void BackgroundFetchDataManager::GetRegistration(
int64_t service_worker_registration_id,
const blink::StorageKey& storage_key,
const std::string& developer_id,
GetRegistrationCallback callback) { … }
void BackgroundFetchDataManager::PopNextRequest(
const BackgroundFetchRegistrationId& registration_id,
NextRequestCallback callback) { … }
void BackgroundFetchDataManager::GetRequestBlob(
const BackgroundFetchRegistrationId& registration_id,
const scoped_refptr<BackgroundFetchRequestInfo>& request_info,
GetRequestBlobCallback callback) { … }
void BackgroundFetchDataManager::MarkRequestAsComplete(
const BackgroundFetchRegistrationId& registration_id,
scoped_refptr<BackgroundFetchRequestInfo> request_info,
MarkRequestCompleteCallback callback) { … }
void BackgroundFetchDataManager::MatchRequests(
const BackgroundFetchRegistrationId& registration_id,
std::unique_ptr<BackgroundFetchRequestMatchParams> match_params,
SettledFetchesCallback callback) { … }
void BackgroundFetchDataManager::MarkRegistrationForDeletion(
const BackgroundFetchRegistrationId& registration_id,
bool check_for_failure,
MarkRegistrationForDeletionCallback callback) { … }
void BackgroundFetchDataManager::DeleteRegistration(
const BackgroundFetchRegistrationId& registration_id,
HandleBackgroundFetchErrorCallback callback) { … }
void BackgroundFetchDataManager::GetDeveloperIdsForServiceWorker(
int64_t service_worker_registration_id,
const blink::StorageKey& storage_key,
blink::mojom::BackgroundFetchService::GetDeveloperIdsCallback callback) { … }
void BackgroundFetchDataManager::Shutdown() { … }
void BackgroundFetchDataManager::AddDatabaseTask(
std::unique_ptr<background_fetch::DatabaseTask> task) { … }
void BackgroundFetchDataManager::OnTaskFinished(
background_fetch::DatabaseTask* task) { … }
BackgroundFetchDataManager* BackgroundFetchDataManager::data_manager() { … }
base::WeakPtr<background_fetch::DatabaseTaskHost>
BackgroundFetchDataManager::GetWeakPtr() { … }
}