summaryrefslogtreecommitdiff
path: root/indra/llimage/llimageworker.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2022-06-09 12:06:23 -0400
committerNat Goodspeed <nat@lindenlab.com>2022-06-09 12:06:23 -0400
commit50dca86f64a167fe0db901310d04784b2f0dfa1f (patch)
tree6d39646a8506d219fe67b9ba6e41aaa0af5e1b70 /indra/llimage/llimageworker.h
parent0bf91fc141c988d61bc5c593766981e71454d6fd (diff)
SL-17483: Recast LLImageDecodeThread as a facade for ThreadPool.
Remove all references to LLQueuedThread (but emulate a couple bits of its API such as handle_t and getPending()). Migrate ImageRequest into llimageworker.cpp. It has never been part of LLImageDecodeThread's public API. Remove ImageRequest tests. Remove all references to LLImageDecodeThread::pause(). The idea of pausing another thread is bizarre to me, and LLThreadPool has no such operation. Nor does it have an abortRequest().
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..6a0b2b4681 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(LLPointer<LLImageFormatted> image,
S32 discard, BOOL needs_aux,
- Responder* responder);
+ 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