#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/fetch/fetch_data_loader.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/compiler_specific.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "third_party/blink/public/mojom/blob/blob_registry.mojom-blink.h"
#include "third_party/blink/renderer/core/fetch/multipart_parser.h"
#include "third_party/blink/renderer/core/fileapi/file.h"
#include "third_party/blink/renderer/core/html/forms/form_data.h"
#include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h"
#include "third_party/blink/renderer/platform/file_metadata.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/prefinalizer.h"
#include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
#include "third_party/blink/renderer/platform/network/parsed_content_disposition.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
class FetchDataLoaderAsBlobHandle final : public FetchDataLoader,
public FetchDataLoader::Client { … };
class FetchDataLoaderAsArrayBuffer final : public FetchDataLoader,
public BytesConsumer::Client { … };
class FetchDataLoaderAsFailure final : public FetchDataLoader,
public BytesConsumer::Client { … };
class FetchDataLoaderAsFormData final : public FetchDataLoader,
public BytesConsumer::Client,
public MultipartParser::Client { … };
class FetchDataLoaderAsString final : public FetchDataLoader,
public BytesConsumer::Client { … };
class FetchDataLoaderAsDataPipe final : public FetchDataLoader,
public BytesConsumer::Client { … };
}
FetchDataLoader* FetchDataLoader::CreateLoaderAsBlobHandle(
const String& mime_type,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
FetchDataLoader* FetchDataLoader::CreateLoaderAsArrayBuffer() { … }
FetchDataLoader* FetchDataLoader::CreateLoaderAsFailure() { … }
FetchDataLoader* FetchDataLoader::CreateLoaderAsFormData(
const String& multipartBoundary) { … }
FetchDataLoader* FetchDataLoader::CreateLoaderAsString(
const TextResourceDecoderOptions& options) { … }
FetchDataLoader* FetchDataLoader::CreateLoaderAsDataPipe(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
}