summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llaccordionctrl.cpp8
-rw-r--r--indra/llui/llaccordionctrltab.cpp25
-rw-r--r--indra/llui/lltextbase.cpp2
-rw-r--r--indra/newview/llinventoryitemslist.cpp85
-rw-r--r--indra/newview/llinventoryitemslist.h13
-rw-r--r--indra/newview/lloutfitgallery.cpp1
-rw-r--r--indra/newview/lloutfitslist.cpp8
7 files changed, 122 insertions, 20 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 495ba2f40f..1a64c2699d 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -303,8 +303,11 @@ void LLAccordionCtrl::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S3
return;
LLRect panel_rect = panel->getRect();
panel_rect.setLeftTopAndSize( left, top, width, height);
- panel->reshape( width, height, 1);
- panel->setRect(panel_rect);
+ if (panel->getRect() != panel_rect)
+ {
+ panel->reshape( width, height, 1);
+ panel->setRect(panel_rect);
+ }
}
void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta)
@@ -494,6 +497,7 @@ void LLAccordionCtrl::arrangeMultiple()
void LLAccordionCtrl::arrange()
{
+ LL_PROFILE_ZONE_SCOPED;
updateNoTabsHelpTextVisibility();
if (mAccordionTabs.empty())
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index ac66525030..bdf93348bb 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -248,10 +248,22 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, bool called_from_parent /* = true */)
{
S32 header_height = mHeaderTextbox->getTextPixelHeight();
+ LLRect old_header_rect = mHeaderTextbox->getRect();
LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET, (height + header_height) / 2, width, (height - header_height) / 2);
- mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight());
- mHeaderTextbox->setRect(textboxRect);
+ if (old_header_rect.getHeight() != textboxRect.getHeight()
+ || old_header_rect.mLeft != textboxRect.mLeft
+ || old_header_rect.mTop != textboxRect.mTop
+ || old_header_rect.getWidth() > textboxRect.getWidth() // reducing header's width
+ || (old_header_rect.getWidth() < textboxRect.getWidth() && old_header_rect.getWidth() < mHeaderTextbox->getTextPixelWidth()))
+ {
+ // Expensive text reflow
+ // Update if position or height changes
+ // Update if width reduces
+ // But do not update if text already fits and width increases (arguably LLTextBox::reshape should be smarter, not Accordion)
+ mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight());
+ mHeaderTextbox->setRect(textboxRect);
+ }
if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth())
{
@@ -416,8 +428,11 @@ void LLAccordionCtrlTab::reshape(S32 width, S32 height, bool called_from_parent
LLRect headerRect;
headerRect.setLeftTopAndSize(0, height, width, HEADER_HEIGHT);
- mHeader->setRect(headerRect);
- mHeader->reshape(headerRect.getWidth(), headerRect.getHeight());
+ if (mHeader->getRect() != headerRect)
+ {
+ mHeader->setRect(headerRect);
+ mHeader->reshape(headerRect.getWidth(), headerRect.getHeight());
+ }
if (!mDisplayChildren)
return;
@@ -932,7 +947,7 @@ void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect)
show_hide_scrollbar(child_rect);
updateLayout(child_rect);
}
- else
+ else if (mContainerPanel->getRect() != child_rect)
{
mContainerPanel->reshape(child_rect.getWidth(), child_rect.getHeight());
mContainerPanel->setRect(child_rect);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 69729fa421..1de12896eb 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1448,6 +1448,8 @@ void LLTextBase::reshape(S32 width, S32 height, bool called_from_parent)
// up-to-date mVisibleTextRect
updateRects();
+ // Todo: This might be wrong. updateRects already sets needsReflow conditionaly.
+ // Reflow is expensive and doing it at any twith can be too much.
needsReflow();
}
}
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index cfa37cc3ee..73cc953692 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -40,6 +40,10 @@
#include "llinventorymodel.h"
#include "llviewerinventory.h"
+bool LLInventoryItemsList::sListIdleRegistered = false;
+LLInventoryItemsList::all_list_t LLInventoryItemsList::sAllLists;
+LLInventoryItemsList::all_list_t::iterator LLInventoryItemsList::sAllListIter;
+
LLInventoryItemsList::Params::Params()
{}
@@ -55,13 +59,39 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p
setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems"));
- gIdleCallbacks.addFunction(idle, this);
+ sAllLists.push_back(this);
+ sAllListIter = sAllLists.begin();
+
+ if (!sListIdleRegistered)
+ {
+ sAllListIter = sAllLists.begin();
+ gIdleCallbacks.addFunction(idle, nullptr);
+
+ LLEventPumps::instance().obtain("LLApp").listen(
+ "LLInventoryItemsList",
+ [](const LLSD& stat)
+ {
+ std::string status(stat["status"]);
+ if (status != "running")
+ {
+ // viewer is starting shutdown
+ gIdleCallbacks.deleteFunction(idle, nullptr);
+ }
+ return false;
+ });
+ sListIdleRegistered = true;
+ }
}
// virtual
LLInventoryItemsList::~LLInventoryItemsList()
{
- gIdleCallbacks.deleteFunction(idle, this);
+ auto it = std::find(sAllLists.begin(), sAllLists.end(), this);
+ if (it != sAllLists.end())
+ {
+ sAllLists.erase(it);
+ sAllListIter = sAllLists.begin();
+ }
}
void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
@@ -111,25 +141,55 @@ void LLInventoryItemsList::updateSelection()
mSelectTheseIDs.clear();
}
-void LLInventoryItemsList::doIdle()
+bool LLInventoryItemsList::doIdle()
{
- if (mRefreshState == REFRESH_COMPLETE) return;
+ if (mRefreshState == REFRESH_COMPLETE) return true; // done
if (isInVisibleChain() || mForceRefresh || !getFilterSubString().empty())
{
refresh();
mRefreshCompleteSignal(this, LLSD());
+ return false; // keep going
}
+ return true; // done
}
//static
void LLInventoryItemsList::idle(void* user_data)
{
- LLInventoryItemsList* self = static_cast<LLInventoryItemsList*>(user_data);
- if ( self )
- { // Do the real idle
- self->doIdle();
+ if (sAllLists.empty())
+ return;
+
+ LL_PROFILE_ZONE_SCOPED;
+
+ using namespace std::chrono;
+ auto start = steady_clock::now();
+ const milliseconds time_limit = milliseconds(3);
+ const auto end_time = start + time_limit;
+ S32 max_update_count = 50;
+
+ if (sAllListIter == sAllLists.end())
+ {
+ sAllListIter = sAllLists.begin();
+ }
+
+ S32 updated = 0;
+ while (steady_clock::now() < end_time
+ && updated < max_update_count
+ && sAllListIter != sAllLists.end())
+ {
+ LLInventoryItemsList* list = *sAllListIter;
+ // Refresh is split into multiple separate parts,
+ // so keep repeating it while there is time, until done.
+ // Todo: refresh() split is pointless now?
+ // Or still useful for large folders?
+ if (list->doIdle())
+ {
+ // Item is done
+ ++sAllListIter;
+ updated++;
+ }
}
}
@@ -141,6 +201,7 @@ void LLInventoryItemsList::refresh()
{
case REFRESH_ALL:
{
+ LL_PROFILE_ZONE_NAMED("items_refresh_all");
mAddedItems.clear();
mRemovedItems.clear();
computeDifference(getIDs(), mAddedItems, mRemovedItems);
@@ -163,6 +224,7 @@ void LLInventoryItemsList::refresh()
}
case REFRESH_LIST_ERASE:
{
+ LL_PROFILE_ZONE_NAMED("items_refresh_erase");
uuid_vec_t::const_iterator it = mRemovedItems.begin();
for (; mRemovedItems.end() != it; ++it)
{
@@ -175,6 +237,7 @@ void LLInventoryItemsList::refresh()
}
case REFRESH_LIST_APPEND:
{
+ LL_PROFILE_ZONE_NAMED("items_refresh_append");
static const unsigned ADD_LIMIT = 25; // Note: affects perfomance
unsigned int nadded = 0;
@@ -239,6 +302,7 @@ void LLInventoryItemsList::refresh()
}
case REFRESH_LIST_SORT:
{
+ LL_PROFILE_ZONE_NAMED("items_refresh_sort");
// Filter, sort, rearrange and notify parent about shape changes
filterItems(true, true);
@@ -255,7 +319,10 @@ void LLInventoryItemsList::refresh()
break;
}
default:
- break;
+ {
+ mRefreshState = REFRESH_COMPLETE;
+ break;
+ }
}
setForceRefresh(mRefreshState != REFRESH_COMPLETE);
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index 9ebeb5e52b..b20c27eec8 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -59,7 +59,10 @@ public:
* Sets the flag indicating that the list needs to be refreshed even if it is
* not currently visible.
*/
- void setForceRefresh(bool force_refresh) { mForceRefresh = force_refresh; }
+ void setForceRefresh(bool force_refresh)
+ {
+ mForceRefresh = force_refresh;
+ }
/**
* If refreshes when invisible.
@@ -76,7 +79,7 @@ public:
* This is needed for example to filter items of the list hidden by closed
* accordion tab.
*/
- virtual void doIdle(); // Real idle routine
+ bool doIdle(); // Real idle routine
static void idle(void* user_data); // static glue to doIdle()
protected:
@@ -126,6 +129,12 @@ private:
bool mForceRefresh;
commit_signal_t mRefreshCompleteSignal;
+
+ // Update synchronization
+ typedef std::vector<LLInventoryItemsList*> all_list_t;
+ static all_list_t sAllLists;
+ static all_list_t::iterator sAllListIter;
+ static bool sListIdleRegistered;
};
#endif //LL_LLINVENTORYITEMSLIST_H
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 3adee9fa16..8589afae06 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -818,6 +818,7 @@ void LLOutfitGallery::getCurrentCategories(uuid_vec_t& vcur)
void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
{
+ LL_PROFILE_ZONE_SCOPED;
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
if (!cat) return;
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 4e594af432..58cd9fab83 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -181,6 +181,7 @@ void LLOutfitsList::onOpen(const LLSD& info)
void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
{
+ LL_PROFILE_ZONE_SCOPED;
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
if (!cat) return;
@@ -251,7 +252,9 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
if (AISAPI::isAvailable() && LLInventoryModelBackgroundFetch::instance().folderFetchActive())
{
- // for reliability just fetch it whole, linked items included
+ // For reliability just fetch it whole, linked items included
+ // Todo: list is not warrantied to exist once callback arrives
+ // Fix it!
LLInventoryModelBackgroundFetch::instance().fetchFolderAndLinks(cat_id, [cat_id, list]
{
if (list)
@@ -1059,6 +1062,7 @@ void LLOutfitListBase::onIdle(void* userdata)
void LLOutfitListBase::onIdleRefreshList()
{
+ LL_PROFILE_ZONE_SCOPED;
if (LLAppViewer::instance()->quitRequested())
{
mRefreshListState.CategoryUUID.setNull();
@@ -1072,7 +1076,7 @@ void LLOutfitListBase::onIdleRefreshList()
return;
}
- const F64 MAX_TIME = 0.05f;
+ const F64 MAX_TIME = 0.005f;
F64 curent_time = LLTimer::getTotalSeconds();
const F64 end_time = curent_time + MAX_TIME;