#include "content/browser/background_fetch/storage/mark_request_complete_task.h"
#include "base/barrier_closure.h"
#include "base/functional/bind.h"
#include "base/observer_list.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/background_fetch/background_fetch_cross_origin_filter.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/storage/database_helpers.h"
#include "content/browser/background_fetch/storage/get_metadata_task.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/common/background_fetch/background_fetch_types.h"
#include "content/common/fetch/fetch_api_request_proto.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/header_util.h"
#include "storage/browser/blob/blob_impl.h"
#include "third_party/blink/public/common/cache_storage/cache_storage_utils.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/blob/blob.mojom.h"
#include "third_party/blink/public/mojom/blob/serialized_blob.mojom.h"
namespace content {
namespace background_fetch {
namespace {
blink::mojom::SerializedBlobPtr MakeBlob(
scoped_refptr<BackgroundFetchRequestInfo> info) { … }
bool IsOK(const BackgroundFetchRequestInfo& request) { … }
}
MarkRequestCompleteTask::MarkRequestCompleteTask(
DatabaseTaskHost* host,
const BackgroundFetchRegistrationId& registration_id,
scoped_refptr<BackgroundFetchRequestInfo> request_info,
MarkRequestCompleteCallback callback)
: … { … }
MarkRequestCompleteTask::~MarkRequestCompleteTask() = default;
void MarkRequestCompleteTask::Start() { … }
void MarkRequestCompleteTask::StoreResponse(base::OnceClosure done_closure) { … }
void MarkRequestCompleteTask::DidMakeBlob(
base::OnceClosure done_closure,
blink::mojom::SerializedBlobPtr blob) { … }
void MarkRequestCompleteTask::DidGetIsQuotaAvailable(
base::OnceClosure done_closure,
bool is_available) { … }
void MarkRequestCompleteTask::DidOpenCache(
base::OnceClosure done_closure,
int64_t trace_id,
blink::mojom::CacheStorageError error) { … }
void MarkRequestCompleteTask::DidWriteToCache(
base::OnceClosure done_closure,
blink::mojom::CacheStorageVerboseErrorPtr result) { … }
void MarkRequestCompleteTask::CreateAndStoreCompletedRequest(
base::OnceClosure done_closure) { … }
void MarkRequestCompleteTask::DidStoreCompletedRequest(
base::OnceClosure done_closure,
blink::ServiceWorkerStatusCode status) { … }
void MarkRequestCompleteTask::DidDeleteActiveRequest(
base::OnceClosure done_closure,
blink::ServiceWorkerStatusCode status) { … }
void MarkRequestCompleteTask::UpdateMetadata(base::OnceClosure done_closure) { … }
void MarkRequestCompleteTask::DidGetMetadata(
base::OnceClosure done_closure,
blink::mojom::BackgroundFetchError error,
std::unique_ptr<proto::BackgroundFetchMetadata> metadata) { … }
void MarkRequestCompleteTask::DidStoreMetadata(
base::OnceClosure done_closure,
blink::ServiceWorkerStatusCode status) { … }
void MarkRequestCompleteTask::FinishWithError(
blink::mojom::BackgroundFetchError error) { … }
}
}