summaryrefslogtreecommitdiff
path: root/indra/llimage/llimageworker.h
diff options
context:
space:
mode:
authorNat Linden <nat@lindenlab.com>2022-06-13 19:50:49 +0000
committerNat Linden <nat@lindenlab.com>2022-06-13 19:50:49 +0000
commitc9a48a1cdd23a592eb25454d5e2d6c316ec93445 (patch)
tree614d3ae0efdcbec1211d638e602cdb2d78aa8057 /indra/llimage/llimageworker.h
parentda069765b1974e60df5ebf9e973c7fd00c52e329 (diff)
parent3b043d90b60eca17dfcc014b21c4c8fc5b432384 (diff)
Merged in sl-17483 (pull request #1014)
SL-17483: Make LLImageDecodeThread a facade for LL::ThreadPool. Approved-by: Dave Parks
Diffstat (limited to 'indra/llimage/llimageworker.h')
-rw-r--r--indra/llimage/llimageworker.h61
1 files changed, 16 insertions, 45 deletions
diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h
index e0a94d2841..18398d9ae2 100644
--- a/indra/llimage/llimageworker.h
+++ b/indra/llimage/llimageworker.h
@@ -29,9 +29,13 @@
#include "llimage.h"
#include "llpointer.h"
-#include "llworkerthread.h"
-class LLImageDecodeThread : public LLQueuedThread
+namespace LL
+{
+ class ThreadPool;
+} // namespace LL
+
+class LLImageDecodeThread
{
public:
class Responder : public LLThreadSafeRefCount
@@ -42,57 +46,24 @@ public:
virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux) = 0;
};
- class ImageRequest : public LLQueuedThread::QueuedRequest
- {
- protected:
- virtual ~ImageRequest(); // use deleteRequest()
-
- public:
- ImageRequest(handle_t handle, LLImageFormatted* image,
- S32 discard, BOOL needs_aux,
- LLImageDecodeThread::Responder* responder);
-
- /*virtual*/ bool processRequest();
- /*virtual*/ void finishRequest(bool completed);
-
- // Used by unit tests to check the consitency of the request instance
- bool tut_isOK();
-
- private:
- // input
- LLPointer<LLImageFormatted> mFormattedImage;
- S32 mDiscardLevel;
- BOOL mNeedsAux;
- // output
- LLPointer<LLImageRaw> mDecodedImageRaw;
- LLPointer<LLImageRaw> mDecodedImageAux;
- BOOL mDecodedRaw;
- BOOL mDecodedAux;
- LLPointer<LLImageDecodeThread::Responder> mResponder;
- };
-
public:
LLImageDecodeThread(bool threaded = true);
virtual ~LLImageDecodeThread();
- handle_t decodeImage(LLImageFormatted* image,
+ // meant to resemble LLQueuedThread::handle_t
+ typedef U32 handle_t;
+ handle_t decodeImage(const LLPointer<LLImageFormatted>& image,
S32 discard, BOOL needs_aux,
- Responder* responder);
+ const LLPointer<Responder>& responder);
+ S32 getPending();
S32 update(F32 max_time_ms);
+ void shutdown();
private:
- struct creation_info
- {
- handle_t handle;
- LLPointer<LLImageFormatted> image;
- S32 discard;
- BOOL needs_aux;
- LLPointer<Responder> responder;
- creation_info(handle_t h, LLImageFormatted* i, U32 p, S32 d, BOOL aux, Responder* r)
- : handle(h), image(i), discard(d), needs_aux(aux), responder(r)
- {}
- };
- LLMutex* mCreationMutex;
+ // As of SL-17483, LLImageDecodeThread is no longer itself an
+ // LLQueuedThread - instead this is the API by which we submit work to the
+ // "ImageDecode" ThreadPool.
+ std::unique_ptr<LL::ThreadPool> mThreadPool;
};
#endif