summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2015-06-09 15:41:11 -0700
committerMerov Linden <merov@lindenlab.com>2015-06-09 15:41:11 -0700
commit2cc3ce72b3f7abf037e554b04850e627a9d8eb5f (patch)
treea5247d04bb2f951c61d2db535d28835c8d5a77d2 /indra/newview
parent4f9bf22d5fc473aa15dc7f298a93b89ddc30f415 (diff)
DD-359 : Improve performance by caching display data while updating and preventing refreshing the whole marketplace (never useful)
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llinventorybridge.cpp31
-rwxr-xr-xindra/newview/llinventorybridge.h6
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp13
3 files changed, 38 insertions, 12 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 4a82cb5eac..521eefe583 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -203,7 +203,6 @@ const std::string& LLInvFVBridge::getDisplayName() const
{
buildDisplayName();
}
-
return mDisplayName;
}
@@ -4292,6 +4291,14 @@ void LLFolderBridge::modifyOutfit(BOOL append)
// +=================================================+
// LLMarketplaceFolderBridge is a specialized LLFolderBridge for use in Marketplace Inventory panels
+LLMarketplaceFolderBridge::LLMarketplaceFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+LLFolderBridge(inventory, root, uuid)
+{
+ m_depth = depth_nesting_in_marketplace(mUUID);
+ m_stockCountCache = COMPUTE_STOCK_NOT_EVALUATED;
+}
LLUIImagePtr LLMarketplaceFolderBridge::getIcon() const
{
@@ -4306,8 +4313,12 @@ LLUIImagePtr LLMarketplaceFolderBridge::getIconOpen() const
LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(BOOL is_open) const
{
LLFolderType::EType preferred_type = getPreferredType();
- S32 depth = depth_nesting_in_marketplace(mUUID);
- if ((preferred_type == LLFolderType::FT_NONE) && (depth == 2))
+ if (!LLMarketplaceData::instance().isUpdating(getUUID()))
+ {
+ // Skip computation (expensive) if we're waiting for updates. Use the old value in that case.
+ m_depth = depth_nesting_in_marketplace(mUUID);
+ }
+ if ((preferred_type == LLFolderType::FT_NONE) && (m_depth == 2))
{
// We override the type when in the marketplace listings folder and only for version folder
preferred_type = LLFolderType::FT_MARKETPLACE_VERSION;
@@ -4345,12 +4356,16 @@ std::string LLMarketplaceFolderBridge::getLabelSuffix() const
suffix += " (" + LLTrans::getString("MarketplaceActive") + ")";
}
// Add stock amount
- S32 stock_count = compute_stock_count(getUUID());
- if (stock_count == 0)
+ if (!LLMarketplaceData::instance().isUpdating(getUUID()))
+ {
+ // Skip computation (expensive) if we're waiting for update anyway. Use the old value in that case.
+ m_stockCountCache = compute_stock_count(getUUID());
+ }
+ if (m_stockCountCache == 0)
{
suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")";
}
- else if (stock_count != COMPUTE_STOCK_INFINITE)
+ else if (m_stockCountCache != COMPUTE_STOCK_INFINITE)
{
if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)
{
@@ -4360,13 +4375,13 @@ std::string LLMarketplaceFolderBridge::getLabelSuffix() const
{
suffix += " (" + LLTrans::getString("MarketplaceMax");
}
- if (stock_count == COMPUTE_STOCK_NOT_EVALUATED)
+ if (m_stockCountCache == COMPUTE_STOCK_NOT_EVALUATED)
{
suffix += "=" + LLTrans::getString("MarketplaceUpdating") + ")";
}
else
{
- suffix += "=" + llformat("%d", stock_count) + ")";
+ suffix += "=" + llformat("%d", m_stockCountCache) + ")";
}
}
// Add updating suffix
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 6d027ae115..26f8dd37b4 100755
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -697,8 +697,7 @@ public:
// Overloads some display related methods specific to folders in a marketplace floater context
LLMarketplaceFolderBridge(LLInventoryPanel* inventory,
LLFolderView* root,
- const LLUUID& uuid) :
- LLFolderBridge(inventory, root, uuid) { }
+ const LLUUID& uuid);
virtual LLUIImagePtr getIcon() const;
virtual LLUIImagePtr getIconOpen() const;
@@ -707,6 +706,9 @@ public:
private:
LLUIImagePtr getMarketplaceFolderIcon(BOOL is_open) const;
+ // Those members are mutable because they are cached variablse to speed up display, not a state variables
+ mutable S32 m_depth;
+ mutable S32 m_stockCountCache;
};
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 4feb697af9..e245fd2d59 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2576,6 +2576,7 @@ void LLInventoryAction::buildMarketplaceFolders(LLFolderView* root)
// containing folder will need to be updated as well as their initially containing folder. For
// instance, moving a stock folder from a listed folder to another will require an update of the
// target listing *and* the original listing. So we need to keep track of both.
+ // Note: do not however put the marketplace listings root itself in this list or the whole marketplace data will be rebuilt.
sMarketplaceFolders.clear();
const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
@@ -2586,8 +2587,16 @@ void LLInventoryAction::buildMarketplaceFolders(LLFolderView* root)
viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem());
if (viewModel && gInventory.isObjectDescendentOf(viewModel->getInventoryObject()->getParentUUID(), marketplacelistings_id))
{
- sMarketplaceFolders.push_back(viewModel->getInventoryObject()->getParentUUID());
- sMarketplaceFolders.push_back(viewModel->getInventoryObject()->getUUID());
+ const LLUUID &parent_id = viewModel->getInventoryObject()->getParentUUID();
+ if (parent_id != marketplacelistings_id)
+ {
+ sMarketplaceFolders.push_back(parent_id);
+ }
+ const LLUUID &curr_id = viewModel->getInventoryObject()->getUUID();
+ if (curr_id != marketplacelistings_id)
+ {
+ sMarketplaceFolders.push_back(curr_id);
+ }
}
}
// Suppress dupes in the list so we won't update listings twice