#include "third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.h"
#include <optional>
#include <string>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/client_hints/client_hints.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "third_party/blink/public/platform/resource_load_info_notifier_wrapper.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_response.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "url/origin.h"
namespace blink {
class SyncLoadContext::SignalHelper final { … };
void SyncLoadContext::StartAsyncWithWaitableEvent(
std::unique_ptr<network::ResourceRequest> request,
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
uint32_t loader_options,
std::unique_ptr<network::PendingSharedURLLoaderFactory>
pending_url_loader_factory,
WebVector<std::unique_ptr<URLLoaderThrottle>> throttles,
SyncLoadResponse* response,
SyncLoadContext** context_for_redirect,
base::WaitableEvent* redirect_or_response_event,
base::WaitableEvent* abort_event,
base::TimeDelta timeout,
mojo::PendingRemote<mojom::blink::BlobRegistry> download_to_blob_registry,
const Vector<String>& cors_exempt_header_list,
std::unique_ptr<ResourceLoadInfoNotifierWrapper>
resource_load_info_notifier_wrapper) { … }
SyncLoadContext::SyncLoadContext(
network::ResourceRequest* request,
std::unique_ptr<network::PendingSharedURLLoaderFactory> url_loader_factory,
SyncLoadResponse* response,
SyncLoadContext** context_for_redirect,
base::WaitableEvent* redirect_or_response_event,
base::WaitableEvent* abort_event,
base::TimeDelta timeout,
mojo::PendingRemote<mojom::blink::BlobRegistry> download_to_blob_registry,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
SyncLoadContext::~SyncLoadContext() { … }
void SyncLoadContext::OnUploadProgress(uint64_t position, uint64_t size) { … }
void SyncLoadContext::OnReceivedRedirect(
const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head,
FollowRedirectCallback follow_redirect_callback) { … }
void SyncLoadContext::FollowRedirect(std::vector<std::string> removed_headers,
net::HttpRequestHeaders modified_headers) { … }
void SyncLoadContext::CancelRedirect() { … }
void SyncLoadContext::OnReceivedResponse(
network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body,
std::optional<mojo_base::BigBuffer> cached_metadata) { … }
void SyncLoadContext::OnTransferSizeUpdated(int transfer_size_diff) { … }
void SyncLoadContext::OnCompletedRequest(
const network::URLLoaderCompletionStatus& status) { … }
void SyncLoadContext::OnFinishCreatingBlob(
const scoped_refptr<BlobDataHandle>& blob) { … }
void SyncLoadContext::OnBodyReadable(MojoResult,
const mojo::HandleSignalsState&) { … }
void SyncLoadContext::OnAbort(base::WaitableEvent* event) { … }
void SyncLoadContext::OnTimeout() { … }
void SyncLoadContext::CompleteRequest() { … }
bool SyncLoadContext::Completed() const { … }
}