PageRenderTime 178ms CodeModel.GetById 18ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H
  27. #define LL_LLINVENTORYMODELBACKGROUNDFETCH_H
  28. #include "llsingleton.h"
  29. #include "lluuid.h"
  30. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. // Class LLInventoryModelBackgroundFetch
  32. //
  33. // This class handles background fetches, which are fetches of
  34. // inventory folder. Fetches can be recursive or not.
  35. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
  37. {
  38. friend class LLInventoryModelFetchDescendentsResponder;
  39. public:
  40. LLInventoryModelBackgroundFetch();
  41. ~LLInventoryModelBackgroundFetch();
  42. // Start and stop background breadth-first fetching of inventory contents.
  43. // This gets triggered when performing a filter-search.
  44. void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
  45. BOOL backgroundFetchActive() const;
  46. bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
  47. bool libraryFetchStarted() const;
  48. bool libraryFetchCompleted() const;
  49. bool libraryFetchInProgress() const;
  50. bool inventoryFetchStarted() const;
  51. bool inventoryFetchCompleted() const;
  52. bool inventoryFetchInProgress() const;
  53. void findLostItems();
  54. protected:
  55. void incrBulkFetch(S16 fetching);
  56. bool isBulkFetchProcessingComplete() const;
  57. void bulkFetch(std::string url);
  58. void backgroundFetch();
  59. static void backgroundFetchCB(void*); // background fetch idle function
  60. void stopBackgroundFetch(); // stop fetch process
  61. void setAllFoldersFetched();
  62. bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
  63. private:
  64. BOOL mRecursiveInventoryFetchStarted;
  65. BOOL mRecursiveLibraryFetchStarted;
  66. BOOL mAllFoldersFetched;
  67. BOOL mBackgroundFetchActive;
  68. S16 mBulkFetchCount;
  69. BOOL mTimelyFetchPending;
  70. S32 mNumFetchRetries;
  71. LLFrameTimer mFetchTimer;
  72. F32 mMinTimeBetweenFetches;
  73. F32 mMaxTimeBetweenFetches;
  74. struct FetchQueueInfo
  75. {
  76. FetchQueueInfo(const LLUUID& id, BOOL recursive) :
  77. mCatUUID(id), mRecursive(recursive)
  78. {
  79. }
  80. LLUUID mCatUUID;
  81. BOOL mRecursive;
  82. };
  83. typedef std::deque<FetchQueueInfo> fetch_queue_t;
  84. fetch_queue_t mFetchQueue;
  85. };
  86. #endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H