summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2024-03-05 17:03:11 +0100
committerGuru <alexandrgproductengine@lindenlab.com>2024-03-05 19:54:31 +0100
commita865d423974ea06dffa47798c81e98e7570b02ec (patch)
treed25f6c86d2948f7d8683aaa573d24135c8a26edb /indra/newview
parent043a92997f187826ad26ff269613c8f0ed11379f (diff)
viewer#819 Avoid reading the same XML file multiple times
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llblocklist.cpp5
-rw-r--r--indra/newview/llchathistory.cpp6
-rw-r--r--indra/newview/llcommandlineparser.cpp7
-rw-r--r--indra/newview/llfavoritesbar.cpp5
-rw-r--r--indra/newview/llmediactrl.cpp2
-rw-r--r--indra/newview/llnotificationlistitem.cpp2
-rw-r--r--indra/newview/lltoast.cpp2
-rw-r--r--indra/newview/lltoastnotifypanel.cpp4
-rw-r--r--indra/newview/lltoastscriptquestion.cpp2
-rw-r--r--indra/newview/llviewertexturelist.cpp2
11 files changed, 20 insertions, 19 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 518b606b44..8865d53f88 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2978,7 +2978,7 @@ void LLAppViewer::initStrings()
{
std::string strings_file = "strings.xml";
std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
- if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
+ if (strings_path_full.empty() || !gDirUtilp->fileExists(strings_path_full))
{
if (strings_path_full.empty())
{
diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp
index 29be2aaa6d..16db32862d 100644
--- a/indra/newview/llblocklist.cpp
+++ b/indra/newview/llblocklist.cpp
@@ -61,8 +61,9 @@ LLBlockList::LLBlockList(const Params& p)
LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_people_blocked_gear.xml",
gMenuHolder,
- LLViewerMenuHolderGL::child_registry_t::instance());
- if(context_menu)
+ LLViewerMenuHolderGL::child_registry_t::instance(),
+ true);
+ if (context_menu)
{
mContextMenu = context_menu->getHandle();
}
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index e1140e77fd..0b7cdd1db4 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -131,7 +131,7 @@ public:
static LLChatHistoryHeader* createInstance(const std::string& file_name)
{
LLChatHistoryHeader* pInstance = new LLChatHistoryHeader;
- pInstance->buildFromFile(file_name);
+ pInstance->buildFromFile(file_name, true);
return pInstance;
}
@@ -587,7 +587,7 @@ public:
mUserNameTextBox = getChild<LLTextBox>("user_name");
mTimeBoxTextBox = getChild<LLTextBox>("time_box");
- mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
+ mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance(), true);
if (mInfoCtrl)
{
mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
@@ -1179,7 +1179,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
LLView* LLChatHistory::getSeparator()
{
- LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
+ LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance(), true);
return separator;
}
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index bc61fac00b..030d24bed8 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -657,12 +657,11 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG
// This method reads the llsd based config file, and uses it to set
// members of a control group.
LLSD clpConfigLLSD;
-
- llifstream input_stream;
- input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary);
- if(input_stream.is_open())
+ std::string xml = gDirUtilp->getFileContents(config_filename);
+ if (!xml.empty())
{
+ std::stringstream input_stream(xml);
LLSDSerialize::fromXML(clpConfigLLSD, input_stream);
for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap();
option_itr != clpConfigLLSD.endMap();
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 6f689a5dd9..220ca69a47 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -860,10 +860,11 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams()
if (!params_initialized)
{
LLXMLNodePtr button_xml_node;
- if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node))
+ static const std::string filename("favorites_bar_button.xml");
+ if (LLUICtrlFactory::getLayeredXMLNode(filename, button_xml_node, LLDir::CURRENT_SKIN, true))
{
LLXUIParser parser;
- parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml");
+ parser.readXUI(button_xml_node, button_params, filename);
}
params_initialized = true;
}
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 5461f98624..72fbab406b 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -633,7 +633,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool cl
void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::string& filename_in )
{
std::string filename(gDirUtilp->add(subdir, filename_in));
- std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename);
+ std::string expanded_filename = gDirUtilp->findSkinnedFilename(LLDir::HTML, filename);
if (expanded_filename.empty())
{
diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp
index 75edac105a..79a90c4f4c 100644
--- a/indra/newview/llnotificationlistitem.cpp
+++ b/indra/newview/llnotificationlistitem.cpp
@@ -594,7 +594,7 @@ LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p)
mSystemNotificationIcon(NULL),
mIsCaution(false)
{
- buildFromFile("panel_notification_list_item.xml");
+ buildFromFile("panel_notification_list_item.xml", true);
mIsCaution = p.notification_priority >= NOTIFICATION_PRIORITY_HIGH;
if (mIsCaution)
{
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index f6fadf276c..5cf2e89c63 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -119,7 +119,7 @@ LLToast::LLToast(const LLToast::Params& p)
{
mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
- buildFromFile("panel_toast.xml");
+ buildFromFile("panel_toast.xml", true);
setCanDrag(false);
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 1f6a88cd95..f7bebf08aa 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -266,9 +266,9 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
LLRect current_rect = getRect();
setXMLFilename("");
- buildFromFile("panel_notification.xml");
+ buildFromFile("panel_notification.xml", true);
- if(rect != LLRect::null)
+ if (rect != LLRect::null)
{
this->setShape(rect);
}
diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp
index f6fc9e7889..49fbf885eb 100644
--- a/indra/newview/lltoastscriptquestion.cpp
+++ b/indra/newview/lltoastscriptquestion.cpp
@@ -37,7 +37,7 @@ LLToastScriptQuestion::LLToastScriptQuestion(const LLNotificationPtr& notificati
:
LLToastPanel(notification)
{
- buildFromFile("panel_script_question_toast.xml");
+ buildFromFile("panel_script_question_toast.xml", true);
}
bool LLToastScriptQuestion::postBuild()
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index cea9c91295..57daeccaf7 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -407,7 +407,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
return NULL ;
}
- std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
+ std::string full_path = gDirUtilp->findSkinnedFilename(LLDir::TEXTURES, filename);
if (full_path.empty())
{
LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;