#include "third_party/blink/renderer/modules/webcodecs/decoder_template.h"
#include <limits>
#include <utility>
#include <vector>
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/trace_event/trace_event.h"
#include "media/base/decoder_status.h"
#include "media/base/media_util.h"
#include "media/media_buildflags.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_data_output_callback.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_config.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_encoded_video_chunk.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_config.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_init.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_data.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_decoder.h"
#include "third_party/blink/renderer/modules/webcodecs/codec_state_helper.h"
#include "third_party/blink/renderer/modules/webcodecs/gpu_factories_retriever.h"
#include "third_party/blink/renderer/modules/webcodecs/video_decoder.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_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/cross_thread_handle.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace {
constexpr const char kCategory[] = …;
base::AtomicSequenceNumber g_sequence_num_for_counters;
}
template <typename Traits>
const CodecTraceNames* DecoderTemplate<Traits>::GetTraceNames() { … }
template <typename Traits>
DecoderTemplate<Traits>::DecoderTemplate(ScriptState* script_state,
const InitType* init,
ExceptionState& exception_state)
: … { … }
template <typename Traits>
DecoderTemplate<Traits>::~DecoderTemplate() { … }
template <typename Traits>
uint32_t DecoderTemplate<Traits>::decodeQueueSize() { … }
template <typename Traits>
bool DecoderTemplate<Traits>::IsClosed() { … }
template <typename Traits>
HardwarePreference DecoderTemplate<Traits>::GetHardwarePreference(
const ConfigType&) { … }
template <typename Traits>
bool DecoderTemplate<Traits>::GetLowDelayPreference(const ConfigType&) { … }
template <typename Traits>
void DecoderTemplate<Traits>::SetHardwarePreference(HardwarePreference) { … }
template <typename Traits>
void DecoderTemplate<Traits>::configure(const ConfigType* config,
ExceptionState& exception_state) { … }
template <typename Traits>
void DecoderTemplate<Traits>::decode(const InputType* chunk,
ExceptionState& exception_state) { … }
template <typename Traits>
ScriptPromise<IDLUndefined> DecoderTemplate<Traits>::flush(
ExceptionState& exception_state) { … }
template <typename Traits>
void DecoderTemplate<Traits>::reset(ExceptionState& exception_state) { … }
template <typename Traits>
void DecoderTemplate<Traits>::close(ExceptionState& exception_state) { … }
template <typename Traits>
void DecoderTemplate<Traits>::ProcessRequests() { … }
template <typename Traits>
bool DecoderTemplate<Traits>::ProcessConfigureRequest(Request* request) { … }
template <typename Traits>
void DecoderTemplate<Traits>::ContinueConfigureWithGpuFactories(
Request* request,
media::GpuVideoAcceleratorFactories* gpu_factories) { … }
template <typename Traits>
bool DecoderTemplate<Traits>::ProcessDecodeRequest(Request* request) { … }
template <typename Traits>
bool DecoderTemplate<Traits>::ProcessFlushRequest(Request* request) { … }
template <typename Traits>
bool DecoderTemplate<Traits>::ProcessResetRequest(Request* request) { … }
template <typename Traits>
void DecoderTemplate<Traits>::Shutdown(DOMException* exception) { … }
template <typename Traits>
void DecoderTemplate<Traits>::ResetAlgorithm() { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnFlushDone(media::DecoderStatus status) { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnInitializeDone(media::DecoderStatus status) { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnDecodeDone(uint32_t id,
media::DecoderStatus status) { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnResetDone() { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnOutput(uint32_t reset_generation,
scoped_refptr<MediaOutputType> output) { … }
template <typename Traits>
void DecoderTemplate<Traits>::TraceQueueSizes() const { … }
template <typename Traits>
void DecoderTemplate<Traits>::DispatchDequeueEvent(Event* event) { … }
template <typename Traits>
void DecoderTemplate<Traits>::ScheduleDequeueEvent() { … }
template <typename Traits>
ExecutionContext* DecoderTemplate<Traits>::GetExecutionContext() const { … }
template <typename Traits>
void DecoderTemplate<Traits>::ContextDestroyed() { … }
template <typename Traits>
void DecoderTemplate<Traits>::Trace(Visitor* visitor) const { … }
template <typename Traits>
void DecoderTemplate<Traits>::OnCodecReclaimed(DOMException* exception) { … }
template <typename Traits>
bool DecoderTemplate<Traits>::HasPendingActivity() const { … }
template <typename Traits>
bool DecoderTemplate<Traits>::MaybeAbortRequest(Request* request) const { … }
template <typename Traits>
void DecoderTemplate<Traits>::Request::Trace(Visitor* visitor) const { … }
template <typename Traits>
const char* DecoderTemplate<Traits>::Request::TraceNameFromType() { … }
template <typename Traits>
void DecoderTemplate<Traits>::Request::StartTracing() { … }
template <typename Traits>
void DecoderTemplate<Traits>::Request::EndTracing(bool shutting_down) { … }
template <typename Traits>
DOMException* DecoderTemplate<Traits>::MakeOperationError(
std::string error_msg,
media::DecoderStatus status) { … }
template <typename Traits>
DOMException* DecoderTemplate<Traits>::MakeEncodingError(
std::string error_msg,
media::DecoderStatus status) { … }
template class DecoderTemplate<AudioDecoderTraits>;
template class DecoderTemplate<VideoDecoderTraits>;
}