#ifndef FLUTTER_LIB_UI_PAINTING_SINGLE_FRAME_CODEC_H_
#define FLUTTER_LIB_UI_PAINTING_SINGLE_FRAME_CODEC_H_
#include "flutter/fml/macros.h"
#include "flutter/lib/ui/painting/codec.h"
#include "flutter/lib/ui/painting/frame_info.h"
#include "flutter/lib/ui/painting/image_decoder.h"
namespace flutter {
class SingleFrameCodec : public Codec {
public:
SingleFrameCodec(ImageDecoder::ImageDescriptor descriptor);
~SingleFrameCodec() override;
int frameCount() const override;
int repetitionCount() const override;
Dart_Handle getNextFrame(Dart_Handle args) override;
size_t GetAllocationSize() override;
private:
enum class Status { kNew, kInProgress, kComplete };
Status status_;
ImageDecoder::ImageDescriptor descriptor_;
fml::RefPtr<FrameInfo> cached_frame_;
std::vector<DartPersistentValue> pending_callbacks_;
FML_FRIEND_MAKE_REF_COUNTED(SingleFrameCodec);
FML_FRIEND_REF_COUNTED_THREAD_SAFE(SingleFrameCodec);
};
}
#endif