SH-4640 WIP - use backlinks in inventory
parent
940cde3938
commit
1320e5ddcd
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue