#include "third_party/blink/renderer/core/loader/threadable_loader.h"
#include <memory>
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "services/network/public/cpp/cors/cors_error_status.h"
#include "services/network/public/mojom/cors.mojom-blink.h"
#include "services/network/public/mojom/fetch_api.mojom-blink.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/frame/frame_console.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/loader/threadable_loader_client.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/self_keep_alive.h"
#include "third_party/blink/renderer/platform/loader/cors/cors.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h"
#include "third_party/blink/renderer/platform/loader/fetch/loader_freeze_mode.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
namespace blink {
namespace {
class DetachedClient final : public GarbageCollected<DetachedClient>,
public ThreadableLoaderClient { … };
}
ThreadableLoader::ThreadableLoader(
ExecutionContext& execution_context,
ThreadableLoaderClient* client,
const ResourceLoaderOptions& resource_loader_options,
ResourceFetcher* resource_fetcher)
: … { … }
void ThreadableLoader::Start(ResourceRequest request) { … }
ThreadableLoader::~ThreadableLoader() = default;
void ThreadableLoader::SetTimeout(const base::TimeDelta& timeout) { … }
void ThreadableLoader::Cancel() { … }
void ThreadableLoader::Detach() { … }
void ThreadableLoader::SetDefersLoading(bool value) { … }
void ThreadableLoader::Clear() { … }
bool ThreadableLoader::RedirectReceived(
Resource* resource,
const ResourceRequest& new_request,
const ResourceResponse& redirect_response) { … }
void ThreadableLoader::RedirectBlocked() { … }
void ThreadableLoader::DataSent(Resource* resource,
uint64_t bytes_sent,
uint64_t total_bytes_to_be_sent) { … }
void ThreadableLoader::DataDownloaded(Resource* resource,
uint64_t data_length) { … }
void ThreadableLoader::DidDownloadToBlob(Resource* resource,
scoped_refptr<BlobDataHandle> blob) { … }
void ThreadableLoader::ResponseReceived(Resource* resource,
const ResourceResponse& response) { … }
void ThreadableLoader::ResponseBodyReceived(Resource* resource,
BytesConsumer& body) { … }
void ThreadableLoader::CachedMetadataReceived(
Resource* resource,
mojo_base::BigBuffer cached_metadata) { … }
void ThreadableLoader::DataReceived(Resource* resource,
base::span<const char> data) { … }
void ThreadableLoader::NotifyFinished(Resource* resource) { … }
void ThreadableLoader::DidTimeout(TimerBase* timer) { … }
void ThreadableLoader::DispatchDidFail(const ResourceError& error) { … }
void ThreadableLoader::Trace(Visitor* visitor) const { … }
scoped_refptr<base::SingleThreadTaskRunner> ThreadableLoader::GetTaskRunner() { … }
}