diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-05-04 23:31:14 +0300 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-05-05 02:16:18 +0300 |
| commit | 5b5c4e5f385dfdcbe001e20200b4d381ddcab379 (patch) | |
| tree | d56150c3221271f1335359fbdf02de59c196fafc /indra/llui | |
| parent | c828dc35db7d5673a629590da3ec2064d1394ad4 (diff) | |
#5756 Improve LLUICtrlFactory's performance
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/lluictrlfactory.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/lluictrlfactory.h | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 33ffc3dfc6..740f187ed8 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -67,7 +67,7 @@ public: static LLDefaultChildRegistry::Register<LLUICtrlLocate> r1("locate"); // Build time optimization, generate this once in .cpp file -template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +template class LLUICtrlFactory* LLSimpleton<class LLUICtrlFactory>::getInstance(); //----------------------------------------------------------------------------- // LLUICtrlFactory() diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index f44b4ba4dc..75cee5f004 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -81,12 +81,13 @@ class LLWidgetNameRegistry // Build time optimization, generate this once in .cpp file #ifndef LLUICTRLFACTORY_CPP -extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +extern template class LLUICtrlFactory* LLSimpleton<class LLUICtrlFactory>::getInstance(); #endif -class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> +class LLUICtrlFactory : public LLSimpleton<LLUICtrlFactory> { - LLSINGLETON(LLUICtrlFactory); +public: + LLUICtrlFactory(); ~LLUICtrlFactory(); // only partial specialization allowed in inner classes, so use extra dummy parameter @@ -313,6 +314,10 @@ template<typename T> LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreatorFunc func) : LLChildRegistry<DERIVED>::StaticRegistrar(tag, func == nullptr ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder<T> : func) { + if (!LLUICtrlFactory::instanceExists()) + { + LLUICtrlFactory::createInstance(); + } // add this widget to various registries LLUICtrlFactory::instance().registerWidget(typeid(T), typeid(typename T::Params), tag); |
