#include "third_party/blink/renderer/modules/cache_storage/cache_storage.h"
#include <utility>
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/public/common/cache_storage/cache_storage_utils.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/web_content_settings_client.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_multi_cache_query_options.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.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/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/cache_storage/cache_storage_blob_client_list.h"
#include "third_party/blink/renderer/modules/cache_storage/cache_storage_error.h"
#include "third_party/blink/renderer/modules/cache_storage/cache_storage_trace_utils.h"
#include "third_party/blink/renderer/modules/cache_storage/cache_utils.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
namespace mojo {
CacheQueryOptions;
CacheQueryOptionsPtr;
MultiCacheQueryOptions;
MultiCacheQueryOptionsPtr;
template <>
struct TypeConverter<MultiCacheQueryOptionsPtr,
const blink::MultiCacheQueryOptions*> { … };
}
namespace blink {
namespace {
const char kSecurityErrorMessage[] = …;
}
void CacheStorage::IsCacheStorageAllowed(ExecutionContext* context,
ScriptPromiseResolverBase* resolver,
base::OnceCallback<void()> callback) { … }
void CacheStorage::OnCacheStorageAllowed(base::OnceCallback<void()> callback,
ScriptPromiseResolverBase* resolver,
bool allow_access) { … }
ScriptPromise<Cache> CacheStorage::open(ScriptState* script_state,
const String& cache_name,
ExceptionState& exception_state) { … }
void CacheStorage::OpenImpl(const String& cache_name,
int64_t trace_id,
ScriptPromiseResolver<Cache>* resolver) { … }
ScriptPromise<IDLBoolean> CacheStorage::has(ScriptState* script_state,
const String& cache_name,
ExceptionState& exception_state) { … }
void CacheStorage::HasImpl(const String& cache_name,
int64_t trace_id,
ScriptPromiseResolver<IDLBoolean>* resolver) { … }
ScriptPromise<IDLBoolean> CacheStorage::Delete(
ScriptState* script_state,
const String& cache_name,
ExceptionState& exception_state) { … }
void CacheStorage::DeleteImpl(const String& cache_name,
int64_t trace_id,
ScriptPromiseResolver<IDLBoolean>* resolver) { … }
ScriptPromise<IDLSequence<IDLString>> CacheStorage::keys(
ScriptState* script_state,
ExceptionState& exception_state) { … }
void CacheStorage::KeysImpl(
int64_t trace_id,
ScriptPromiseResolver<IDLSequence<IDLString>>* resolver) { … }
ScriptPromise<Response> CacheStorage::match(
ScriptState* script_state,
const V8RequestInfo* request,
const MultiCacheQueryOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<Response> CacheStorage::MatchImpl(
ScriptState* script_state,
const Request* request,
const MultiCacheQueryOptions* options,
ExceptionState& exception_state) { … }
void CacheStorage::MatchImplHelper(
const MultiCacheQueryOptions* options,
mojom::blink::FetchAPIRequestPtr mojo_request,
mojom::blink::MultiCacheQueryOptionsPtr mojo_options,
bool in_related_fetch_event,
bool in_range_fetch_event,
int64_t trace_id,
ScriptPromiseResolver<Response>* resolver) { … }
CacheStorage::CacheStorage(ExecutionContext* context,
GlobalFetch::ScopedFetcher* fetcher)
: … { … }
CacheStorage::CacheStorage(
ExecutionContext* context,
GlobalFetch::ScopedFetcher* fetcher,
mojo::PendingRemote<mojom::blink::CacheStorage> pending_remote)
: … { … }
CacheStorage::~CacheStorage() = default;
bool CacheStorage::HasPendingActivity() const { … }
void CacheStorage::Trace(Visitor* visitor) const { … }
void CacheStorage::MaybeInit() { … }
mojom::blink::CacheStorage* CacheStorage::GetRemoteForDevtools(
base::OnceClosure disconnect_handler) { … }
}