From d533a33f4229244405ed0b247fce410513b6c3e9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Apr 2013 18:59:21 -0700 Subject: CHUI-912 : WIP : Add traces to various aspects of the inventory filtering, sorting and arranging (to be deleted) --- indra/newview/llfolderviewmodelinventory.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 586965e5a0..5ad94bfaba 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -35,6 +35,13 @@ // class LLFolderViewModelInventory // static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); +static S32 sModelInstance = 0; + +LLFolderViewModelInventory::LLFolderViewModelInventory() +{ + mModelInstance = sModelInstance++; + llinfos << "Merov : LLFolderViewModelInventory::LLFolderViewModelInventory, instance = " << mModelInstance << llendl; +} bool LLFolderViewModelInventory::startDrag(std::vector& items) { @@ -64,6 +71,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); + llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << llendl; if (!needsSort(folder->getViewModelItem())) return; @@ -174,7 +182,16 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) const S32 filter_generation = filter.getCurrentGeneration(); const S32 must_pass_generation = filter.getFirstRequiredGeneration(); - if (getLastFilterGeneration() >= must_pass_generation + if (getSearchableName() == "A NOUNOURS") + { + llinfos << "Merov : LLFolderViewModelItemInventory::filter : special NOUNOURS case, filter count = " << filter.getFilterCount() << ", must pass = " << must_pass_generation << ", current = " << filter_generation << ", item last = " << getLastFilterGeneration() << ", folder last = " << getLastFolderFilterGeneration() << llendl; + } + else + { + llinfos << "Merov : LLFolderViewModelItemInventory::filter : filter count = " << filter.getFilterCount() << llendl; + } + + if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation && !passedFilter(must_pass_generation)) { @@ -185,14 +202,12 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) return true; } - const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) - ? filter.checkFolder(this) - : true; + const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); - if(!mChildren.empty() + if (!mChildren.empty() && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass - || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement + || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement { // now query children for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); -- cgit v1.2.3 From 0ecbbe9571be298284c2410ea441877b611bd875 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 15 Apr 2013 11:16:57 -0700 Subject: CHUI-912 : WIP : Try to change the return value of filter() so to trigger arrange on the fly. --- indra/newview/llfolderviewmodelinventory.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 5ad94bfaba..49b72485e0 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -71,7 +71,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); - llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << llendl; + llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << ", folder = " << folder->getName() << llendl; if (!needsSort(folder->getViewModelItem())) return; @@ -155,11 +155,12 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); - bool continue_filtering = true; +// bool continue_filtering = true; + bool new_filtered_item = false; if (item->getLastFilterGeneration() < filter_generation) { // recursive application of the filter for child items - continue_filtering = item->filter( filter ); + new_filtered_item = item->filter( filter ); } // track latest generation to pass any child items, for each folder up to root @@ -174,7 +175,7 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } } - return continue_filtering; + return new_filtered_item; } bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) @@ -186,10 +187,6 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { llinfos << "Merov : LLFolderViewModelItemInventory::filter : special NOUNOURS case, filter count = " << filter.getFilterCount() << ", must pass = " << must_pass_generation << ", current = " << filter_generation << ", item last = " << getLastFilterGeneration() << ", folder last = " << getLastFolderFilterGeneration() << llendl; } - else - { - llinfos << "Merov : LLFolderViewModelItemInventory::filter : filter count = " << filter.getFilterCount() << llendl; - } if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation @@ -199,12 +196,14 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) // go ahead and flag this item as done setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); - return true; + return false; } const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); + bool new_filtered_item = false; + if (!mChildren.empty() && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement @@ -214,7 +213,8 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != end_iter && filter.getFilterCount() > 0; ++iter) { - if (!filterChildItem((*iter), filter)) + new_filtered_item |= filterChildItem((*iter), filter); + if (filter.getFilterCount() <= 0) { break; } @@ -230,12 +230,9 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); - return true; - } - else - { - return false; + new_filtered_item |= passed_filter; } + return new_filtered_item; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() -- cgit v1.2.3 From e84c97e86d51b4f890695182c8087288481b6955 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 16 Apr 2013 19:24:47 -0700 Subject: CHUI-912, CHUI-849 : Propagate arrange request correctly, limit sort, improve filter perf, clear traces, add comments. --- indra/newview/llfolderviewmodelinventory.cpp | 43 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 49b72485e0..1894314513 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -40,7 +40,6 @@ static S32 sModelInstance = 0; LLFolderViewModelInventory::LLFolderViewModelInventory() { mModelInstance = sModelInstance++; - llinfos << "Merov : LLFolderViewModelInventory::LLFolderViewModelInventory, instance = " << mModelInstance << llendl; } bool LLFolderViewModelInventory::startDrag(std::vector& items) @@ -71,7 +70,6 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); - llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << ", folder = " << folder->getName() << llendl; if (!needsSort(folder->getViewModelItem())) return; @@ -82,6 +80,7 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) it != end_it; ++it) { + // Recursive call to sort() on child (CHUI-849) LLFolderViewFolder* child_folderp = *it; sort(child_folderp); @@ -136,13 +135,12 @@ void LLFolderViewModelItemInventory::requestSort() void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { + bool before = passedFilter(); LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); - bool passed_filter_before = mPrevPassedAllFilters; - mPrevPassedAllFilters = passedFilter(filter_generation); - - if (passed_filter_before != mPrevPassedAllFilters) + if (before != passed) { + // Need to rearrange the folder if the filtered state of the item changed LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); if (parent_folder) { @@ -155,15 +153,14 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); -// bool continue_filtering = true; bool new_filtered_item = false; if (item->getLastFilterGeneration() < filter_generation) { - // recursive application of the filter for child items + // Recursive application of the filter for child items (CHUI-849) new_filtered_item = item->filter( filter ); } - // track latest generation to pass any child items, for each folder up to root + // Update latest generation to pass filter in parent and propagate up to root if (item->passedFilter()) { LLFolderViewModelItemInventory* view_model = this; @@ -182,23 +179,30 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { const S32 filter_generation = filter.getCurrentGeneration(); const S32 must_pass_generation = filter.getFirstRequiredGeneration(); + const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); - if (getSearchableName() == "A NOUNOURS") - { - llinfos << "Merov : LLFolderViewModelItemInventory::filter : special NOUNOURS case, filter count = " << filter.getFilterCount() << ", must pass = " << must_pass_generation << ", current = " << filter_generation << ", item last = " << getLastFilterGeneration() << ", folder last = " << getLastFolderFilterGeneration() << llendl; - } - if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation && !passedFilter(must_pass_generation)) { // failed to pass an earlier filter that was a subset of the current one - // go ahead and flag this item as done + // go ahead and flag this item as not pass setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); return false; } + if (getLastFilterGeneration() >= sufficient_pass_generation + && getLastFolderFilterGeneration() >= sufficient_pass_generation + && passedFilter(sufficient_pass_generation)) + { + // passed an earlier filter that was a superset of the current one + // go ahead and flag this item as pass + setPassedFilter(true, filter_generation); + setPassedFolderFilter(true, filter_generation); + return true; + } + const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); @@ -221,13 +225,11 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) } } - // if we didn't use all filter iterations - // that means we filtered all of our descendants - // so filter ourselves now + // If we didn't use all filter iterations that means we filtered all of our descendants so filter ourselves now if (filter.getFilterCount() > 0) { + // This is where filter count is hit and filter check on the item done (CHUI-849) filter.decrementFilterCount(); - const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); new_filtered_item |= passed_filter; @@ -320,7 +322,6 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, } LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model ) - : LLFolderViewModelItemCommon(root_view_model), - mPrevPassedAllFilters(false) + : LLFolderViewModelItemCommon(root_view_model) { } -- cgit v1.2.3 From 03ad10d258095487d6ae8f26634932bc832f10df Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 18 Apr 2013 19:46:08 -0700 Subject: CHUI-849 : WIP : Filter limit on time instead of number of items --- indra/newview/llfolderviewmodelinventory.cpp | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 1894314513..ce957edcbd 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -153,11 +153,11 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); - bool new_filtered_item = false; + bool continue_filtering = true; if (item->getLastFilterGeneration() < filter_generation) { // Recursive application of the filter for child items (CHUI-849) - new_filtered_item = item->filter( filter ); + continue_filtering = item->filter( filter ); } // Update latest generation to pass filter in parent and propagate up to root @@ -172,14 +172,13 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } } - return new_filtered_item; + return continue_filtering; } bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { const S32 filter_generation = filter.getCurrentGeneration(); const S32 must_pass_generation = filter.getFirstRequiredGeneration(); - const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation @@ -189,9 +188,11 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) // go ahead and flag this item as not pass setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); - return false; + return true; } + /* + const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); if (getLastFilterGeneration() >= sufficient_pass_generation && getLastFolderFilterGeneration() >= sufficient_pass_generation && passedFilter(sufficient_pass_generation)) @@ -202,23 +203,23 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) setPassedFolderFilter(true, filter_generation); return true; } + */ const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); - bool new_filtered_item = false; + bool continue_filtering = true; if (!mChildren.empty() && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement { // now query children - for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); - iter != end_iter && filter.getFilterCount() > 0; - ++iter) + for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter) { - new_filtered_item |= filterChildItem((*iter), filter); - if (filter.getFilterCount() <= 0) + continue_filtering = filterChildItem((*iter), filter); + //if (filter.getFilterCount() <= 0) + if (!continue_filtering) { break; } @@ -226,15 +227,17 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) } // If we didn't use all filter iterations that means we filtered all of our descendants so filter ourselves now - if (filter.getFilterCount() > 0) + //if (filter.getFilterCount() > 0) + if (continue_filtering) { // This is where filter count is hit and filter check on the item done (CHUI-849) - filter.decrementFilterCount(); + //filter.decrementFilterCount(); + filter.incrementFilterCount(); // Temp const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); - new_filtered_item |= passed_filter; + continue_filtering = !filter.isTimedOut(); } - return new_filtered_item; + return continue_filtering; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() -- cgit v1.2.3 From 2cc1fb250f78df3a4b8f33b13b30defef7efb78a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 19 Apr 2013 16:51:44 -0700 Subject: CHUI-849 : Use a time limit for filtering instead of number limit, use a different limit for visible and unvisible lists --- indra/newview/llfolderviewmodelinventory.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index ce957edcbd..4a51d26693 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -191,6 +191,7 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) return true; } + // *TODO : Revise the logic for fast pass on less restrictive filter case /* const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); if (getLastFilterGeneration() >= sufficient_pass_generation @@ -218,7 +219,6 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter) { continue_filtering = filterChildItem((*iter), filter); - //if (filter.getFilterCount() <= 0) if (!continue_filtering) { break; @@ -226,13 +226,10 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) } } - // If we didn't use all filter iterations that means we filtered all of our descendants so filter ourselves now - //if (filter.getFilterCount() > 0) + // If we didn't use all the filter time that means we filtered all of our descendants so we can filter ourselves now if (continue_filtering) { - // This is where filter count is hit and filter check on the item done (CHUI-849) - //filter.decrementFilterCount(); - filter.incrementFilterCount(); // Temp + // This is where filter check on the item done (CHUI-849) const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); continue_filtering = !filter.isTimedOut(); -- cgit v1.2.3 From f59af8d27c419d97596fff65fb9aa412499c52be Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 19 Apr 2013 19:02:21 -0700 Subject: CHUI-912 : Some clean up of vestigial debug code --- indra/newview/llfolderviewmodelinventory.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 4a51d26693..e2a6eb78c6 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -35,12 +35,6 @@ // class LLFolderViewModelInventory // static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); -static S32 sModelInstance = 0; - -LLFolderViewModelInventory::LLFolderViewModelInventory() -{ - mModelInstance = sModelInstance++; -} bool LLFolderViewModelInventory::startDrag(std::vector& items) { @@ -137,8 +131,9 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_gen { bool before = passedFilter(); LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); + bool after = passedFilter(); - if (before != passed) + if (before != after) { // Need to rearrange the folder if the filtered state of the item changed LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); -- cgit v1.2.3 From 022dd124604c8a0a3d83b481d03a687556fcf2c4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 22 Apr 2013 15:51:15 -0700 Subject: CHUI-912 : Fixed! Filtering with types do work correctly again (including None). --- indra/newview/llfolderviewmodelinventory.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index e2a6eb78c6..c28657dbcd 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -129,11 +129,11 @@ void LLFolderViewModelItemInventory::requestSort() void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { - bool before = passedFilter(); LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); - bool after = passedFilter(); + bool before = mPrevPassedAllFilters; + mPrevPassedAllFilters = passedFilter(filter_generation); - if (before != after) + if (before != mPrevPassedAllFilters) { // Need to rearrange the folder if the filtered state of the item changed LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); @@ -316,7 +316,8 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, } } -LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model ) - : LLFolderViewModelItemCommon(root_view_model) +LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model ) : + LLFolderViewModelItemCommon(root_view_model), + mPrevPassedAllFilters(false) { } -- cgit v1.2.3