summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2022-06-13 15:18:14 -0400
committerNat Goodspeed <nat@lindenlab.com>2022-06-13 15:18:14 -0400
commit3b043d90b60eca17dfcc014b21c4c8fc5b432384 (patch)
tree614d3ae0efdcbec1211d638e602cdb2d78aa8057 /indra/llimage
parent64209ddeeafd944f82da6f13a6e790f9b542b3ff (diff)
SL-17483: Per review feedback, avoid LLPointer refcount twiddling
when passing LLPointers into functions. Only increment the refcount when storing in new ImageRequest.
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/llimageworker.cpp17
-rw-r--r--indra/llimage/llimageworker.h4
2 files changed, 13 insertions, 8 deletions
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index 3c21499673..0093958e6d 100644
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -34,15 +34,17 @@
class ImageRequest
{
public:
- ImageRequest(LLPointer<LLImageFormatted> image,
+ ImageRequest(const LLPointer<LLImageFormatted>& image,
S32 discard, BOOL needs_aux,
- LLPointer<LLImageDecodeThread::Responder> responder);
+ const LLPointer<LLImageDecodeThread::Responder>& responder);
virtual ~ImageRequest();
/*virtual*/ bool processRequest();
/*virtual*/ void finishRequest(bool completed);
private:
+ // LLPointers stored in ImageRequest MUST be LLPointer instances rather
+ // than references: we need to increment the refcount when storing these.
// input
LLPointer<LLImageFormatted> mFormattedImage;
S32 mDiscardLevel;
@@ -82,8 +84,11 @@ S32 LLImageDecodeThread::getPending()
return mThreadPool->getQueue().size();
}
-LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(LLPointer<LLImageFormatted> image,
- S32 discard, BOOL needs_aux, LLPointer<LLImageDecodeThread::Responder> responder)
+LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(
+ const LLPointer<LLImageFormatted>& image,
+ S32 discard,
+ BOOL needs_aux,
+ const LLPointer<LLImageDecodeThread::Responder>& responder)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
@@ -113,9 +118,9 @@ LLImageDecodeThread::Responder::~Responder()
//----------------------------------------------------------------------------
-ImageRequest::ImageRequest(LLPointer<LLImageFormatted> image,
+ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image,
S32 discard, BOOL needs_aux,
- LLPointer<LLImageDecodeThread::Responder> responder)
+ const LLPointer<LLImageDecodeThread::Responder>& responder)
: mFormattedImage(image),
mDiscardLevel(discard),
mNeedsAux(needs_aux),
diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h
index 6a0b2b4681..18398d9ae2 100644
--- a/indra/llimage/llimageworker.h
+++ b/indra/llimage/llimageworker.h
@@ -52,9 +52,9 @@ public:
// meant to resemble LLQueuedThread::handle_t
typedef U32 handle_t;
- handle_t decodeImage(LLPointer<LLImageFormatted> image,
+ handle_t decodeImage(const LLPointer<LLImageFormatted>& image,
S32 discard, BOOL needs_aux,
- LLPointer<Responder> responder);
+ const LLPointer<Responder>& responder);
S32 getPending();
S32 update(F32 max_time_ms);
void shutdown();