#include "third_party/blink/renderer/core/fileapi/blob.h"
#include <memory>
#include <utility>
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_blob_property_bag.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview_blob_usvstring.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fetch/blob_bytes_consumer.h"
#include "third_party/blink/renderer/core/fetch/body_stream_buffer.h"
#include "third_party/blink/renderer/core/fileapi/file_read_type.h"
#include "third_party/blink/renderer/core/fileapi/file_reader_client.h"
#include "third_party/blink/renderer/core/fileapi/file_reader_loader.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/url/dom_url.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/blob/blob_url.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/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace {
bool IsValidBlobType(const String& type) { … }
}
class NullURLRegistry final : public URLRegistry { … };
class BlobFileReaderClient : public GarbageCollected<BlobFileReaderClient>,
public FileReaderAccumulator { … };
Blob::Blob(scoped_refptr<BlobDataHandle> data_handle)
: … { … }
Blob::~Blob() = default;
Blob* Blob::Create(ExecutionContext* context,
const HeapVector<Member<V8BlobPart>>& blob_parts,
const BlobPropertyBag* options) { … }
Blob* Blob::Create(base::span<const uint8_t> data, const String& content_type) { … }
void Blob::PopulateBlobData(BlobData* blob_data,
const HeapVector<Member<V8BlobPart>>& parts,
bool normalize_line_endings_to_native) { … }
void Blob::ClampSliceOffsets(uint64_t size, int64_t& start, int64_t& end) { … }
Blob* Blob::slice(int64_t start,
int64_t end,
const String& content_type,
ExceptionState& exception_state) const { … }
ReadableStream* Blob::stream(ScriptState* script_state) const { … }
ScriptPromise<IDLUSVString> Blob::text(ScriptState* script_state) { … }
ScriptPromise<DOMArrayBuffer> Blob::arrayBuffer(ScriptState* script_state) { … }
scoped_refptr<BlobDataHandle> Blob::GetBlobDataHandleWithKnownSize() const { … }
void Blob::AppendTo(BlobData& blob_data) const { … }
URLRegistry& Blob::Registry() const { … }
bool Blob::IsMojoBlob() { … }
void Blob::CloneMojoBlob(mojo::PendingReceiver<mojom::blink::Blob> receiver) { … }
mojo::PendingRemote<mojom::blink::Blob> Blob::AsMojoBlob() const { … }
String Blob::NormalizeType(const String& type) { … }
}