#include "third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.h"
#include <optional>
#include <queue>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom-blink.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/resource_load_info_notifier_wrapper.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_url_request_extra_data.h"
#include "third_party/blink/public/platform/web_url_response.h"
#include "third_party/blink/renderer/core/dom/document.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/core/frame/navigator.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/loader/alternate_signed_exchange_resource_info.h"
#include "third_party/blink/renderer/core/loader/loader_factory_for_frame.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/code_cache_host.h"
#include "third_party/blink/renderer/platform/loader/fetch/loader_freeze_mode.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_client.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_factory.h"
#include "third_party/blink/renderer/platform/loader/link_header.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/kurl_hash.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
class PrefetchedSignedExchangeManager::PrefetchedSignedExchangeLoader
: public URLLoader { … };
PrefetchedSignedExchangeManager* PrefetchedSignedExchangeManager::MaybeCreate(
LocalFrame* frame,
const String& outer_link_header,
const String& inner_link_header,
WebVector<std::unique_ptr<WebNavigationParams::PrefetchedSignedExchange>>
prefetched_signed_exchanges) { … }
PrefetchedSignedExchangeManager::PrefetchedSignedExchangeManager(
LocalFrame* frame,
std::unique_ptr<AlternateSignedExchangeResourceInfo> alternative_resources,
HashMap<KURL,
std::unique_ptr<WebNavigationParams::PrefetchedSignedExchange>>
prefetched_exchanges_map)
: … { … }
PrefetchedSignedExchangeManager::~PrefetchedSignedExchangeManager() { … }
void PrefetchedSignedExchangeManager::Trace(Visitor* visitor) const { … }
void PrefetchedSignedExchangeManager::StartPrefetchedLinkHeaderPreloads() { … }
std::unique_ptr<URLLoader>
PrefetchedSignedExchangeManager::MaybeCreateURLLoader(
const network::ResourceRequest& network_request,
base::OnceCallback<Vector<std::unique_ptr<URLLoaderThrottle>>(void)>
create_throttles_callback) { … }
std::unique_ptr<URLLoader>
PrefetchedSignedExchangeManager::CreateDefaultURLLoader(
const network::ResourceRequest& request,
Vector<std::unique_ptr<URLLoaderThrottle>> throttles) { … }
std::unique_ptr<URLLoader>
PrefetchedSignedExchangeManager::CreatePrefetchedSignedExchangeURLLoader(
const network::ResourceRequest& request,
Vector<std::unique_ptr<URLLoaderThrottle>> throttles,
mojo::PendingRemote<network::mojom::blink::URLLoaderFactory>
loader_factory) { … }
void PrefetchedSignedExchangeManager::TriggerLoad() { … }
}