#include "third_party/blink/renderer/modules/webcodecs/encoder_base.h"
#include <string>
#include "base/atomic_sequence_num.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/trace_event.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_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_config.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_encode_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_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/probe/core_probes.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_encoder.h"
#include "third_party/blink/renderer/modules/webcodecs/codec_state_helper.h"
#include "third_party/blink/renderer/modules/webcodecs/encoded_video_chunk.h"
#include "third_party/blink/renderer/modules/webcodecs/video_encoder.h"
#include "third_party/blink/renderer/platform/bindings/enumeration_base.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/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink {
namespace {
constexpr const char kCategory[] = …;
base::AtomicSequenceNumber g_sequence_num_for_counters;
}
template <typename Traits>
const CodecTraceNames* EncoderBase<Traits>::GetTraceNames() { … }
template <typename Traits>
EncoderBase<Traits>::EncoderBase(ScriptState* script_state,
const InitType* init,
ExceptionState& exception_state)
: … { … }
template <typename Traits>
EncoderBase<Traits>::~EncoderBase() { … }
template <typename Traits>
void EncoderBase<Traits>::configure(const ConfigType* config,
ExceptionState& exception_state) { … }
template <typename Traits>
void EncoderBase<Traits>::encode(InputType* input,
const EncodeOptionsType* opts,
ExceptionState& exception_state) { … }
template <typename Traits>
void EncoderBase<Traits>::close(ExceptionState& exception_state) { … }
template <typename Traits>
ScriptPromise<IDLUndefined> EncoderBase<Traits>::flush(
ExceptionState& exception_state) { … }
template <typename Traits>
void EncoderBase<Traits>::reset(ExceptionState& exception_state) { … }
template <typename Traits>
void EncoderBase<Traits>::ResetInternal(DOMException* ex) { … }
template <typename Traits>
void EncoderBase<Traits>::QueueHandleError(DOMException* ex) { … }
template <typename Traits>
void EncoderBase<Traits>::HandleError(DOMException* ex) { … }
template <typename Traits>
void EncoderBase<Traits>::EnqueueRequest(Request* request) { … }
template <typename Traits>
void EncoderBase<Traits>::ProcessRequests() { … }
template <typename Traits>
bool EncoderBase<Traits>::ReadyToProcessNextRequest() { … }
template <typename Traits>
void EncoderBase<Traits>::ProcessFlush(Request* request) { … }
template <typename Traits>
void EncoderBase<Traits>::OnCodecReclaimed(DOMException* exception) { … }
template <typename Traits>
void EncoderBase<Traits>::ContextDestroyed() { … }
template <typename Traits>
bool EncoderBase<Traits>::HasPendingActivity() const { … }
template <typename Traits>
void EncoderBase<Traits>::TraceQueueSizes() const { … }
template <typename Traits>
void EncoderBase<Traits>::DispatchDequeueEvent(Event* event) { … }
template <typename Traits>
void EncoderBase<Traits>::ScheduleDequeueEvent() { … }
template <typename Traits>
ExecutionContext* EncoderBase<Traits>::GetExecutionContext() const { … }
template <typename Traits>
void EncoderBase<Traits>::Trace(Visitor* visitor) const { … }
template <typename Traits>
void EncoderBase<Traits>::Request::Trace(Visitor* visitor) const { … }
template <typename Traits>
const char* EncoderBase<Traits>::Request::TraceNameFromType() { … }
template <typename Traits>
void EncoderBase<Traits>::Request::StartTracingVideoEncode(
bool is_keyframe,
base::TimeDelta timestamp) { … }
template <typename Traits>
void EncoderBase<Traits>::Request::StartTracing() { … }
template <typename Traits>
void EncoderBase<Traits>::Request::EndTracing(bool aborted) { … }
template class EncoderBase<VideoEncoderTraits>;
template class EncoderBase<AudioEncoderTraits>;
}