#include "third_party/blink/renderer/core/loader/web_associated_url_loader_impl.h"
#include <limits>
#include <memory>
#include <optional>
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "services/network/public/cpp/request_destination.h"
#include "services/network/public/cpp/request_mode.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/resource_request_blocked_reason.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_http_header_visitor.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_associated_url_loader_client.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/loader/threadable_loader.h"
#include "third_party/blink/renderer/core/loader/threadable_loader_client.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_request.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_response.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/loader/cors/cors.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_utils.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/network/http_parsers.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/weborigin/referrer.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { … };
void HTTPRequestHeaderValidator::VisitHeader(const WebString& name,
const WebString& value) { … }
}
class WebAssociatedURLLoaderImpl::ClientAdapter final
: public GarbageCollected<ClientAdapter>,
public ThreadableLoaderClient { … };
WebAssociatedURLLoaderImpl::ClientAdapter::ClientAdapter(
WebAssociatedURLLoaderImpl* loader,
WebAssociatedURLLoaderClient* client,
const WebAssociatedURLLoaderOptions& options,
network::mojom::RequestMode request_mode,
network::mojom::CredentialsMode credentials_mode,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
bool WebAssociatedURLLoaderImpl::ClientAdapter::WillFollowRedirect(
uint64_t identifier,
const KURL& new_url,
const ResourceResponse& redirect_response) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidSendData(
uint64_t bytes_sent,
uint64_t total_bytes_to_be_sent) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidReceiveResponse(
uint64_t,
const ResourceResponse& response) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidDownloadData(
uint64_t data_length) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidReceiveData(
base::span<const char> data) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidFinishLoading(
uint64_t identifier) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidFail(
uint64_t,
const ResourceError& error) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::DidFailRedirectCheck(
uint64_t identifier) { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::EnableErrorNotifications() { … }
void WebAssociatedURLLoaderImpl::ClientAdapter::NotifyError(TimerBase* timer) { … }
class WebAssociatedURLLoaderImpl::Observer final
: public GarbageCollected<Observer>,
public ExecutionContextLifecycleObserver { … };
WebAssociatedURLLoaderImpl::WebAssociatedURLLoaderImpl(
ExecutionContext* context,
const WebAssociatedURLLoaderOptions& options)
: … { … }
WebAssociatedURLLoaderImpl::~WebAssociatedURLLoaderImpl() { … }
void WebAssociatedURLLoaderImpl::LoadAsynchronously(
const WebURLRequest& request,
WebAssociatedURLLoaderClient* client) { … }
void WebAssociatedURLLoaderImpl::Cancel() { … }
void WebAssociatedURLLoaderImpl::ClientAdapterDone() { … }
void WebAssociatedURLLoaderImpl::CancelLoader() { … }
void WebAssociatedURLLoaderImpl::SetDefersLoading(bool defers_loading) { … }
void WebAssociatedURLLoaderImpl::SetLoadingTaskRunner(
base::SingleThreadTaskRunner*) { … }
void WebAssociatedURLLoaderImpl::ContextDestroyed() { … }
void WebAssociatedURLLoaderImpl::DisposeObserver() { … }
}