PageRenderTime 141ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llassetuploadqueue.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 91 lines | 47 code | 15 blank | 29 comment | 0 complexity | ba0f96615882758325fff50cd162bc25 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llassetuploadqueue.h
  3. * @brief Serializes asset upload request
  4. *
  5. * $LicenseInfo:firstyear=2007&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_LLASSETUPLOADQUEUE_H
  27. #define LL_LLASSETUPLOADQUEUE_H
  28. #include "lluuid.h"
  29. #include <string>
  30. #include <deque>
  31. class LLAssetUploadQueueSupplier;
  32. class LLAssetUploadQueue
  33. {
  34. public:
  35. // Takes ownership of supplier.
  36. LLAssetUploadQueue(LLAssetUploadQueueSupplier* supplier);
  37. virtual ~LLAssetUploadQueue();
  38. void queue(const std::string& filename,
  39. const LLUUID& task_id,
  40. const LLUUID& item_id,
  41. BOOL is_running,
  42. BOOL is_target_mono,
  43. const LLUUID& queue_id,
  44. U8* data,
  45. U32 data_size,
  46. std::string script_name);
  47. bool isEmpty() const {return mQueue.empty();}
  48. private:
  49. friend class LLAssetUploadChainResponder;
  50. struct UploadData
  51. {
  52. std::string mFilename;
  53. LLUUID mTaskId;
  54. LLUUID mItemId;
  55. BOOL mIsRunning;
  56. BOOL mIsTargetMono;
  57. LLUUID mQueueId;
  58. U8* mData;
  59. U32 mDataSize;
  60. std::string mScriptName;
  61. };
  62. // Ownership of mSupplier passed to currently waiting responder
  63. // and returned to queue when no requests in progress.
  64. LLAssetUploadQueueSupplier* mSupplier;
  65. std::deque<UploadData> mQueue;
  66. // Passes on ownership of mSupplier if request is made.
  67. void request(LLAssetUploadQueueSupplier** supplier);
  68. };
  69. class LLAssetUploadQueueSupplier
  70. {
  71. public:
  72. virtual ~LLAssetUploadQueueSupplier();
  73. virtual LLAssetUploadQueue* get() const = 0;
  74. virtual void log(std::string message) const = 0;
  75. };
  76. #endif // LL_LLASSETUPLOADQUEUE_H