diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-12-03 16:35:07 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-12-03 16:35:07 -0500 |
commit | 1320e5ddcd9fc3be526dcacbf4710f8bcf878665 (patch) | |
tree | e79afb0df339bce9a0898b4f6069a86aa6cfac49 /indra | |
parent | 940cde3938217daf348bd62f719cae262bad86b0 (diff) |
SH-4640 WIP - use backlinks in inventory
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.cpp | 40 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.h | 4 |
3 files changed, 7 insertions, 40 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4bce25c8b5..fbb276efd6 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1730,8 +1730,7 @@ BOOL LLItemBridge::removeItem() { if (!item->getIsLinkType()) { - LLInventoryModel::item_array_t item_array = - gInventory.collectLinksTo(mUUID, gInventory.getRootFolderID()); + LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); const U32 num_links = item_array.size(); if (num_links > 0) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 2c63203773..268cb7d8b2 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -687,8 +687,7 @@ void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask) if (!obj || obj->getIsLinkType()) return; - LLInventoryModel::item_array_t item_array = - collectLinksTo(object_id,gInventory.getRootFolderID()); + LLInventoryModel::item_array_t item_array = collectLinksTo(object_id); for (LLInventoryModel::item_array_t::iterator iter = item_array.begin(); iter != item_array.end(); iter++) @@ -716,56 +715,27 @@ LLViewerInventoryItem* LLInventoryModel::getLinkedItem(const LLUUID& object_id) return object_id.notNull() ? getItem(getLinkedItemID(object_id)) : NULL; } -LLInventoryModel::item_array_t LLInventoryModel::collectLinksTo(const LLUUID& id, - const LLUUID& start_folder_id) +LLInventoryModel::item_array_t LLInventoryModel::collectLinksTo(const LLUUID& id) { // Get item list via collectDescendents (slow!) item_array_t items; const LLInventoryObject *obj = getObject(id); - // FIXME - should be as below, but this is causing a stack-smashing crash of cause TBD... check in the REBUILD code. + // FIXME - should be as in next line, but this is causing a + // stack-smashing crash of cause TBD... check in the REBUILD code. //if (obj && obj->getIsLinkType()) if (!obj || obj->getIsLinkType()) return items; - LLInventoryModel::cat_array_t cat_array; - LLLinkedItemIDMatches is_linked_item_match(id); - collectDescendentsIf((start_folder_id == LLUUID::null ? gInventory.getRootFolderID() : start_folder_id), - cat_array, - items, - LLInventoryModel::INCLUDE_TRASH, - is_linked_item_match); - - // Get via backlinks - fast. - item_array_t fast_items; std::pair<backlink_mmap_t::iterator, backlink_mmap_t::iterator> range = mBacklinkMMap.equal_range(id); for (backlink_mmap_t::iterator it = range.first; it != range.second; ++it) { LLViewerInventoryItem *item = getItem(it->second); if (item) { - fast_items.put(item); + items.put(item); } } - // Validate equivalence. - if (items.size() != fast_items.size()) - { - llwarns << "size mismatch, " << items.size() << " != " << fast_items.size() << llendl; - } - for (item_array_t::iterator ita = items.begin(); ita != items.end(); ++ita) - { - if (fast_items.find(*ita) == item_array_t::FAIL) - { - llwarns << "in descendents search but not fast search " << (*ita)->getUUID() << llendl; - } - } - for (item_array_t::iterator itb = fast_items.begin(); itb != fast_items.end(); ++itb) - { - if (items.find(*itb) == item_array_t::FAIL) - { - llwarns << "in fast search but not descendents search " << (*itb)->getUUID() << llendl; - } - } return items; } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 0bb89bc5d4..1e18adf8d6 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -226,9 +226,7 @@ public: // Collect all items in inventory that are linked to item_id. // Assumes item_id is itself not a linked item. - item_array_t collectLinksTo(const LLUUID& item_id, - const LLUUID& start_folder_id = LLUUID::null); - + item_array_t collectLinksTo(const LLUUID& item_id); // Check if one object has a parent chain up to the category specified by UUID. BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const; |