#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h"
#include <optional>
#include <utility>
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_request_usvstring.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_cache_query_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_image_resource.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/fetch/request.h"
#include "third_party/blink/renderer/core/fetch/response.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_bridge.h"
#include "third_party/blink/renderer/modules/background_fetch/background_fetch_record.h"
#include "third_party/blink/renderer/modules/cache_storage/cache.h"
#include "third_party/blink/renderer/modules/event_target_modules_names.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
namespace blink {
BackgroundFetchRegistration::BackgroundFetchRegistration(
ServiceWorkerRegistration* service_worker_registration,
mojom::blink::BackgroundFetchRegistrationPtr registration)
: … { … }
BackgroundFetchRegistration::~BackgroundFetchRegistration() = default;
void BackgroundFetchRegistration::OnProgress(
uint64_t upload_total,
uint64_t uploaded,
uint64_t download_total,
uint64_t downloaded,
mojom::BackgroundFetchResult result,
mojom::BackgroundFetchFailureReason failure_reason) { … }
void BackgroundFetchRegistration::OnRecordsUnavailable() { … }
void BackgroundFetchRegistration::OnRequestCompleted(
mojom::blink::FetchAPIRequestPtr request,
mojom::blink::FetchAPIResponsePtr response) { … }
String BackgroundFetchRegistration::id() const { … }
uint64_t BackgroundFetchRegistration::uploadTotal() const { … }
uint64_t BackgroundFetchRegistration::uploaded() const { … }
uint64_t BackgroundFetchRegistration::downloadTotal() const { … }
uint64_t BackgroundFetchRegistration::downloaded() const { … }
bool BackgroundFetchRegistration::recordsAvailable() const { … }
const AtomicString& BackgroundFetchRegistration::InterfaceName() const { … }
ExecutionContext* BackgroundFetchRegistration::GetExecutionContext() const { … }
ScriptPromise<IDLBoolean> BackgroundFetchRegistration::abort(
ScriptState* script_state,
ExceptionState& exception_state) { … }
ScriptPromise<BackgroundFetchRecord> BackgroundFetchRegistration::match(
ScriptState* script_state,
const V8RequestInfo* request,
const CacheQueryOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<IDLSequence<BackgroundFetchRecord>>
BackgroundFetchRegistration::matchAll(ScriptState* script_state,
ExceptionState& exception_state) { … }
ScriptPromise<IDLSequence<BackgroundFetchRecord>>
BackgroundFetchRegistration::matchAll(ScriptState* script_state,
const V8RequestInfo* request,
const CacheQueryOptions* options,
ExceptionState& exception_state) { … }
void BackgroundFetchRegistration::MatchImpl(
ScriptState* script_state,
ScriptPromiseResolverBase* resolver,
const V8RequestInfo* request,
mojom::blink::CacheQueryOptionsPtr cache_query_options,
ExceptionState& exception_state,
bool match_all) { … }
void BackgroundFetchRegistration::DidGetMatchingRequests(
ScriptPromiseResolverBase* resolver,
bool return_all,
Vector<mojom::blink::BackgroundFetchSettledFetchPtr> settled_fetches) { … }
void BackgroundFetchRegistration::UpdateRecord(
BackgroundFetchRecord* record,
mojom::blink::FetchAPIResponsePtr& response) { … }
bool BackgroundFetchRegistration::IsAborted() { … }
void BackgroundFetchRegistration::DidAbort(
ScriptPromiseResolver<IDLBoolean>* resolver,
mojom::blink::BackgroundFetchError error) { … }
const String BackgroundFetchRegistration::result() const { … }
const String BackgroundFetchRegistration::failureReason() const { … }
bool BackgroundFetchRegistration::HasPendingActivity() const { … }
void BackgroundFetchRegistration::UpdateUI(
const String& in_title,
const SkBitmap& in_icon,
mojom::blink::BackgroundFetchRegistrationService::UpdateUICallback
callback) { … }
void BackgroundFetchRegistration::Trace(Visitor* visitor) const { … }
}