diff options
author | Merov Linden <merov@lindenlab.com> | 2015-06-08 14:58:40 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-06-08 14:58:40 -0700 |
commit | 4f9bf22d5fc473aa15dc7f298a93b89ddc30f415 (patch) | |
tree | 8f76091d4f5d43319cdc3a93b85a34a4747f5d2f /indra/newview/llmarketplacefunctions.cpp | |
parent | b0e75cc153d6ec18d8987a5322767b548f29926f (diff) |
DD-336, DD-359 : WIP : Introduced a reverse lookup table for version folder to listing folder to improve performance
Diffstat (limited to 'indra/newview/llmarketplacefunctions.cpp')
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index e15014e6b9..3fec9e0da7 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1665,16 +1665,23 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed); mMarketplaceItems[folder_id].mEditURL = edit_url; mMarketplaceItems[folder_id].mCountOnHand = count; + if (version_id.notNull()) + { + mVersionFolders[version_id] = folder_id; + } return true; } bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update) { + LLUUID version_folder = getVersionFolder(folder_id); + if (mMarketplaceItems.erase(folder_id) != 1) { return false; } - + mVersionFolders.erase(version_folder); + if (update) { update_marketplace_category(folder_id, false); @@ -1698,20 +1705,20 @@ bool LLMarketplaceData::deleteListing(S32 listing_id, bool update) bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) { // Listing folder case - if (isListed(folder_id)) + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it != mMarketplaceItems.end()) { - marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); return (it->second).mIsActive; } - // We need to iterate through the list to check it's not a version folder - marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); - while (it != mMarketplaceItems.end()) + // Version folder case + version_folders_list_t::iterator it_version = mVersionFolders.find(folder_id); + if (it_version != mVersionFolders.end()) { - if ((it->second).mVersionFolderId == folder_id) + marketplace_items_list_t::iterator it = mMarketplaceItems.find(it_version->second); + if (it != mMarketplaceItems.end()) { return (it->second).mIsActive; } - it++; } return false; } @@ -1771,16 +1778,8 @@ bool LLMarketplaceData::isListedAndActive(const LLUUID& folder_id) bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) { - marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); - while (it != mMarketplaceItems.end()) - { - if ((it->second).mVersionFolderId == folder_id) - { - return true; - } - it++; - } - return false; + version_folders_list_t::iterator it = mVersionFolders.find(folder_id); + return (it != mVersionFolders.end()); } bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id) @@ -1908,6 +1907,11 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID } (it->second).mVersionFolderId = version_id; + mVersionFolders.erase(old_version_id); + if (version_id.notNull()) + { + mVersionFolders[version_id] = folder_id; + } if (update) { |