summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-08-12 09:44:56 -0400
committerNat Goodspeed <nat@lindenlab.com>2019-08-12 09:44:56 -0400
commit98be6e141c1232bad28cc115bc7092f175b18809 (patch)
treead77bee533b115a0262f796a50edbf84ed7809ca /indra/llrender
parent17902bc735ea33db11abd21095f7e0edafb7abe7 (diff)
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.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llrender2dutils.h2
1 files changed, 1 insertions, 1 deletions
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<LLRender2D>
{
- LLPARAMSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
+ LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
LOG_CLASS(LLRender2D);
~LLRender2D();
public: