PageRenderTime 25ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llinventorymodelbackgroundfetch.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 102 lines | 53 code | 16 blank | 33 comment | 0 complexity | 962c71cb5268be26e096c66dd6e40c88 MD5 | raw file
  1/** 
  2 * @file llinventorymodelbackgroundfetch.h
  3 * @brief LLInventoryModelBackgroundFetch class header file
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H
 28#define LL_LLINVENTORYMODELBACKGROUNDFETCH_H
 29
 30#include "llsingleton.h"
 31#include "lluuid.h"
 32
 33//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 34// Class LLInventoryModelBackgroundFetch
 35//
 36// This class handles background fetches, which are fetches of
 37// inventory folder.  Fetches can be recursive or not.
 38//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 39class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
 40{
 41	friend class LLInventoryModelFetchDescendentsResponder;
 42
 43public:
 44	LLInventoryModelBackgroundFetch();
 45	~LLInventoryModelBackgroundFetch();
 46
 47	// Start and stop background breadth-first fetching of inventory contents.
 48	// This gets triggered when performing a filter-search.
 49	void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
 50
 51	BOOL backgroundFetchActive() const;
 52	bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
 53
 54	bool libraryFetchStarted() const;
 55	bool libraryFetchCompleted() const;
 56	bool libraryFetchInProgress() const;
 57	
 58	bool inventoryFetchStarted() const;
 59	bool inventoryFetchCompleted() const;
 60	bool inventoryFetchInProgress() const;
 61
 62    void findLostItems();	
 63protected:
 64	void incrBulkFetch(S16 fetching);
 65	bool isBulkFetchProcessingComplete() const;
 66	void bulkFetch(std::string url);
 67
 68	void backgroundFetch();
 69	static void backgroundFetchCB(void*); // background fetch idle function
 70	void stopBackgroundFetch(); // stop fetch process
 71
 72	void setAllFoldersFetched();
 73	bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
 74private:
 75 	BOOL mRecursiveInventoryFetchStarted;
 76	BOOL mRecursiveLibraryFetchStarted;
 77	BOOL mAllFoldersFetched;
 78
 79	BOOL mBackgroundFetchActive;
 80	S16 mBulkFetchCount;
 81	BOOL mTimelyFetchPending;
 82	S32 mNumFetchRetries;
 83
 84	LLFrameTimer mFetchTimer;
 85	F32 mMinTimeBetweenFetches;
 86	F32 mMaxTimeBetweenFetches;
 87
 88	struct FetchQueueInfo
 89	{
 90		FetchQueueInfo(const LLUUID& id, BOOL recursive) :
 91			mCatUUID(id), mRecursive(recursive)
 92		{
 93		}
 94		LLUUID mCatUUID;
 95		BOOL mRecursive;
 96	};
 97	typedef std::deque<FetchQueueInfo> fetch_queue_t;
 98	fetch_queue_t mFetchQueue;
 99};
100
101#endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H
102