Linker optimization, use extern template for LLView::getChild<>

meow-7.2.2
James Cook 2009-11-25 22:00:15 -08:00
parent 52a387e00f
commit 928b7cba3e
9 changed files with 50 additions and 0 deletions

View File

@ -56,6 +56,10 @@
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;
// globals loaded from settings.xml
S32 LLBUTTON_H_PAD = 0;
S32 LLBUTTON_V_PAD = 0;

View File

@ -50,6 +50,10 @@ 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;
LLCheckBoxCtrl::Params::Params()
: text_enabled_color("text_enabled_color"),
text_disabled_color("text_disabled_color"),

View File

@ -71,6 +71,10 @@ 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;
//
// Member functions
//

View File

@ -58,6 +58,10 @@
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;
LLPanel::LocalizedString::LocalizedString()
: name("name"),
value("value")

View File

@ -40,6 +40,10 @@
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;
LLTextBox::LLTextBox(const LLTextBox::Params& p)
: LLTextBase(p),
mClickedCallback(NULL)

View File

@ -73,6 +73,10 @@
//
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;
//
// Constants
//

View File

@ -40,6 +40,10 @@
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;
LLUICtrl::Params::Params()
: tab_stop("tab_stop", true),
chrome("chrome", false),

View File

@ -76,6 +76,9 @@ std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack;
BOOL LLView::sIsDrawing = FALSE;
#endif
// Compiler optimization, generate extern template
template class LLView* LLView::getChild<class LLView>(const std::string& name, BOOL recurse) const;
static LLDefaultChildRegistry::Register<LLView> r("view");
LLView::Params::Params()

View File

@ -659,4 +659,23 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
return result;
}
// 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;
#endif //LL_LLVIEW_H