From 7ddbf118f5d1fde24c10b93432209fbe44d91345 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 24 Mar 2021 01:53:45 +0200 Subject: SL-13182 Split buildNewViews over frames --- indra/newview/llfolderviewmodelinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index d40a7234e2..117e2534cb 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -66,7 +66,7 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SORT); - if (!needsSort(folder->getViewModelItem())) return; + if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return; LLFolderViewModelItemInventory* modelp = static_cast(folder->getViewModelItem()); if (modelp->getUUID().isNull()) return; -- cgit v1.2.3 From 820ac72f8c4a07bc4310b9daac6966f2f2f2ee98 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 2 Apr 2021 22:40:56 +0300 Subject: SL-13182 Fix excessive resorting --- indra/newview/llfolderviewmodelinventory.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 117e2534cb..4544b083ed 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -140,15 +140,20 @@ void LLFolderViewModelItemInventory::requestSort() { folderp->requestArrange(); } - if (static_cast(mRootViewModel).getSorter().isByDate()) - { - // sort by date potentially affects parent folders which use a date - // derived from newest item in them - if (mParent) - { - mParent->requestSort(); - } - } + LLInventorySort sorter = static_cast(mRootViewModel).getSorter(); + + if (sorter.isByDate()) + { + // Sort by date potentially affects parent folders which use a date + // derived from newest item in them + // + // if this is an item, parent needs to be resorted (this case shouldn't happen) + // if this is a folder, check sort rules for folder first + if (mParent && (!folderp || !sorter.isFoldersByName())) + { + mParent->requestSort(); + } + } } void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) -- cgit v1.2.3 From 2be5baf70dcf4e55fcac3935e304828ced202123 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 3 Apr 2021 00:15:44 +0300 Subject: SL-13182 Fix excessive resorting #2 Don't resort whole branch of inventory if created(loaded) item is not newer. Should also stabilize fetch phase a bit. --- indra/newview/llfolderviewmodelinventory.cpp | 38 ++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 4544b083ed..b6d856e31b 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -132,6 +132,16 @@ bool LLFolderViewModelInventory::isFolderComplete(LLFolderViewFolder* folder) return false; } +//virtual +void LLFolderViewModelItemInventory::addChild(LLFolderViewModelItem* child) +{ + LLFolderViewModelItemInventory* model_child = static_cast(child); + mLastAddedChildCreationDate = model_child->getCreationDate(); + + // this will requestSort() + LLFolderViewModelItemCommon::addChild(child); +} + void LLFolderViewModelItemInventory::requestSort() { LLFolderViewModelItemCommon::requestSort(); @@ -142,18 +152,29 @@ void LLFolderViewModelItemInventory::requestSort() } LLInventorySort sorter = static_cast(mRootViewModel).getSorter(); - if (sorter.isByDate()) + // Sort by date potentially affects parent folders which use a date + // derived from newest item in them + if (sorter.isByDate() && mParent) { - // Sort by date potentially affects parent folders which use a date - // derived from newest item in them - // - // if this is an item, parent needs to be resorted (this case shouldn't happen) - // if this is a folder, check sort rules for folder first - if (mParent && (!folderp || !sorter.isFoldersByName())) + // If this is an item, parent needs to be resorted + // This case shouldn't happen, unless someone calls item->requestSort() + if (!folderp) { mParent->requestSort(); } + // if this is a folder, check sort rules for folder first + else if (sorter.isFoldersByDate()) + { + if (mLastAddedChildCreationDate == -1 // nothing was added, some other reason for resort + || mLastAddedChildCreationDate > getCreationDate()) // newer child + { + LLFolderViewModelItemInventory* model_parent = static_cast(mParent); + model_parent->mLastAddedChildCreationDate = mLastAddedChildCreationDate; + mParent->requestSort(); + } + } } + mLastAddedChildCreationDate = -1; } void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) @@ -392,6 +413,7 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model ) : LLFolderViewModelItemCommon(root_view_model), - mPrevPassedAllFilters(false) + mPrevPassedAllFilters(false), + mLastAddedChildCreationDate(-1) { } -- cgit v1.2.3