From 9552f733ef0b581158665a1a464b5be7d4bada2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 31 May 2013 13:54:32 -0400 Subject: SH-3635 WIP --- indra/newview/llappearancemgr.cpp | 18 ++++++++++++++++++ indra/newview/llappearancemgr.h | 2 ++ indra/newview/llviewerregion.cpp | 2 +- indra/newview/llviewerstats.cpp | 40 ++++++++++++++------------------------- indra/newview/llviewerstats.h | 5 ++--- indra/newview/llvoavatar.cpp | 18 ++++++++++++------ indra/newview/llvoavatarself.cpp | 3 ++- 7 files changed, 51 insertions(+), 37 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 30b6169b46..2288f633f4 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -397,6 +397,12 @@ public: LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { addItems(src_items); + sInstanceCount++; + } + + ~LLCallAfterInventoryCopyMgr() + { + sInstanceCount--; } virtual bool requestOperation(const LLUUID& item_id) @@ -419,8 +425,15 @@ public: ); return true; } + + static S32 getInstanceCount() { return sInstanceCount; } + +private: + static S32 sInstanceCount; }; +S32 LLCallAfterInventoryCopyMgr::sInstanceCount = 0; + LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering, bool enforce_item_restrictions, bool enforce_ordering): @@ -2154,6 +2167,11 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool category->getUUID(), copy, append)); } +S32 LLAppearanceMgr::getActiveCopyOperations() const +{ + return LLCallAfterInventoryCopyMgr::getInstanceCount(); +} + void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append) { LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 3fb470ef14..4679ceaf57 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -71,6 +71,8 @@ public: LLInventoryModel::item_array_t& items_to_kill); void enforceCOFItemRestrictions(LLPointer cb); + S32 getActiveCopyOperations() const; + // Copy all items and the src category itself. void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, LLPointer cb); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e77b29aca4..b635087d66 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1877,7 +1877,7 @@ std::string LLViewerRegion::getCapability(const std::string& name) const { if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia"))) { - llwarns << "getCapability called before caps received" << llendl; + llwarns << "getCapability called before caps received for " << name << llendl; } CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index b73411080a..68633fba6e 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -734,44 +734,28 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } -LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) +LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); if (iter == mPhaseMap.end()) { - LLFrameTimer timer; + LLTimer timer; mPhaseMap[phase_name] = timer; } - LLFrameTimer& timer = mPhaseMap[phase_name]; + LLTimer& timer = mPhaseMap[phase_name]; return timer; } void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name) { - LLFrameTimer& timer = getPhaseTimer(phase_name); - lldebugs << "startPhase " << phase_name << llendl; - timer.unpause(); -} - -void LLViewerStats::PhaseMap::stopAllPhases() -{ - for (phase_map_t::iterator iter = mPhaseMap.begin(); - iter != mPhaseMap.end(); ++iter) - { - const std::string& phase_name = iter->first; - if (iter->second.getStarted()) - { - // Going from started to paused state - record stats. - recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); - } - lldebugs << "stopPhase (all) " << phase_name << llendl; - iter->second.pause(); - } + LLTimer& timer = getPhaseTimer(phase_name); + timer.start(); + LL_DEBUGS("Avatar") << "startPhase " << phase_name << llendl; } void LLViewerStats::PhaseMap::clearPhases() { - lldebugs << "clearPhases" << llendl; + LL_DEBUGS("Avatar") << "clearPhases" << llendl; mPhaseMap.clear(); } @@ -796,7 +780,6 @@ LLViewerStats::PhaseMap::PhaseMap() { } - void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); @@ -809,6 +792,7 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) } } } + // static LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) { @@ -832,14 +816,18 @@ void LLViewerStats::PhaseMap::recordPhaseStat(const std::string& phase_name, F32 bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); + bool found = false; if (iter != mPhaseMap.end()) { + found = true; elapsed = iter->second.getElapsedTimeF32(); completed = !iter->second.getStarted(); - return true; + LL_DEBUGS("Avatar") << " phase_name " << phase_name << " elapsed " << elapsed << " completed " << completed << " timer addr " << (S32)(&iter->second) << llendl; } else { - return false; + LL_DEBUGS("Avatar") << " phase_name " << phase_name << " NOT FOUND" << llendl; } + + return found; } diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 6b2461be41..eaa0b6beff 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -279,7 +279,7 @@ public: // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. - typedef std::map phase_map_t; + typedef std::map phase_map_t; typedef std::map phase_stats_t; class PhaseMap { @@ -288,11 +288,10 @@ public: static phase_stats_t sStats; public: PhaseMap(); - LLFrameTimer& getPhaseTimer(const std::string& phase_name); + LLTimer& getPhaseTimer(const std::string& phase_name); bool getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed); void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name); - void stopAllPhases(); void clearPhases(); LLSD dumpPhases(); static StatsAccumulator& getPhaseStats(const std::string& phase_name); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6df5fab42b..2cbdf93eeb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6013,9 +6013,12 @@ void LLVOAvatar::clearPhases() void LLVOAvatar::startPhase(const std::string& phase_name) { - F32 elapsed; - bool completed; - if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + F32 elapsed = 0.0; + bool completed = false; + bool found = getPhases().getPhaseValues(phase_name, elapsed, completed); + //LL_DEBUGS("Avatar") << avString() << " phase state " << phase_name + // << " found " << found << " elapsed " << elapsed << " completed " << completed << llendl; + if (found) { if (!completed) { @@ -6029,9 +6032,12 @@ void LLVOAvatar::startPhase(const std::string& phase_name) void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) { - F32 elapsed; - bool completed; - if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + F32 elapsed = 0.0; + bool completed = false; + bool found = getPhases().getPhaseValues(phase_name, elapsed, completed); + //LL_DEBUGS("Avatar") << avString() << " phase state " << phase_name + // << " found " << found << " elapsed " << elapsed << " completed " << completed << llendl; + if (found) { if (!completed) { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 5b6fcc5d27..b2fcfb6250 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -246,6 +246,8 @@ bool LLVOAvatarSelf::checkStuckAppearance() LL_DEBUGS("Avatar") << "change in progress for " << change_time << " seconds" << llendl; S32 active_hp = LLAppearanceMgr::instance().countActiveHoldingPatterns(); LL_DEBUGS("Avatar") << "active holding patterns " << active_hp << " seconds" << llendl; + S32 active_copies = LLAppearanceMgr::instance().getActiveCopyOperations(); + LL_DEBUGS("Avatar") << "active copy operations " << active_copies << llendl; } // Return false to continue running check periodically. @@ -2369,7 +2371,6 @@ LLSD summarize_by_buckets(std::vector in_records, void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() { - // gAgentAvatarp->stopAllPhases(); static volatile bool reporting_started(false); static volatile S32 report_sequence(0); -- cgit v1.2.3 From 02d2808a419ce37df877756883b96147d06aa4d8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 3 Jun 2013 13:21:42 -0400 Subject: SH-3635 WIP - unstick outfit change if stuck beyond a certain time range --- indra/newview/llvoavatarself.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b2fcfb6250..232bf3e478 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -239,6 +239,9 @@ void LLVOAvatarSelf::initInstance() bool LLVOAvatarSelf::checkStuckAppearance() { + const F32 CONDITIONAL_UNSTICK_INTERVAL = 300.0; + const F32 UNCONDITIONAL_UNSTICK_INTERVAL = 600.0; + if (gAgentWearables.isCOFChangeInProgress()) { LL_DEBUGS("Avatar") << "checking for stuck appearance" << llendl; @@ -248,6 +251,12 @@ bool LLVOAvatarSelf::checkStuckAppearance() LL_DEBUGS("Avatar") << "active holding patterns " << active_hp << " seconds" << llendl; S32 active_copies = LLAppearanceMgr::instance().getActiveCopyOperations(); LL_DEBUGS("Avatar") << "active copy operations " << active_copies << llendl; + + if ((change_time > CONDITIONAL_UNSTICK_INTERVAL && active_copies == 0) || + (change_time > UNCONDITIONAL_UNSTICK_INTERVAL)) + { + gAgentWearables.notifyLoadingFinished(); + } } // Return false to continue running check periodically. -- cgit v1.2.3 From 63940048eff9c9a1929574ba7581f4c835af35d3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 3 Jun 2013 17:09:25 -0400 Subject: SH-4166 WIP - COF-slammer infrastructure working for non-AIS case. --- indra/newview/llappearancemgr.cpp | 56 +++++++++++++++++++++++-------------- indra/newview/llappearancemgr.h | 2 -- indra/newview/llviewerinventory.cpp | 50 +++++++++++++++++++++++++++++++++ indra/newview/llviewerinventory.h | 7 +++++ 4 files changed, 92 insertions(+), 23 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2288f633f4..0c09689a70 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1622,25 +1622,6 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category, LLPointer cb) -{ - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - gInventory.collectDescendents(category, cats, items, - LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.count(); ++i) - { - LLViewerInventoryItem *item = items.get(i); - if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) - continue; - if (item->getIsLinkType()) - { - remove_inventory_item(item->getUUID(), cb); - } - } -} - // Keep the last N wearables of each type. For viewer 2.0, N is 1 for // both body parts and clothing items. void LLAppearanceMgr::filterWearableItems( @@ -1704,6 +1685,11 @@ void LLAppearanceMgr::removeAll(LLInventoryModel::item_array_t& items_to_kill, void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) { LLViewerInventoryCategory *pcat = gInventory.getCategory(category); + if (!pcat) + { + llwarns << "no category found for id " << category << llendl; + return; + } LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL; const LLUUID cof = getCOF(); @@ -1769,6 +1755,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // Will link all the above items. LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; +#if 0 linkAll(cof,all_items,link_waiter); // Add link to outfit if category is an outfit. @@ -1785,7 +1772,34 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // even in the non-append case, createBaseOutfitLink() already // deletes the existing link, don't need to do it again here. bool keep_outfit_links = true; - removeCategoryContents(cof, keep_outfit_links, link_waiter); + remove_folder_contents(cof, keep_outfit_links, link_waiter); +#else + LLSD contents = LLSD::emptyArray(); + for (LLInventoryModel::item_array_t::const_iterator it = all_items.begin(); + it != all_items.end(); ++it) + { + LLSD item_contents; + LLInventoryItem *item = *it; + item_contents["name"] = item->getName(); + item_contents["desc"] = item->getActualDescription(); + item_contents["linked_id"] = item->getLinkedUUID(); + item_contents["type"] = LLAssetType::AT_LINK; + contents.append(item_contents); + } + const LLUUID& base_id = append ? getBaseOutfitUUID() : category; + LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id); + if (base_cat) + { + LLSD base_contents; + base_contents["name"] = base_cat->getName(); + base_contents["desc"] = ""; + base_contents["linked_id"] = base_cat->getLinkedUUID(); + base_contents["type"] = LLAssetType::AT_LINK_FOLDER; + contents.append(base_contents); + } + llinfos << "slamming to: " << ll_pretty_print_sd(contents) << llendl; + slam_inventory_folder(getCOF(), contents, link_waiter); +#endif LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; } @@ -2776,7 +2790,7 @@ bool LLAppearanceMgr::updateBaseOutfit() updateClothingOrderingInfo(); // in a Base Outfit we do not remove items, only links - removeCategoryContents(base_outfit_id, false, NULL); + remove_folder_contents(base_outfit_id, false, NULL); LLPointer dirty_state_updater = new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 4679ceaf57..97f3283818 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -235,8 +235,6 @@ private: LLInventoryModel::item_array_t& obj_items, LLInventoryModel::item_array_t& gest_items); - void removeCategoryContents(const LLUUID& category, bool keep_outfit_links, - LLPointer cb); static void onOutfitRename(const LLSD& notification, const LLSD& response); void setOutfitLocked(bool locked); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 465a49d004..db8671d51b 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1828,6 +1828,54 @@ void create_new_item(const std::string& name, } +void slam_inventory_folder(const LLUUID& folder_id, + const LLSD& contents, + LLPointer cb) +{ + std::string cap; + if (AISCommand::getCap(cap)) + { + //LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); + //cmd_ptr->run_command(); + } + else // no cap + { + for (LLSD::array_const_iterator it = contents.beginArray(); + it != contents.endArray(); + ++it) + { + const LLSD& item_contents = *it; + link_inventory_item(gAgent.getID(), + item_contents["linked_id"].asUUID(), + folder_id, + item_contents["name"].asString(), + item_contents["desc"].asString(), + LLAssetType::EType(item_contents["type"].asInteger()), + cb); + } + remove_folder_contents(folder_id,false,cb); + } +} + +void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, + LLPointer cb) +{ + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(category, cats, items, + LLInventoryModel::EXCLUDE_TRASH); + for (S32 i = 0; i < items.count(); ++i) + { + LLViewerInventoryItem *item = items.get(i); + if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) + continue; + if (item->getIsLinkType()) + { + remove_inventory_item(item->getUUID(), cb); + } + } +} + const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) @@ -2263,3 +2311,5 @@ BOOL LLViewerInventoryItem::regenerateLink() gInventory.notifyObservers(); return TRUE; } + + diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index c52b0c2d9d..9af71dfc9c 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -407,4 +407,11 @@ void menu_create_inventory_item(LLInventoryPanel* root, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null); +void slam_inventory_folder(const LLUUID& folder_id, + const LLSD& contents, + LLPointer cb); + +void remove_folder_contents(const LLUUID& folder_id, bool keep_outfit_links, + LLPointer cb); + #endif // LL_LLVIEWERINVENTORY_H -- cgit v1.2.3 From f7c9739fd9bb4355765ecff4b92e879b38302e49 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Jun 2013 15:13:48 -0400 Subject: SH-3635 WIP - COF slammer works in AISv3 regions. Extensive rework of onAISUpdateReceived. --- indra/llcommon/llsdutil.cpp | 2 +- indra/llinventory/llinventory.cpp | 6 ++ indra/newview/llinventorymodel.cpp | 167 ++++++++++++++++++++++++++++++------ indra/newview/llinventorymodel.h | 2 +- indra/newview/llviewerinventory.cpp | 32 ++++++- 5 files changed, 179 insertions(+), 30 deletions(-) diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 803417d368..562fd26658 100755 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -182,7 +182,7 @@ char* ll_pretty_print_sd_ptr(const LLSD* sd) char* ll_pretty_print_sd(const LLSD& sd) { - const U32 bufferSize = 10 * 1024; + const U32 bufferSize = 100 * 1024; static char buffer[bufferSize]; std::ostringstream stream; //stream.rdbuf()->pubsetbuf(buffer, bufferSize); diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index a529aa3af3..77b837f8ac 100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -50,6 +50,7 @@ static const std::string INV_DESC_LABEL("desc"); static const std::string INV_PERMISSIONS_LABEL("permissions"); static const std::string INV_SHADOW_ID_LABEL("shadow_id"); static const std::string INV_ASSET_ID_LABEL("asset_id"); +static const std::string INV_LINKED_ID_LABEL("linked_id"); static const std::string INV_SALE_INFO_LABEL("sale_info"); static const std::string INV_FLAGS_LABEL("flags"); static const std::string INV_CREATION_DATE_LABEL("created_at"); @@ -1109,6 +1110,11 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd) { mAssetUUID = sd[w]; } + w = INV_LINKED_ID_LABEL; + if (sd.has(w)) + { + mAssetUUID = sd[w]; + } w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 38fa3c36e3..1a5e76183c 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1172,77 +1172,188 @@ void LLInventoryModel::onAISUpdateReceived(const std::string& context, const LLS { LL_DEBUGS("Inventory") << "ais update " << context << ":" << ll_pretty_print_sd(update) << llendl; + // Track changes to descendent counts for accounting. + std::map cat_deltas; + typedef std::map > deferred_item_map_t; + deferred_item_map_t items_created; + deferred_item_map_t items_updated; + std::set objects_deleted; + + // parse _categories_removed -> objects_deleted uuid_vec_t cat_ids; parse_llsd_uuid_array(update,"_categories_removed",cat_ids); for (uuid_vec_t::const_iterator it = cat_ids.begin(); it != cat_ids.end(); ++it) { - onObjectDeletedFromServer(*it, false); + LLViewerInventoryCategory *cat = getCategory(*it); + cat_deltas[cat->getParentUUID()]--; + objects_deleted.insert(*it); } + // parse _categories_items_removed -> objects_deleted uuid_vec_t item_ids; parse_llsd_uuid_array(update,"_category_items_removed",item_ids); for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it) { - onObjectDeletedFromServer(*it, false); + LLViewerInventoryItem *item = getItem(*it); + cat_deltas[item->getParentUUID()]--; + objects_deleted.insert(*it); } + // parse _broken_links_removed -> objects_deleted uuid_vec_t broken_link_ids; parse_llsd_uuid_array(update,"_broken_links_removed",broken_link_ids); for (uuid_vec_t::const_iterator it = broken_link_ids.begin(); it != broken_link_ids.end(); ++it) { - onObjectDeletedFromServer(*it, false); + LLViewerInventoryItem *item = getItem(*it); + cat_deltas[item->getParentUUID()]--; + objects_deleted.insert(*it); } - if (update.has("item_id")) + // parse _created_items + uuid_vec_t created_item_ids; + parse_llsd_uuid_array(update,"_created_items",created_item_ids); + + if (update.has("_embedded")) { - // item has been modified or possibly created (would be better if we could distinguish these cases directly) - LLUUID item_id = update["item_id"].asUUID(); - LLViewerInventoryItem *item = gInventory.getItem(item_id); - LLViewerInventoryCategory *cat = gInventory.getCategory(item_id); - if (item) + const LLSD& embedded = update["_embedded"]; + for(LLSD::map_const_iterator it = embedded.beginMap(), + end = embedded.endMap(); + it != end; ++it) { - LLSD changes; - if (update.has("name") && update["name"] != item->getName()) + const std::string& field = (*it).first; + + // parse created links + if (field == "link") { - changes["name"] = update["name"]; - } - if (update.has("desc") && update["desc"] != item->getActualDescription()) + const LLSD& links = embedded["link"]; + for(LLSD::map_const_iterator linkit = links.beginMap(), + linkend = links.endMap(); + linkit != linkend; ++linkit) + { + const LLUUID link_id((*linkit).first); + const LLSD& link_map = (*linkit).second; + uuid_vec_t::const_iterator pos = + std::find(created_item_ids.begin(), + created_item_ids.end(),link_id); + if (pos != created_item_ids.end()) + { + LLPointer new_link(new LLViewerInventoryItem); + BOOL rv = new_link->unpackMessage(link_map); + if (rv) + { + items_created[link_id] = new_link; + const LLUUID& parent_id = new_link->getParentUUID(); + cat_deltas[parent_id]++; + } + else + { + llwarns << "failed to unpack" << llendl; + } + } + else + { + LL_DEBUGS("Inventory") << "Ignoring link not in created items list " << link_id << llendl; + } + } + } + else { - changes["desc"] = update["desc"]; + llwarns << "unrecognized embedded field " << field << llendl; } - onItemUpdated(item_id,changes,true); } - else if (cat) + + } + + // Parse item update at the top level. + if (update.has("item_id")) + { + LLUUID item_id = update["item_id"].asUUID(); + LLPointer new_item(new LLViewerInventoryItem); + BOOL rv = new_item->unpackMessage(update); + if (rv) { - llerrs << "don't handle cat update yet" << llendl; + items_updated[item_id] = new_item; + // This statement is here to cause a new entry with 0 + // delta to be created if it does not already exist; + // otherwise has no effect. + cat_deltas[new_item->getParentUUID()]; } else { - llerrs << "don't handle creation case yet" << llendl; + llerrs << "unpack failed" << llendl; } - } + // Do descendent/version accounting. + // Can remove this if/when we use the version info directly. + for (std::map::const_iterator catit = cat_deltas.begin(); + catit != cat_deltas.end(); ++catit) + { + const LLUUID cat_id(catit->first); + S32 delta = catit->second; + LLInventoryModel::LLCategoryUpdate up(cat_id, delta); + gInventory.accountForUpdate(up); + } + // TODO - how can we use this version info? Need to be sure all // changes are going through AIS first, or at least through // something with a reliable responder. -#if 0 const std::string& ucv = "_updated_category_versions"; if (update.has(ucv)) { for(LLSD::map_const_iterator it = update[ucv].beginMap(), end = update[ucv].endMap(); - it != end; ++it) + it != end; ++it) { const LLUUID id((*it).first); S32 version = (*it).second.asInteger(); + LLViewerInventoryCategory *cat = gInventory.getCategory(id); + if (cat->getVersion() != version) + { + llwarns << "Possible version mismatch, viewer " << cat->getVersion() + << " server " << version << llendl; + } } } -#endif + + // CREATE ITEMS + for (deferred_item_map_t::const_iterator create_it = items_created.begin(); + create_it != items_created.end(); ++create_it) + { + LLUUID item_id(create_it->first); + LLPointer new_item = create_it->second; + + // FIXME risky function since it calls updateServer() in some + // cases. Maybe break out the update/create cases, in which + // case this is create. + LL_DEBUGS("Inventory") << "created item " << item_id << llendl; + gInventory.updateItem(new_item); + } + // UPDATE ITEMS + for (deferred_item_map_t::const_iterator update_it = items_updated.begin(); + update_it != items_updated.end(); ++update_it) + { + LLUUID item_id(update_it->first); + LLPointer new_item = update_it->second; + // FIXME risky function since it calls updateServer() in some + // cases. Maybe break out the update/create cases, in which + // case this is update. + LL_DEBUGS("Inventory") << "updated item " << item_id << llendl; + gInventory.updateItem(new_item); + } + + // DELETE OBJECTS + for (std::set::const_iterator del_it = objects_deleted.begin(); + del_it != objects_deleted.end(); ++del_it) + { + LL_DEBUGS("Inventory") << "deleted item " << *del_it << llendl; + onObjectDeletedFromServer(*del_it, false, false); + } + } void LLInventoryModel::onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version) @@ -1395,7 +1506,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo // Update model after an item is confirmed as removed from // server. Works for categories or items. -void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool fix_broken_links) +void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool fix_broken_links, bool update_parent_version) { LLPointer obj = getObject(object_id); if(obj) @@ -1406,9 +1517,13 @@ void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool f onDescendentsPurgedFromServer(object_id, fix_broken_links); } + // From item/cat removeFromServer() - LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); - accountForUpdate(up); + if (update_parent_version) + { + LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); + accountForUpdate(up); + } // From purgeObject() LLPreview::hide(object_id); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index fd2481b531..a41a824906 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -334,7 +334,7 @@ public: // Update model after an item is confirmed as removed from // server. Works for categories or items. - void onObjectDeletedFromServer(const LLUUID& item_id, bool fix_broken_links = true); + void onObjectDeletedFromServer(const LLUUID& item_id, bool fix_broken_links = true, bool update_parent_version = true); // Update model after all descendents removed from server. void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index db8671d51b..0608c46051 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -493,6 +493,34 @@ private: LLSD mUpdates; }; +class SlamFolderCommand: public AISCommand +{ +public: + SlamFolderCommand(const LLUUID& folder_id, const LLSD& contents, LLPointer callback): + mContents(contents), + AISCommand(callback) + { + std::string cap; + if (!getCap(cap)) + { + llwarns << "No cap found" << llendl; + return; + } + LLUUID tid; + tid.generate(); + std::string url = cap + std::string("/category/") + folder_id.asString() + "/links?tid=" + tid.asString(); + llinfos << url << llendl; + LLCurl::ResponderPtr responder = this; + LLSD headers; + headers["Content-Type"] = "application/llsd+xml"; + F32 timeout = HTTP_REQUEST_EXPIRY_SECS; + command_func_type cmd = boost::bind(&LLHTTPClient::put, url, mContents, responder, headers, timeout); + setCommandFunc(cmd); + } +private: + LLSD mContents; +}; + ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- @@ -1835,8 +1863,8 @@ void slam_inventory_folder(const LLUUID& folder_id, std::string cap; if (AISCommand::getCap(cap)) { - //LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); - //cmd_ptr->run_command(); + LLPointer cmd_ptr = new SlamFolderCommand(folder_id, contents, cb); + cmd_ptr->run_command(); } else // no cap { -- cgit v1.2.3 From ca806315a98627b29a4933cbf8b27431ca43dd0f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Jun 2013 15:52:44 -0400 Subject: SH-3635 WIP - logging cleanup, moved some big dumps into separate XML files --- indra/newview/llappearancemgr.cpp | 18 ++++++------------ indra/newview/llinventorymodel.cpp | 5 ++++- indra/newview/llvoavatar.cpp | 9 +++++++++ indra/newview/llvoavatar.h | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0c09689a70..646b2d18dd 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1797,7 +1797,10 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) base_contents["type"] = LLAssetType::AT_LINK_FOLDER; contents.append(base_contents); } - llinfos << "slamming to: " << ll_pretty_print_sd(contents) << llendl; + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + dump_sequential_xml(gAgentAvatarp->getFullname() + "_slam_request", contents); + } slam_inventory_folder(getCOF(), contents, link_waiter); #endif @@ -2950,7 +2953,7 @@ protected: //LL_DEBUGS("Avatar") << dumpResponse() << LL_ENDL; if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_ok", content); + dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", content); } } else @@ -2968,7 +2971,7 @@ protected: if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { const LLSD& content = getContent(); - dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_error", content); + dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_error", content); debugCOF(content); } onFailure(); @@ -2992,15 +2995,6 @@ protected: } } - void dumpContents(const std::string outprefix, const LLSD& content) - { - std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); - std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); - std::ofstream ofs(fullpath.c_str(), std::ios_base::out); - ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); - LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; - } - void debugCOF(const LLSD& content) { LL_INFOS("Avatar") << "AIS COF, version received: " << content["expected"].asInteger() diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 1a5e76183c..c0c48d6695 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1170,7 +1170,10 @@ void parse_llsd_uuid_array(const LLSD& content, const std::string& name, uuid_ve void LLInventoryModel::onAISUpdateReceived(const std::string& context, const LLSD& update) { - LL_DEBUGS("Inventory") << "ais update " << context << ":" << ll_pretty_print_sd(update) << llendl; + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + dump_sequential_xml(gAgentAvatarp->getFullname() + "_ais_update", update); + } // Track changes to descendent counts for accounting. std::map cat_deltas; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 2cbdf93eeb..1dbcabf2b3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7416,6 +7416,15 @@ std::string get_sequential_numbered_file_name(const std::string& prefix, return outfilename; } +void dump_sequential_xml(const std::string outprefix, const LLSD& content) +{ + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + std::ofstream ofs(fullpath.c_str(), std::ios_base::out); + ofs << LLSDOStreamer(content, LLSDFormatter::OPTIONS_PRETTY); + LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL; +} + void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_wearables ) { std::string outprefix(prefix); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 19ad49d3a1..fad2fd962c 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -998,6 +998,7 @@ extern const S32 MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL; std::string get_sequential_numbered_file_name(const std::string& prefix, const std::string& suffix); +void dump_sequential_xml(const std::string outprefix, const LLSD& content); void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); #endif // LL_VOAVATAR_H -- cgit v1.2.3