diff options
| author | Loren Shih <seraph@lindenlab.com> | 2010-04-06 14:47:20 -0400 | 
|---|---|---|
| committer | Loren Shih <seraph@lindenlab.com> | 2010-04-06 14:47:20 -0400 | 
| commit | cdbdb1168694bcbfc58208f2941f513b556a0d6e (patch) | |
| tree | 3b024976b8254c11ecb2a11db8929ff035cff446 /indra | |
| parent | ec5bd9c857b4d817685b09f9a10da7434ebbb816 (diff) | |
EXT-4151 : Immediately check if a fetchObserver filter is done, else add to observer list automatically
FetchObservers now take in a list of IDs to check against.
Made some naming changes.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llagentwearables.cpp | 21 | ||||
| -rw-r--r-- | indra/newview/llagentwearablesfetch.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/llagentwearablesfetch.h | 4 | ||||
| -rw-r--r-- | indra/newview/llappearancemgr.h | 17 | ||||
| -rw-r--r-- | indra/newview/llfloatergesture.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llfriendcard.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llgesturemgr.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llgesturemgr.h | 2 | ||||
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/llinventoryobserver.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llinventoryobserver.h | 78 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llsidepanelappearance.cpp | 12 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llviewermessage.cpp | 29 | 
17 files changed, 187 insertions, 144 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 9d3b5763e8..bc8931827e 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -905,8 +905,9 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs  		// Get the UUID of the current outfit folder (will be created if it doesn't exist)  		const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); -		 -		LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(); +		uuid_vec_t folders; +		folders.push_back(current_outfit_id); +		LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(folders);  		//lldebugs << "processAgentInitialWearablesUpdate()" << llendl;  		// Add wearables @@ -952,9 +953,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs  		// Get the complete information on the items in the inventory and set up an observer  		// that will trigger when the complete information is fetched. -		uuid_vec_t folders; -		folders.push_back(current_outfit_id); -		outfit->fetch(folders); +		outfit->startFetch();  		if(outfit->isEverythingComplete())  		{  			// everything is already here - call done. @@ -2061,16 +2060,16 @@ void LLAgentWearables::populateMyOutfitsFolder(void)  {	  	llinfos << "starting outfit population" << llendl; -	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(); +	const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); +	uuid_vec_t folders; +	folders.push_back(my_outfits_id); +	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(folders); +	outfits->mMyOutfitsID = my_outfits_id;  	// Get the complete information on the items in the inventory and   	// setup an observer that will wait for that to happen. -	uuid_vec_t folders; -	outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - -	folders.push_back(outfits->mMyOutfitsID);  	gInventory.addObserver(outfits); -	outfits->fetch(folders); +	outfits->startFetch();  	if (outfits->isEverythingComplete())  	{  		outfits->done(); diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 3d6740f5a1..6b7edaa302 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -39,7 +39,8 @@  #include "llinventoryfunctions.h"  #include "llvoavatarself.h" -LLInitialWearablesFetch::LLInitialWearablesFetch() +LLInitialWearablesFetch::LLInitialWearablesFetch(const uuid_vec_t& ids) : +	LLInventoryFetchDescendentsObserver(ids)  {  } @@ -86,12 +87,11 @@ void LLInitialWearablesFetch::processContents()  	delete this;  } -class LLFetchAndLinkObserver: public LLInventoryFetchObserver +class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver  {  public:  	LLFetchAndLinkObserver(uuid_vec_t& ids): -		m_ids(ids), -		LLInventoryFetchObserver(true) // retry for missing items +		LLInventoryFetchItemsObserver(ids, true) // retry for missing items  	{  	}  	~LLFetchAndLinkObserver() @@ -103,8 +103,8 @@ public:  		// Link to all fetched items in COF.  		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; -		for (uuid_vec_t::iterator it = m_ids.begin(); -			 it != m_ids.end(); +		for (uuid_vec_t::iterator it = mIDs.begin(); +			 it != mIDs.end();  			 ++it)  		{  			LLUUID id = *it; @@ -123,8 +123,6 @@ public:  								link_waiter);  		}  	} -private: -	uuid_vec_t m_ids;  };  void LLInitialWearablesFetch::processWearablesMessage() @@ -173,9 +171,9 @@ void LLInitialWearablesFetch::processWearablesMessage()  		// Need to fetch the inventory items for ids, then create links to them after they arrive.  		LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); -		fetcher->fetch(ids); +		fetcher->startFetch();  		// If no items to be fetched, done will never be triggered. -		// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. +		// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.  		if (fetcher->isEverythingComplete())  		{  			fetcher->done(); @@ -191,7 +189,8 @@ void LLInitialWearablesFetch::processWearablesMessage()  	}  } -LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() :  +LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const uuid_vec_t& ids) :  +	LLInventoryFetchDescendentsObserver(ids),  	mCurrFetchStep(LOFS_FOLDER),   	mOutfitsPopulated(false)   { @@ -288,7 +287,8 @@ void LLLibraryOutfitsFetch::folderDone()  	uuid_vec_t folders;  	folders.push_back(mClothingID);  	folders.push_back(mLibraryClothingID); -	fetch(folders); +	setFolders(folders); +	startFetch();  	if (isEverythingComplete())  	{  		done(); @@ -337,8 +337,8 @@ void LLLibraryOutfitsFetch::outfitsDone()  	}  	mComplete.clear(); -	 -	fetch(folders); +	setFolders(folders); +	startFetch();  	if (isEverythingComplete())  	{  		done(); @@ -434,8 +434,8 @@ void LLLibraryOutfitsFetch::importedFolderFetch()  	folders.push_back(mImportedClothingID);  	mComplete.clear(); -	 -	fetch(folders); +	setFolders(folders); +	startFetch();  	if (isEverythingComplete())  	{  		done(); @@ -464,7 +464,8 @@ void LLLibraryOutfitsFetch::importedFolderDone()  	}  	mComplete.clear(); -	fetch(folders); +	setFolders(folders); +	startFetch();  	if (isEverythingComplete())  	{  		done(); diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h index 1d0c6739ba..33368811c0 100644 --- a/indra/newview/llagentwearablesfetch.h +++ b/indra/newview/llagentwearablesfetch.h @@ -47,7 +47,7 @@  class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver  {  public: -	LLInitialWearablesFetch(); +	LLInitialWearablesFetch(const uuid_vec_t& ids);  	~LLInitialWearablesFetch();  	virtual void done(); @@ -92,7 +92,7 @@ public:  		LOFS_CONTENTS  	}; -	LLLibraryOutfitsFetch(); +	LLLibraryOutfitsFetch(const uuid_vec_t& ids);  	~LLLibraryOutfitsFetch();  	virtual void done(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 40b8844731..1cf8d584db 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -244,10 +244,12 @@ void doOnIdleRepeating(T callable)  }  template <class T> -class CallAfterCategoryFetchStage2: public LLInventoryFetchObserver +class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver  {  public: -	CallAfterCategoryFetchStage2(T callable): +	CallAfterCategoryFetchStage2(const uuid_vec_t& ids, +								 T callable) : +		LLInventoryFetchItemsObserver(ids),  		mCallable(callable)  	{  	} @@ -268,7 +270,8 @@ template <class T>  class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver  {  public: -	CallAfterCategoryFetchStage1(T callable): +	CallAfterCategoryFetchStage1(const uuid_vec_t& ids, T callable) : +		LLInventoryFetchDescendentsObserver(ids),  		mCallable(callable)  	{  	} @@ -297,7 +300,6 @@ public:  			return;  		} -		CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(mCallable);  		uuid_vec_t ids;  		for(S32 i = 0; i < count; ++i)  		{ @@ -307,7 +309,8 @@ public:  		gInventory.removeObserver(this);  		// do the fetch -		stage2->fetch(ids); +		CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(ids, mCallable); +		stage2->startFetch();  		if(stage2->isEverythingComplete())  		{  			// everything is already here - call done. @@ -328,10 +331,10 @@ protected:  template <class T>   void callAfterCategoryFetch(const LLUUID& cat_id, T callable)  { -	CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable);  	uuid_vec_t folders;  	folders.push_back(cat_id); -	stage1->fetch(folders); +	CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(folders, callable); +	stage1->startFetch();  	if (stage1->isEverythingComplete())  	{  		stage1->done(); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 8ee8d13a9c..04fb6bca3c 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -148,7 +148,8 @@ void LLFloaterGesture::done()  		if (!unloaded_folders.empty())  		{  			LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL; -			fetch(unloaded_folders); +			setFolders(unloaded_folders); +			startFetch();  		}  		else  		{ @@ -202,7 +203,8 @@ BOOL LLFloaterGesture::postBuild()  	folders.push_back(mGestureFolderID);  	//perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.  	gInventory.addObserver(this); -	fetch(folders); +	setFolders(folders); +	startFetch();  	if (mGestureList)  	{ diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 6f069cca17..aaa09ba5da 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -111,8 +111,11 @@ class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver  public:  	typedef boost::function<void()> callback_t; -	LLInitialFriendCardsFetch(callback_t cb) -		:	mCheckFolderCallback(cb)	{} +	LLInitialFriendCardsFetch(const uuid_vec_t& ids, +							  callback_t cb) : +		LLInventoryFetchDescendentsObserver(ids), +		mCheckFolderCallback(cb)	 +	{}  	/* virtual */ void done(); @@ -407,13 +410,11 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve  void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_id,  callback_t cb)  { -	// This instance will be deleted in LLInitialFriendCardsFetch::done(). -	LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(cb); -  	uuid_vec_t folders;  	folders.push_back(folder_id); - -	fetch->fetch(folders); +	// This instance will be deleted in LLInitialFriendCardsFetch::done(). +	LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folders, cb); +	fetch->startFetch();  	if(fetch->isEverythingComplete())  	{  		// everything is already here - call done. diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index a4342a4bc9..034806acfc 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -100,7 +100,7 @@ void LLGestureMgr::init()  void LLGestureMgr::changed(U32 mask)   {  -	LLInventoryFetchObserver::changed(mask); +	LLInventoryFetchItemsObserver::changed(mask);  	if (mask & LLInventoryObserver::GESTURE)  	{ @@ -1033,7 +1033,8 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,  				// Watch this item and set gesture name when item exists in inventory  				uuid_vec_t ids;  				ids.push_back(item_id); -				self.fetch(ids); +				self.setItems(ids); +				self.startFetch();  			}  			self.mActive[item_id] = gesture; diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 081ca983a9..5f2c3e2d61 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -54,7 +54,7 @@ public:  	virtual void changed() = 0;  }; -class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchObserver +class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchItemsObserver  {  public: diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b552b5ac07..82043ab523 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1933,13 +1933,17 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,  }  //Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver +class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver  {  public: -	LLRightClickInventoryFetchObserver() : +	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : +		LLInventoryFetchItemsObserver(ids),  		mCopyItems(false)  	{ }; -	LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) : +	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids, +									   const LLUUID& cat_id,  +									   bool copy_items) : +		LLInventoryFetchItemsObserver(ids),  		mCatID(cat_id),  		mCopyItems(copy_items)  	{ }; @@ -1963,7 +1967,11 @@ protected:  class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver  {  public: -	LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {} +	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, +												  bool copy_items) :  +		LLInventoryFetchDescendentsObserver(ids), +		mCopyItems(copy_items)  +	{}  	~LLRightClickInventoryFetchDescendentsObserver() {}  	virtual void done();  protected: @@ -2006,14 +2014,14 @@ void LLRightClickInventoryFetchDescendentsObserver::done()  	}  #endif -	LLRightClickInventoryFetchObserver* outfit; -	outfit = new LLRightClickInventoryFetchObserver(mComplete.front(), mCopyItems);  	uuid_vec_t ids;  	for(S32 i = 0; i < count; ++i)  	{  		ids.push_back(item_array.get(i)->getUUID());  	} +	LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems); +  	// clean up, and remove this as an observer since the call to the  	// outfit could notify observers and throw us into an infinite  	// loop. @@ -2026,7 +2034,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()  	inc_busy_count();  	// do the fetch -	outfit->fetch(ids); +	outfit->startFetch();  	outfit->done();				//Not interested in waiting and this will be right 99% of the time.  //Uncomment the following code for laggy Inventory UI.  /*	if(outfit->isEverythingComplete()) @@ -2715,7 +2723,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  		mMenu = &menu;  		sSelf = this; -		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE); +  		uuid_vec_t folders;  		LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); @@ -2723,7 +2731,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  		{  			folders.push_back(category->getUUID());  		} -		fetch->fetch(folders); +		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); +		fetch->startFetch();  		inc_busy_count();  		if(fetch->isEverythingComplete())  		{ diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 83e1bbd5a0..0f8d76a4cc 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -108,12 +108,19 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)  	}  } -LLInventoryFetchObserver::LLInventoryFetchObserver(bool retry_if_missing) : +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(bool retry_if_missing) :  	mRetryIfMissing(retry_if_missing)  {  } -void LLInventoryFetchObserver::changed(U32 mask) +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& ids, +															 bool retry_if_missing) : +	mIDs(ids), +	mRetryIfMissing(retry_if_missing) +{ +} + +void LLInventoryFetchItemsObserver::changed(U32 mask)  {  	// scan through the incomplete items and move or erase them as  	// appropriate. @@ -153,11 +160,11 @@ void LLInventoryFetchObserver::changed(U32 mask)  			done();  		}  	} -	//llinfos << "LLInventoryFetchObserver::changed() mComplete size " << mComplete.size() << llendl; -	//llinfos << "LLInventoryFetchObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; +	//llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl; +	//llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl;  } -bool LLInventoryFetchObserver::isEverythingComplete() const +bool LLInventoryFetchItemsObserver::isEverythingComplete() const  {  	return mIncomplete.empty();  } @@ -223,11 +230,11 @@ void fetch_items_from_llsd(const LLSD& items_llsd)  	}  } -void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids) +void LLInventoryFetchItemsObserver::startFetch()  {  	LLUUID owner_id;  	LLSD items_llsd; -	for(uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); ++it) +	for(uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)  	{  		LLViewerInventoryItem* item = gInventory.getItem(*it);  		if(item) @@ -262,6 +269,14 @@ void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids)  	fetch_items_from_llsd(items_llsd);  } +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver() +{ +} + +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : +	mIDs(ids) +{ +}  // virtual  void LLInventoryFetchDescendentsObserver::changed(U32 mask)  { @@ -287,9 +302,9 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask)  	}  } -void LLInventoryFetchDescendentsObserver::fetch(const uuid_vec_t& ids) +void LLInventoryFetchDescendentsObserver::startFetch()  { -	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) +	for(uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it)  	{  		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);  		if(!cat) continue; @@ -400,11 +415,10 @@ void LLInventoryFetchComboObserver::changed(U32 mask)  	}  } -void LLInventoryFetchComboObserver::fetch( -	const uuid_vec_t& folder_ids, -	const uuid_vec_t& item_ids) +void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, +											   const uuid_vec_t& item_ids)  { -	lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; +	lldebugs << "LLInventoryFetchComboObserver::startFetch()" << llendl;  	for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)  	{  		LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); @@ -544,8 +558,7 @@ void LLInventoryAddedObserver::changed(U32 mask)  	}  } -LLInventoryTransactionObserver::LLInventoryTransactionObserver( -	const LLTransactionID& transaction_id) : +LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransactionID& transaction_id) :  	mTransactionID(transaction_id)  {  } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index ba70552ebc..03f9e9c553 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -73,68 +73,46 @@ public:  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryCompletionObserver -// -//   Base class for doing something when when all observed items are locally  -//   complete.  Implements the changed() method of LLInventoryObserver  -//   and declares a new method named done() which is called when all watched items  -//   have complete information in the inventory model. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryCompletionObserver : public LLInventoryObserver -{ -public: -	LLInventoryCompletionObserver() {} -	virtual void changed(U32 mask); - -	void watchItem(const LLUUID& id); - -protected: -	virtual void done() = 0; - -	uuid_vec_t mComplete; -	uuid_vec_t mIncomplete; -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryFetchObserver +// Class LLInventoryFetchItemsObserver  // -// This class is much like the LLInventoryCompletionObserver, except -// that it handles all the the fetching necessary. Override the done() -// method to do the thing you want. +//   Fetches inventory items, calls done() when all inventory has arrived.   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryFetchObserver : public LLInventoryObserver +class LLInventoryFetchItemsObserver : public LLInventoryObserver  {  public: -	LLInventoryFetchObserver(bool retry_if_missing = false); +	LLInventoryFetchItemsObserver(bool retry_if_missing = false); +	LLInventoryFetchItemsObserver(const uuid_vec_t& ids, bool retry_if_missing = false);  	virtual void changed(U32 mask);  	bool isEverythingComplete() const; -	void fetch(const uuid_vec_t& ids); +	void setItems(const uuid_vec_t& ids) { mIDs = ids; } +	void startFetch(); +  	virtual void done() {};  protected:  	bool mRetryIfMissing;  	uuid_vec_t mComplete;  	uuid_vec_t mIncomplete; +	uuid_vec_t mIDs;  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // Class LLInventoryFetchDescendentsObserver  // -// This class is much like the LLInventoryCompletionObserver, except -// that it handles fetching based on category. Override the done() -// method to do the thing you want. +//   Fetches children of a category/folder, calls done() when all  +//   inventory has arrived.   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  class LLInventoryFetchDescendentsObserver : public LLInventoryObserver  {  public: -	LLInventoryFetchDescendentsObserver() {} +	LLInventoryFetchDescendentsObserver(); +	LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids);  	virtual void changed(U32 mask); -	void fetch(const uuid_vec_t& ids); +	void setFolders(const uuid_vec_t& ids) { mIDs = ids; } +	void startFetch();  	bool isEverythingComplete() const;  	virtual void done() = 0; @@ -142,6 +120,7 @@ protected:  	bool isComplete(LLViewerInventoryCategory* cat);  	uuid_vec_t mIncomplete;  	uuid_vec_t mComplete; +	uuid_vec_t mIDs;  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -158,7 +137,7 @@ public:  	LLInventoryFetchComboObserver() : mDone(false) {}  	virtual void changed(U32 mask); -	void fetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); +	void startFetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids);  	virtual void done() = 0; @@ -237,6 +216,29 @@ protected:  	LLTransactionID mTransactionID;  }; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryCompletionObserver +// +//   Base class for doing something when when all observed items are locally  +//   complete.  Implements the changed() method of LLInventoryObserver  +//   and declares a new method named done() which is called when all watched items  +//   have complete information in the inventory model. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLInventoryCompletionObserver : public LLInventoryObserver +{ +public: +	LLInventoryCompletionObserver() {} +	virtual void changed(U32 mask); + +	void watchItem(const LLUUID& id); + +protected: +	virtual void done() = 0; + +	uuid_vec_t mComplete; +	uuid_vec_t mIncomplete; +};  #endif // LL_LLINVENTORYOBSERVERS_H diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ccd1bfe224..5701fcb582 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -484,7 +484,8 @@ void LLPanelOutfitEdit::updateLookInfo()  		uuid_vec_t folders;  		folders.push_back(mLookID); -		mFetchLook->fetch(folders); +		mFetchLook->setFolders(folders); +		mFetchLook->startFetch();  		if (mFetchLook->isEverythingComplete())  		{  			mFetchLook->done(); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 511196809a..6dd4dc1ce7 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -52,10 +52,12 @@  static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance"); -class LLCurrentlyWornFetchObserver : public LLInventoryFetchObserver +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver  {  public: -	LLCurrentlyWornFetchObserver(LLSidepanelAppearance *panel) : +	LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, +								 LLSidepanelAppearance *panel) : +		LLInventoryFetchItemsObserver(ids),  		mPanel(panel)  	{}  	~LLCurrentlyWornFetchObserver() {} @@ -390,10 +392,10 @@ void LLSidepanelAppearance::fetchInventory()  		}  	} -	LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(this); -	fetch_worn->fetch(ids); +	LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); +	fetch_worn->startFetch();  	// If no items to be fetched, done will never be triggered. -	// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. +	// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.  	if (fetch_worn->isEverythingComplete())  	{  		fetch_worn->done(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d7c8b5fcd4..340327a1e2 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1771,7 +1771,8 @@ bool idle_startup()  					}  				}  				// no need to add gesture to inventory observer, it's already made in constructor  -				LLGestureMgr::instance().fetch(item_ids); +				LLGestureMgr::instance().setItems(item_ids); +				LLGestureMgr::instance().startFetch();  			}  		}  		gDisplaySwapBuffers = TRUE; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 1e81e675e6..cc90b0753f 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -244,11 +244,13 @@ public:  	}  }; -class LLCategoryDropObserver : public LLInventoryFetchObserver +class LLCategoryDropObserver : public LLInventoryFetchItemsObserver  {  public:  	LLCategoryDropObserver( +		const uuid_vec_t& ids,  		const LLUUID& obj_id, LLToolDragAndDrop::ESource src) : +		LLInventoryFetchItemsObserver(ids),  		mObjectID(obj_id),  		mSource(src)  	{} @@ -331,8 +333,8 @@ void LLCategoryDropDescendentsObserver::done()  		std::back_insert_iterator<uuid_vec_t> copier(ids);  		std::copy(unique_ids.begin(), unique_ids.end(), copier);  		LLCategoryDropObserver* dropper; -		dropper = new LLCategoryDropObserver(mObjectID, mSource); -		dropper->fetch(ids); +		dropper = new LLCategoryDropObserver(ids, mObjectID, mSource); +		dropper->startFetch();  		if (dropper->isEverythingComplete())  		{  			dropper->done(); @@ -480,7 +482,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,  			if (!folder_ids.empty() || !item_ids.empty())  			{  				LLCategoryFireAndForget fetcher; -				fetcher.fetch(folder_ids, item_ids); +				fetcher.startFetch(folder_ids, item_ids);  			}  		}  	} @@ -550,7 +552,7 @@ void LLToolDragAndDrop::beginMultiDrag(  			std::back_insert_iterator<uuid_vec_t> copier(folder_ids);  			std::copy(cat_ids.begin(), cat_ids.end(), copier);  			LLCategoryFireAndForget fetcher; -			fetcher.fetch(folder_ids, item_ids); +			fetcher.startFetch(folder_ids, item_ids);  		}  	}  } @@ -2576,8 +2578,8 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(  			const LLViewerInventoryItem *item = (*item_iter);  			ids.push_back(item->getUUID());  		} -		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource); -		dropper->fetch(ids); +		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource); +		dropper->startFetch();  		if (dropper->isEverythingComplete())  		{  			dropper->done(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d91b6d0b1e..807595960e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6096,10 +6096,12 @@ class LLAttachmentDetach : public view_listener_t  //Adding an observer for a Jira 2422 and needs to be a fetch observer  //for Jira 3119 -class LLWornItemFetchedObserver : public LLInventoryFetchObserver +class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver  {  public: -	LLWornItemFetchedObserver() {} +	LLWornItemFetchedObserver(const uuid_vec_t& ids) : +		LLInventoryFetchItemsObserver(ids) +	{}  	virtual ~LLWornItemFetchedObserver() {}  protected: @@ -6153,13 +6155,12 @@ class LLAttachmentEnableDrop : public view_listener_t  						// when the item finishes fetching worst case scenario   						// if a fetch is already out there (being sent from a slow sim)  						// we refetch and there are 2 fetches -						LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver(); +  						uuid_vec_t items; //add item to the inventory item to be fetched -						  						items.push_back((*attachment_iter)->getItemID()); -						 -						wornItemFetched->fetch(items); -						gInventory.addObserver(wornItemFetched); +						LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver(items);		 +						worn_item_fetched->startFetch(); +						gInventory.addObserver(worn_item_fetched);  					}  				}  			} diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a471876ce1..6f39de996e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -700,10 +700,13 @@ static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_  //-----------------------------------------------------------------------------  // Instant Message  //----------------------------------------------------------------------------- -class LLOpenAgentOffer : public LLInventoryFetchObserver +class LLOpenAgentOffer : public LLInventoryFetchItemsObserver  {  public: -	LLOpenAgentOffer(const std::string& from_name) : mFromName(from_name) {} +	LLOpenAgentOffer(const uuid_vec_t& ids, +					 const std::string& from_name) :  +		LLInventoryFetchItemsObserver(ids), +		mFromName(from_name) {}  	/*virtual*/ void done()  	{  		open_inventory_offer(mComplete, mFromName); @@ -1206,8 +1209,8 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&  				// so we can fetch it out of our inventory.  				uuid_vec_t items;  				items.push_back(mObjectID); -				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string); -				open_agent_offer->fetch(items); +				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(items, from_string); +				open_agent_offer->startFetch();  				if(catp || (itemp && itemp->isComplete()))  				{  					open_agent_offer->done(); @@ -1270,7 +1273,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&  			items.push_back(mObjectID);  			LLDiscardAgentOffer* discard_agent_offer;  			discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); -			discard_agent_offer->fetch(folders, items); +			discard_agent_offer->startFetch(folders, items);  			if(catp || (itemp && itemp->isComplete()))  			{  				discard_agent_offer->done(); @@ -1604,8 +1607,8 @@ void inventory_offer_handler(LLOfferInfo* info)  		// Prefetch the item into your local inventory.  		uuid_vec_t items;  		items.push_back(info->mObjectID); -		LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver(); -		fetch_item->fetch(items); +		LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); +		fetch_item->startFetch();  		if(fetch_item->isEverythingComplete())  		{  			fetch_item->done(); @@ -2123,8 +2126,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)  				// Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)  				uuid_vec_t items;  				items.push_back(info->mObjectID); -				LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver(); -				fetch_item->fetch(items); +				LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); +				fetch_item->startFetch();  				delete fetch_item;  				// Same as closing window @@ -2844,7 +2847,9 @@ void process_teleport_progress(LLMessageSystem* msg, void**)  class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver  {  public: -	LLFetchInWelcomeArea() {} +	LLFetchInWelcomeArea(const uuid_vec_t &ids) : +		LLInventoryFetchDescendentsObserver(ids) +	{}  	virtual void done()  	{  		LLIsType is_landmark(LLAssetType::AT_LANDMARK); @@ -2926,8 +2931,8 @@ BOOL LLPostTeleportNotifiers::tick()  			folders.push_back(folder_id);  		if(!folders.empty())  		{ -			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea; -			fetcher->fetch(folders); +			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders); +			fetcher->startFetch();  			if(fetcher->isEverythingComplete())  			{  				fetcher->done();  | 
