diff options
Diffstat (limited to 'linden/indra/newview/lltexturefetch.h')
-rw-r--r-- | linden/indra/newview/lltexturefetch.h | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/linden/indra/newview/lltexturefetch.h b/linden/indra/newview/lltexturefetch.h index 56650e7..c48f609 100644 --- a/linden/indra/newview/lltexturefetch.h +++ b/linden/indra/newview/lltexturefetch.h | |||
@@ -37,26 +37,29 @@ | |||
37 | #include "llimage.h" | 37 | #include "llimage.h" |
38 | #include "lluuid.h" | 38 | #include "lluuid.h" |
39 | #include "llworkerthread.h" | 39 | #include "llworkerthread.h" |
40 | #include "llcurl.h" | ||
41 | #include "lltextureinfo.h" | ||
40 | 42 | ||
41 | class LLViewerImage; | 43 | class LLViewerImage; |
42 | class LLTextureFetchWorker; | 44 | class LLTextureFetchWorker; |
45 | class HTTPGetResponder; | ||
43 | class LLTextureCache; | 46 | class LLTextureCache; |
47 | class LLImageDecodeThread; | ||
44 | class LLHost; | 48 | class LLHost; |
45 | 49 | ||
46 | // Interface class | 50 | // Interface class |
47 | class LLTextureFetch : public LLWorkerThread | 51 | class LLTextureFetch : public LLWorkerThread |
48 | { | 52 | { |
49 | friend class LLTextureFetchWorker; | 53 | friend class LLTextureFetchWorker; |
54 | friend class HTTPGetResponder; | ||
50 | 55 | ||
51 | public: | 56 | public: |
52 | LLTextureFetch(LLTextureCache* cache, bool threaded); | 57 | LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* imagedecodethread, bool threaded); |
53 | ~LLTextureFetch(); | 58 | ~LLTextureFetch(); |
54 | 59 | ||
55 | /*virtual*/ S32 update(U32 max_time_ms); | 60 | /*virtual*/ S32 update(U32 max_time_ms); |
56 | 61 | ||
57 | bool createRequest(const LLUUID& id, const LLHost& host, F32 priority, | 62 | bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, |
58 | S32 w, S32 h, S32 c, S32 discard, bool needs_aux); | ||
59 | bool createRequest(const std::string& filename, const LLUUID& id, const LLHost& host, F32 priority, | ||
60 | S32 w, S32 h, S32 c, S32 discard, bool needs_aux); | 63 | S32 w, S32 h, S32 c, S32 discard, bool needs_aux); |
61 | void deleteRequest(const LLUUID& id, bool cancel); | 64 | void deleteRequest(const LLUUID& id, bool cancel); |
62 | bool getRequestFinished(const LLUUID& id, S32& discard_level, | 65 | bool getRequestFinished(const LLUUID& id, S32& discard_level, |
@@ -66,24 +69,38 @@ public: | |||
66 | bool receiveImageHeader(const LLHost& host, const LLUUID& id, U8 codec, U16 packets, U32 totalbytes, U16 data_size, U8* data); | 69 | bool receiveImageHeader(const LLHost& host, const LLUUID& id, U8 codec, U16 packets, U32 totalbytes, U16 data_size, U8* data); |
67 | bool receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data); | 70 | bool receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data); |
68 | 71 | ||
72 | void setTextureBandwidth(F32 bandwidth) { mTextureBandwidth = bandwidth; } | ||
73 | F32 getTextureBandwidth() { return mTextureBandwidth; } | ||
74 | |||
69 | // Debug | 75 | // Debug |
70 | S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p, | 76 | S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p, |
71 | U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p); | 77 | U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p); |
72 | void dump(); | 78 | void dump(); |
73 | S32 getNumRequests() { return mRequestMap.size(); } | 79 | S32 getNumRequests() { return mRequestMap.size(); } |
80 | S32 getNumHTTPRequests() { return mHTTPTextureQueue.size(); } | ||
74 | 81 | ||
75 | // Public for access by callbacks | 82 | // Public for access by callbacks |
76 | void lockQueue() { mQueueMutex.lock(); } | 83 | void lockQueue() { mQueueMutex.lock(); } |
77 | void unlockQueue() { mQueueMutex.unlock(); } | 84 | void unlockQueue() { mQueueMutex.unlock(); } |
78 | LLTextureFetchWorker* getWorker(const LLUUID& id); | 85 | LLTextureFetchWorker* getWorker(const LLUUID& id); |
86 | |||
87 | LLTextureInfo* getTextureInfo() { return &mTextureInfo; } | ||
79 | 88 | ||
80 | protected: | 89 | protected: |
81 | void addToNetworkQueue(LLTextureFetchWorker* worker); | 90 | void addToNetworkQueue(LLTextureFetchWorker* worker); |
82 | void removeFromNetworkQueue(LLTextureFetchWorker* worker); | 91 | void removeFromNetworkQueue(LLTextureFetchWorker* worker, bool cancel); |
92 | void addToHTTPQueue(const LLUUID& id); | ||
93 | void removeFromHTTPQueue(const LLUUID& id); | ||
94 | S32 getHTTPQueueSize() { return (S32)mHTTPTextureQueue.size(); } | ||
83 | void removeRequest(LLTextureFetchWorker* worker, bool cancel); | 95 | void removeRequest(LLTextureFetchWorker* worker, bool cancel); |
96 | // Called from worker thread (during doWork) | ||
97 | void processCurlRequests(); | ||
84 | 98 | ||
85 | private: | 99 | private: |
86 | void sendRequestListToSimulators(); | 100 | void sendRequestListToSimulators(); |
101 | /*virtual*/ void startThread(void); | ||
102 | /*virtual*/ void endThread(void); | ||
103 | /*virtual*/ void threadedUpdate(void); | ||
87 | 104 | ||
88 | public: | 105 | public: |
89 | LLUUID mDebugID; | 106 | LLUUID mDebugID; |
@@ -94,8 +111,11 @@ public: | |||
94 | 111 | ||
95 | private: | 112 | private: |
96 | LLMutex mQueueMutex; | 113 | LLMutex mQueueMutex; |
114 | LLMutex mNetworkQueueMutex; | ||
97 | 115 | ||
98 | LLTextureCache* mTextureCache; | 116 | LLTextureCache* mTextureCache; |
117 | LLImageDecodeThread* mImageDecodeThread; | ||
118 | LLCurlRequest* mCurlGetRequest; | ||
99 | 119 | ||
100 | // Map of all requests by UUID | 120 | // Map of all requests by UUID |
101 | typedef std::map<LLUUID,LLTextureFetchWorker*> map_t; | 121 | typedef std::map<LLUUID,LLTextureFetchWorker*> map_t; |
@@ -104,10 +124,13 @@ private: | |||
104 | // Set of requests that require network data | 124 | // Set of requests that require network data |
105 | typedef std::set<LLUUID> queue_t; | 125 | typedef std::set<LLUUID> queue_t; |
106 | queue_t mNetworkQueue; | 126 | queue_t mNetworkQueue; |
127 | queue_t mHTTPTextureQueue; | ||
107 | typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t; | 128 | typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t; |
108 | cancel_queue_t mCancelQueue; | 129 | cancel_queue_t mCancelQueue; |
109 | 130 | F32 mTextureBandwidth; | |
110 | LLFrameTimer mNetworkTimer; | 131 | F32 mMaxBandwidth; |
132 | LLTextureInfo mTextureInfo; | ||
111 | }; | 133 | }; |
112 | 134 | ||
113 | #endif // LL_LLTEXTUREFETCH_H | 135 | #endif // LL_LLTEXTUREFETCH_H |
136 | |||