From adeee613c60e8d4d2d57ede9685b8388a681c409 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 25 Jul 2019 18:20:17 +0300 Subject: DRTVWR-493 LLRender2D to LLParamSingleton --- indra/llrender/llrender2dutils.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'indra/llrender/llrender2dutils.h') diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index cce3b4ed51..4e4696be41 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -121,28 +121,26 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL class LLImageProviderInterface; -class LLRender2D +class LLRender2D : public LLParamSingleton { + LLPARAMSINGLETON(LLRender2D, LLImageProviderInterface* image_provider, const LLVector2* scale_factor); LOG_CLASS(LLRender2D); + ~LLRender2D(); public: - static void initClass(LLImageProviderInterface* image_provider, - const LLVector2* scale_factor); - static void cleanupClass(); + void pushMatrix(); + void popMatrix(); + void loadIdentity(); + void translate(F32 x, F32 y, F32 z = 0.0f); - static void pushMatrix(); - static void popMatrix(); - static void loadIdentity(); - static void translate(F32 x, F32 y, F32 z = 0.0f); + void setLineWidth(F32 width); + void setScaleFactor(const LLVector2& scale_factor); - static void setLineWidth(F32 width); - static void setScaleFactor(const LLVector2& scale_factor); + LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0); + LLPointer getUIImage(const std::string& name, S32 priority = 0); - static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0); - static LLPointer getUIImage(const std::string& name, S32 priority = 0); - - static LLVector2 sGLScaleFactor; + LLVector2 mGLScaleFactor; private: - static LLImageProviderInterface* sImageProvider; + LLImageProviderInterface* mImageProvider; }; class LLImageProviderInterface -- cgit v1.2.3 From 34d8200d0f0dde1b8205c802edbb08cc1ff503b2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sat, 10 Aug 2019 09:01:54 +0300 Subject: DRTVWR-493 LLRender2D init cleanup --- indra/llrender/llrender2dutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender/llrender2dutils.h') diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 4e4696be41..f2640ff998 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -123,7 +123,7 @@ class LLImageProviderInterface; class LLRender2D : public LLParamSingleton { - LLPARAMSINGLETON(LLRender2D, LLImageProviderInterface* image_provider, const LLVector2* scale_factor); + LLPARAMSINGLETON(LLRender2D, LLImageProviderInterface* image_provider); LOG_CLASS(LLRender2D); ~LLRender2D(); public: -- cgit v1.2.3 From 98be6e141c1232bad28cc115bc7092f175b18809 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 12 Aug 2019 09:44:56 -0400 Subject: DRTVWR-493: Streamline LLParamSingleton, LLLockedSingleton. Simplify LLSingleton::SingletonLifetimeManager to SingletonInitializer: that struct has not been responsible for deletion ever since LLSingletonBase acquired dependency-ordered deleteAll(). Move SingletonData::mInitState changes from SingletonLifetimeManager to constructSingleton() method. Similarly, constructSingleton() now sets SingletonData::mInstance instead of making its caller store the pointer. Add variadic arguments to LLSingleton::constructSingleton() so we can reuse it for LLParamSingleton. Add finishInitializing() method to encapsulate logic reused for getInstance()'s INITIALIZING and DELETED cases. Make LLParamSingleton a subclass of LLSingleton, just as LLLockedSingleton is a subclass of LLParamSingleton. Make LLParamSingleton a friend of LLSingleton, so it can access private members of LLSingleton without also granting access to any DERIVED_CLASS subclass. This eliminates the need for protected getInitState(). LLParamSingleton::initParamSingleton() reuses LLSingleton::constructSingleton() and finishInitializing(). Its getInstance() method completely replaces LLSingleton::getInstance(): in most EInitStates, LLParamSingleton::getInstance() is an error. Use a std::mutex to serialize calls to LLParamSingleton::initParamSingleton() and getInstance(). While LLSingleton::getInstance() relies on the "initialized exactly once" guarantee for block-scope static declarations, LLParamSingleton cannot rely on the same mechanism. LLLockedSingleton is now a very succinct subclass of LLParamSingleton -- they have very similar functionality. Giving the LLSINGLETON() macro variadic arguments eliminates the need for a separate LLPARAMSINGLETON() macro, while continuing to support existing usage. --- indra/llrender/llrender2dutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender/llrender2dutils.h') diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index f2640ff998..cf408336e6 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -123,7 +123,7 @@ class LLImageProviderInterface; class LLRender2D : public LLParamSingleton { - LLPARAMSINGLETON(LLRender2D, LLImageProviderInterface* image_provider); + LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider); LOG_CLASS(LLRender2D); ~LLRender2D(); public: -- cgit v1.2.3 From 1233842012a257b7eb49eab354bb945593c974ed Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 13 Aug 2019 17:22:58 +0300 Subject: SL-11718 Crash in LLRender2D --- indra/llrender/llrender2dutils.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/llrender/llrender2dutils.h') diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index cf408336e6..70ab006fd6 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -139,6 +139,13 @@ public: LLPointer getUIImage(const std::string& name, S32 priority = 0); LLVector2 mGLScaleFactor; + +protected: + // since LLRender2D has no control of image provider's lifecycle + // we need a way to tell LLRender2D that provider died and + // LLRender2D needs to be updated. + static void resetProvider(); + private: LLImageProviderInterface* mImageProvider; }; @@ -147,11 +154,21 @@ class LLImageProviderInterface { protected: LLImageProviderInterface() {}; - virtual ~LLImageProviderInterface() {}; + virtual ~LLImageProviderInterface(); public: virtual LLPointer getUIImage(const std::string& name, S32 priority) = 0; virtual LLPointer getUIImageByID(const LLUUID& id, S32 priority) = 0; virtual void cleanUp() = 0; + + // to notify holders when pointer gets deleted + typedef void(*callback_t)(); + void addOnRemovalCallback(callback_t func); + void deleteOnRemovalCallback(callback_t func); + +private: + + typedef std::list< callback_t > callback_list_t; + callback_list_t mCallbackList; }; -- cgit v1.2.3