diff options
author | James Cook <james@lindenlab.com> | 2009-11-30 14:41:52 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-30 14:41:52 -0800 |
commit | 7d3b3cc474822db144b623980d08b7addc2f77ff (patch) | |
tree | 7d972191820ff94840a6f48d7f30b17fb6f3316a /indra/llui | |
parent | 447d1c6498870e82834c3b404fa507aee331f45b (diff) |
Linker optimization - use "extern template" for commonly regenerated templates
Also replaced many duplicate calls to LLViewerCamera::getInstance() with local pointer.
Reviewed with Ambroff
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 5 | ||||
-rw-r--r-- | indra/llui/llcheckboxctrl.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llcheckboxctrl.h | 5 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 5 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 5 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 6 | ||||
-rw-r--r-- | indra/llui/lltextbox.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lltextbox.h | 6 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 5 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 6 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llview.h | 20 |
18 files changed, 74 insertions, 34 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 617a97b6cf..7721137e29 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -32,6 +32,7 @@ #include "linden_common.h" +#define LLBUTTON_CPP #include "llbutton.h" // Linden library includes @@ -57,8 +58,8 @@ static LLDefaultChildRegistry::Register<LLButton> r("button"); // Compiler optimization, generate extern template -//template class LLButton* LLView::getChild<class LLButton>( -// const std::string& name, BOOL recurse) const; +template class LLButton* LLView::getChild<class LLButton>( + const std::string& name, BOOL recurse) const; // globals loaded from settings.xml S32 LLBUTTON_H_PAD = 0; diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8c3b4bd859..4c7400220d 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -322,5 +322,10 @@ private: LLFrameTimer mFlashingTimer; }; +// Build time optimization, generate once in .cpp file +#ifndef LLBUTTON_CPP +extern template class LLButton* LLView::getChild<class LLButton>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LLBUTTON_H diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 3c5925f965..cd10dfdb1c 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -33,6 +33,7 @@ // The mutants are coming! #include "linden_common.h" +#define LLCHECKBOXCTRL_CPP #include "llcheckboxctrl.h" #include "llgl.h" @@ -51,8 +52,8 @@ const U32 MAX_STRING_LENGTH = 10; static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box"); // Compiler optimization, generate extern template -//template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( -// const std::string& name, BOOL recurse) const; +template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( + const std::string& name, BOOL recurse) const; LLCheckBoxCtrl::Params::Params() : text_enabled_color("text_enabled_color"), diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index b14e66b915..28d50f957d 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -126,5 +126,10 @@ protected: LLUIColor mTextDisabledColor; }; +// Build time optimization, generate once in .cpp file +#ifndef LLCHECKBOXCTRL_CPP +extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LLCHECKBOXCTRL_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1551aab192..8a21155cc3 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -34,6 +34,7 @@ #include "linden_common.h" +#define LLLINEEDITOR_CPP #include "lllineeditor.h" #include "lltexteditor.h" @@ -72,8 +73,8 @@ const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor"); // Compiler optimization, generate extern template -//template class LLLineEditor* LLView::getChild<class LLLineEditor>( -// const std::string& name, BOOL recurse) const; +template class LLLineEditor* LLView::getChild<class LLLineEditor>( + const std::string& name, BOOL recurse) const; // // Member functions diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index b96220e020..49e9539b16 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -395,5 +395,10 @@ private: }; // end class LLLineEditor +// Build time optimization, generate once in .cpp file +#ifndef LLLINEEDITOR_CPP +extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LINEEDITOR_ diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index dc5db03a44..750b190953 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -34,6 +34,7 @@ #include "linden_common.h" +#define LLPANEL_CPP #include "llpanel.h" #include "llalertdialog.h" @@ -59,8 +60,8 @@ static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); // Compiler optimization, generate extern template -//template class LLPanel* LLView::getChild<class LLPanel>( -// const std::string& name, BOOL recurse) const; +template class LLPanel* LLView::getChild<class LLPanel>( + const std::string& name, BOOL recurse) const; LLPanel::LocalizedString::LocalizedString() : name("name"), diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 0a0fed82fb..a8bd5fd5e5 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -275,4 +275,10 @@ private: }; // end class LLPanel +// Build time optimization, generate once in .cpp file +#ifndef LLPANEL_CPP +extern template class LLPanel* LLView::getChild<class LLPanel>( + const std::string& name, BOOL recurse) const; +#endif + #endif diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 4bd9a32b1d..0bd0ab59fb 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -31,7 +31,10 @@ */ #include "linden_common.h" + +#define LLTEXTBOX_CPP #include "lltextbox.h" + #include "lluictrlfactory.h" #include "llfocusmgr.h" #include "llwindow.h" @@ -41,8 +44,8 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text"); // Compiler optimization, generate extern template -//template class LLTextBox* LLView::getChild<class LLTextBox>( -// const std::string& name, BOOL recurse) const; +template class LLTextBox* LLView::getChild<class LLTextBox>( + const std::string& name, BOOL recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 01b4bfa5ed..3a045534d3 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -79,4 +79,10 @@ protected: callback_t mClickedCallback; }; +// Build time optimization, generate once in .cpp file +#ifndef LLTEXTBOX_CPP +extern template class LLTextBox* LLView::getChild<class LLTextBox>( + const std::string& name, BOOL recurse) const; +#endif + #endif diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 6e07a890ad..e68affc36c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1,6 +1,5 @@ /** * @file lltexteditor.cpp - * @brief LLTextEditor base class * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -34,6 +33,7 @@ #include "linden_common.h" +#define LLTEXTEDITOR_CPP #include "lltexteditor.h" #include "llfontfreetype.h" // for LLFontFreetype::FIRST_CHAR @@ -74,8 +74,8 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor"); // Compiler optimization, generate extern template -//template class LLTextEditor* LLView::getChild<class LLTextEditor>( -// const std::string& name, BOOL recurse) const; +template class LLTextEditor* LLView::getChild<class LLTextEditor>( + const std::string& name, BOOL recurse) const; // // Constants diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index fb014b86bf..043dda8fa6 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -334,5 +334,10 @@ private: LLContextMenu* mContextMenu; }; // end class LLTextEditor +// Build time optimization, generate once in .cpp file +#ifndef LLTEXTEDITOR_CPP +extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_TEXTEDITOR_ diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 3cf592f351..1e0af1201f 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -31,9 +31,11 @@ * $/LicenseInfo$ */ -//#include "llviewerprecompiledheaders.h" #include "linden_common.h" + +#define LLUICTRL_CPP #include "lluictrl.h" + #include "llfocusmgr.h" #include "llpanel.h" #include "lluictrlfactory.h" @@ -41,8 +43,8 @@ static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl"); // Compiler optimization, generate extern template -//template class LLUICtrl* LLView::getChild<class LLUICtrl>( -// const std::string& name, BOOL recurse) const; +template class LLUICtrl* LLView::getChild<class LLUICtrl>( + const std::string& name, BOOL recurse) const; LLUICtrl::Params::Params() : tab_stop("tab_stop", true), diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index aef1bcd519..ac916c9a43 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -328,4 +328,10 @@ private: class DefaultTabGroupFirstSorter; }; +// Build time optimization, generate once in .cpp file +#ifndef LLUICTRL_CPP +extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( + const std::string& name, BOOL recurse) const; +#endif + #endif // LL_LLUICTRL_H diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 49182be328..3643bf44f7 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -32,6 +32,7 @@ #include "linden_common.h" +#define LLUICTRLFACTORY_CPP #include "lluictrlfactory.h" #include "llxmlnode.h" diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index e021c04ad6..55d7d745eb 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -109,7 +109,9 @@ extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS; // Build time optimization, generate this once in .cpp file -//extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +#ifndef LLUICTRLFACTORY_CPP +extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +#endif class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> { diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index ef23268a14..e7e8b1b858 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -33,6 +33,7 @@ #include "linden_common.h" +#define LLVIEW_CPP #include "llview.h" #include <cassert> @@ -77,7 +78,8 @@ BOOL LLView::sIsDrawing = FALSE; #endif // Compiler optimization, generate extern template -//template class LLView* LLView::getChild<class LLView>(const std::string& name, BOOL recurse) const; +template class LLView* LLView::getChild<class LLView>( + const std::string& name, BOOL recurse) const; static LLDefaultChildRegistry::Register<LLView> r("view"); diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 1b12e78509..8ee05675c1 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -661,21 +661,9 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // Compiler optimization - don't generate these specializations inline, // require explicit specialization. See llbutton.cpp for an example. -//extern template class LLButton* LLView::getChild<class LLButton>( -// const std::string& name, BOOL recurse) const; -//extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( -// const std::string& name, BOOL recurse) const; -//extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( -// const std::string& name, BOOL recurse) const; -//extern template class LLPanel* LLView::getChild<class LLPanel>( -// const std::string& name, BOOL recurse) const; -//extern template class LLTextBox* LLView::getChild<class LLTextBox>( -// const std::string& name, BOOL recurse) const; -//extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( -// const std::string& name, BOOL recurse) const; -//extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( -// const std::string& name, BOOL recurse) const; -//extern template class LLView* LLView::getChild<class LLView>( -// const std::string& name, BOOL recurse) const; +#ifndef LLVIEW_CPP +extern template class LLView* LLView::getChild<class LLView>( + const std::string& name, BOOL recurse) const; +#endif #endif //LL_LLVIEW_H |