diff options
author | Merov Linden <merov@lindenlab.com> | 2014-08-25 11:30:46 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-08-25 11:30:46 -0700 |
commit | 2631d6f81717a0f6be0e5adba58ddddcd826b721 (patch) | |
tree | 220ac9c07856b3eff27b871ae8519a34f9649d55 | |
parent | 85ec32c05e3474e55db142489f91e978df319951 (diff) |
DD-105 : WIP : Use one single mechanism for marking folders being updated by SLM
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 11 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 44 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 2 |
3 files changed, 43 insertions, 14 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8833d72dfa..55333923f9 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -175,8 +175,17 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc // Update all descendents starting from the listing root update_marketplace_folder_hierarchy(listing_uuid); } - else if (depth < 0) + else if (depth == 0) { + // If this is the marketplace listings root itself, update all descendents + if (gInventory.getCategory(cur_uuid)) + { + update_marketplace_folder_hierarchy(cur_uuid); + } + } + else + { + // If the folder is outside the marletplace listings root, clear its SLM data if needs be if (perform_consistency_enforcement && LLMarketplaceData::instance().isListed(cur_uuid)) { LL_INFOS("SLM") << "Disassociate as the listing folder is not under the marketplace folder anymore!!" << LL_ENDL; diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 17b8ec746f..9457884cf4 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -167,12 +167,15 @@ class LLSLMGetListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMGetListingsResponder); public: - LLSLMGetListingsResponder() {} + LLSLMGetListingsResponder(const LLUUID& folder_id) + { + mExpectedFolderId = folder_id; + } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - LLMarketplaceData::instance().setUpdating(false); + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); if (!isGoodStatus()) { @@ -217,7 +220,13 @@ public: } it++; } + + // Update all folders under the root + update_marketplace_category(mExpectedFolderId, false); + gInventory.notifyObservers(); } +private: + LLUUID mExpectedFolderId; }; class LLSLMCreateListingsResponder : public LLHTTPClient::Responder @@ -1072,8 +1081,7 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, LLMarketplaceData::LLMarketplaceData() : mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), mStatusUpdatedSignal(NULL), - mDirtyCount(false), - mIsUpdating(false) + mDirtyCount(false) { mInventoryObserver = new LLMarketplaceInventoryObserver; gInventory.addObserver(mInventoryObserver); @@ -1108,8 +1116,9 @@ void LLMarketplaceData::getSLMListings() // Send request std::string url = getSLMConnectURL("/listings"); log_SLM_infos("LLHTTPClient::get", url, ""); - setUpdating(true); - LLHTTPClient::get(url, new LLSLMGetListingsResponder(), headers); + const LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + setUpdating(marketplacelistings_id,true); + LLHTTPClient::get(url, new LLSLMGetListingsResponder(marketplacelistings_id), headers); } void LLMarketplaceData::getSLMListing(S32 listing_id) @@ -1511,15 +1520,28 @@ LLUUID LLMarketplaceData::getActiveFolder(const LLUUID& obj_id) bool LLMarketplaceData::isUpdating(const LLUUID& folder_id) { - if (mIsUpdating) + S32 depth = depth_nesting_in_marketplace(folder_id); + if ((depth <= 0) || (depth > 2)) { - // If we're waiting for data for all listings, we are in the updating process - return true; + // Only listing and version folders though are concerned by that status + return false; } else { - std::set<LLUUID>::iterator it = mPendingUpdateSet.find(folder_id); - return (it != mPendingUpdateSet.end()); + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + std::set<LLUUID>::iterator it = mPendingUpdateSet.find(marketplace_listings_uuid); + if (it != mPendingUpdateSet.end()) + { + // If we're waiting for data for the marketplace listings root, we are in the updating process for all + return true; + } + else + { + // Check if the listing folder is waiting or data + LLUUID listing_uuid = nested_parent_id(folder_id, depth); + it = mPendingUpdateSet.find(listing_uuid); + return (it != mPendingUpdateSet.end()); + } } } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 1614b610a6..e087139a3d 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -213,7 +213,6 @@ public: // Used to flag if stock count values for Marketplace have to be updated bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } } void setDirtyCount() { mDirtyCount = true; } - void setUpdating(bool isUpdating) { mIsUpdating = isUpdating; } void setUpdating(const LLUUID& folder_id, bool isUpdating); private: @@ -242,7 +241,6 @@ private: bool mDirtyCount; // If true, stock count value need to be updated at the next check // Update data - bool mIsUpdating; // true if we're globally waiting for updated values from SLM std::set<LLUUID> mPendingUpdateSet; // The cache of SLM data (at last...) |