Bug 1291045 (Part 1) - Use a different IDecodingTask for animated images. r=dholbert,edwin

This commit is contained in:
Seth Fowler
2016-08-01 17:02:16 -07:00
parent e2e1307cfa
commit 77d123ca25
3 changed files with 80 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ protected:
/**
* An IDecodingTask implementation for full decodes of images.
* An IDecodingTask implementation for full decodes of single frame images.
*/
class DecodingTask final : public IDecodingTask
{
@@ -81,6 +81,32 @@ private:
};
/**
* An IDecodingTask implementation for full decodes of animated images.
*/
class AnimationDecodingTask final : public IDecodingTask
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AnimationDecodingTask, override)
explicit AnimationDecodingTask(NotNull<Decoder*> aDecoder);
void Run() override;
bool ShouldPreferSyncRun() const override;
// Full decodes are low priority compared to metadata decodes because they
// don't block layout or page load.
TaskPriority Priority() const override { return TaskPriority::eLow; }
NotNull<Decoder*> GetDecoder() const override { return mDecoder; }
private:
virtual ~AnimationDecodingTask() { }
NotNull<RefPtr<Decoder>> mDecoder;
};
/**
* An IDecodingTask implementation for metadata decodes of images.
*/