diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-21 13:58:20 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-21 13:58:20 +0100 |
commit | 64d65e096bd762bfa54c362a83edd8dcd5ba2e53 (patch) | |
tree | 288c5dd4f3be98bfe6eb38bb775eacd84ac10592 /image/IDecodingTask.cpp | |
parent | d1a0bfe221b91ea37a34d0b0360f347d2a6394e5 (diff) | |
download | uxp-64d65e096bd762bfa54c362a83edd8dcd5ba2e53.tar.gz |
Make resuming of decoding work for anonymous decoders.
Diffstat (limited to 'image/IDecodingTask.cpp')
-rw-r--r-- | image/IDecodingTask.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/image/IDecodingTask.cpp b/image/IDecodingTask.cpp index a067e7a7d1..6e2f039be1 100644 --- a/image/IDecodingTask.cpp +++ b/image/IDecodingTask.cpp @@ -142,8 +142,10 @@ MetadataDecodingTask::Run() // AnonymousDecodingTask implementation. /////////////////////////////////////////////////////////////////////////////// -AnonymousDecodingTask::AnonymousDecodingTask(NotNull<Decoder*> aDecoder) +AnonymousDecodingTask::AnonymousDecodingTask(NotNull<Decoder*> aDecoder, + bool aResumable) : mDecoder(aDecoder) + , mResumable(aResumable) { } void @@ -168,5 +170,16 @@ AnonymousDecodingTask::Run() } } +void +AnonymousDecodingTask::Resume() +{ + // Anonymous decoders normally get all their data at once. We have some situations + // where they don't. If explicitly requested, resuming should be supported. + if (mResumable) { + RefPtr<AnonymousDecodingTask> self(this); + NS_DispatchToMainThread(NS_NewRunnableFunction([self]() -> void { self->Run(); })); + } +} + } // namespace image } // namespace mozilla |