#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/webcodecs/image_decoder_external.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/thread_pool.h"
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybufferallowshared_arraybufferviewallowshared_readablestream.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_image_decode_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_image_decode_result.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_image_decoder_init.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/fetch/readable_stream_bytes_consumer.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h"
#include "third_party/blink/renderer/modules/webcodecs/image_track.h"
#include "third_party/blink/renderer/modules/webcodecs/image_track_list.h"
#include "third_party/blink/renderer/modules/webcodecs/video_frame.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.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/graphics/bitmap_image_metrics.h"
#include "third_party/blink/renderer/platform/heap/cross_thread_handle.h"
#include "third_party/blink/renderer/platform/heap/cross_thread_persistent.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_skia.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_std.h"
namespace blink {
namespace {
bool IsTypeSupportedInternal(String type) { … }
ImageDecoder::AnimationOption AnimationOptionFromIsAnimated(bool is_animated) { … }
DOMException* CreateUnsupportedImageTypeException(String type) { … }
class ArrayBufferContentsSegmentReader : public SegmentReader { … };
}
ImageDecoderExternal* ImageDecoderExternal::Create(
ScriptState* script_state,
const ImageDecoderInit* init,
ExceptionState& exception_state) { … }
ImageDecoderExternal::DecodeRequest::DecodeRequest(
ScriptPromiseResolver<ImageDecodeResult>* resolver,
uint32_t frame_index,
bool complete_frames_only)
: … { … }
ImageDecoderExternal::DecodeRequest::~DecodeRequest() { … }
void ImageDecoderExternal::DecodeRequest::Trace(Visitor* visitor) const { … }
bool ImageDecoderExternal::DecodeRequest::IsFinal() const { … }
ScriptPromise<IDLBoolean> ImageDecoderExternal::isTypeSupported(
ScriptState* script_state,
String type) { … }
ImageDecoderExternal::ImageDecoderExternal(ScriptState* script_state,
const ImageDecoderInit* init,
ExceptionState& exception_state)
: … { … }
ImageDecoderExternal::~ImageDecoderExternal() { … }
ScriptPromise<ImageDecodeResult> ImageDecoderExternal::decode(
const ImageDecodeOptions* options) { … }
void ImageDecoderExternal::UpdateSelectedTrack() { … }
String ImageDecoderExternal::type() const { … }
bool ImageDecoderExternal::complete() const { … }
ScriptPromise<IDLUndefined> ImageDecoderExternal::completed(
ScriptState* script_state) { … }
ImageTrackList& ImageDecoderExternal::tracks() const { … }
void ImageDecoderExternal::reset(DOMException* exception) { … }
void ImageDecoderExternal::close() { … }
void ImageDecoderExternal::CloseInternal(DOMException* exception) { … }
void ImageDecoderExternal::OnStateChange() { … }
String ImageDecoderExternal::DebugName() const { … }
void ImageDecoderExternal::Trace(Visitor* visitor) const { … }
void ImageDecoderExternal::ContextDestroyed() { … }
bool ImageDecoderExternal::HasPendingActivity() const { … }
void ImageDecoderExternal::MaybeSatisfyPendingDecodes() { … }
void ImageDecoderExternal::OnDecodeReady(
std::unique_ptr<ImageDecoderCore::ImageDecodeResult> result) { … }
void ImageDecoderExternal::DecodeMetadata() { … }
void ImageDecoderExternal::OnMetadata(
ImageDecoderCore::ImageMetadata metadata) { … }
void ImageDecoderExternal::SetFailed() { … }
}