diff options
author | simon <none@none> | 2014-03-19 11:41:42 -0700 |
---|---|---|
committer | simon <none@none> | 2014-03-19 11:41:42 -0700 |
commit | 00a325ccb90b1c6800ec78e1211b5097d9c27a58 (patch) | |
tree | 8b58fbd99d5bce117cf8dad5181b5690af4bd34f /indra/newview/lllogchat.h | |
parent | 09d1c27d4f78c78d949b6a3d896d6f58df2dfc06 (diff) | |
parent | 1ab9f19f82a84a109cf429998f423986268801f6 (diff) |
Pull in viewer-lion to lock down next release
Diffstat (limited to 'indra/newview/lllogchat.h')
-rwxr-xr-x | indra/newview/lllogchat.h | 64 |
1 files changed, 53 insertions, 11 deletions
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index acee99afa2..81f75ef626 100755 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -28,23 +28,54 @@ #define LL_LLLOGCHAT_H class LLChat; -class LLLoadHistoryThread : public LLThread + +class LLActionThread : public LLThread { +public: + LLActionThread(const std::string& name); + ~LLActionThread(); + + void waitFinished(); + bool isFinished() { return mFinished; } +protected: + void setFinished(); private: - std::string mFileName; - std::list<LLSD> mMessages; + bool mFinished; + LLMutex mMutex; + LLCondition mRunCondition; +}; + +class LLLoadHistoryThread : public LLActionThread +{ +private: + const std::string& mFileName; + std::list<LLSD>* mMessages; LLSD mLoadParams; bool mNewLoad; public: - LLLoadHistoryThread(); - - void setHistoryParams(const std::string& file_name, const LLSD& load_params); - virtual void loadHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params); + LLLoadHistoryThread(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params); + ~LLLoadHistoryThread(); + //void setHistoryParams(const std::string& file_name, const LLSD& load_params); + virtual void loadHistory(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params); virtual void run(); - typedef boost::signals2::signal<void (std::list<LLSD>& messages,const std::string& file_name)> load_end_signal_t; - static load_end_signal_t * mLoadEndSignal; - static boost::signals2::connection setLoadEndSignal(const load_end_signal_t::slot_type& cb); + typedef boost::signals2::signal<void (std::list<LLSD>* messages,const std::string& file_name)> load_end_signal_t; + load_end_signal_t * mLoadEndSignal; + boost::signals2::connection setLoadEndSignal(const load_end_signal_t::slot_type& cb); + void removeLoadEndSignal(const load_end_signal_t::slot_type& cb); +}; + +class LLDeleteHistoryThread : public LLActionThread +{ +private: + std::list<LLSD>* mMessages; + LLLoadHistoryThread* mLoadThread; +public: + LLDeleteHistoryThread(std::list<LLSD>* messages, LLLoadHistoryThread* loadThread); + ~LLDeleteHistoryThread(); + + virtual void run(); + static void deleteHistory(); }; class LLLogChat @@ -73,7 +104,6 @@ public: static void getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions); static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD()); - static void startChatHistoryThread(const std::string& file_name, const LLSD& load_params); typedef boost::signals2::signal<void ()> save_history_signal_t; static boost::signals2::connection setSaveHistorySignal(const save_history_signal_t::slot_type& cb); @@ -90,9 +120,21 @@ public: static bool isTranscriptExist(const LLUUID& avatar_id, bool is_group=false); static bool isNearbyTranscriptExist(); + static bool historyThreadsFinished(LLUUID session_id); + static LLLoadHistoryThread* getLoadHistoryThread(LLUUID session_id); + static LLDeleteHistoryThread* getDeleteHistoryThread(LLUUID session_id); + static bool addLoadHistoryThread(LLUUID& session_id, LLLoadHistoryThread* lthread); + static bool addDeleteHistoryThread(LLUUID& session_id, LLDeleteHistoryThread* dthread); + static void cleanupHistoryThreads(); + private: static std::string cleanFileName(std::string filename); static save_history_signal_t * sSaveHistorySignal; + + static std::map<LLUUID,LLLoadHistoryThread *> sLoadHistoryThreads; + static std::map<LLUUID,LLDeleteHistoryThread *> sDeleteHistoryThreads; + static LLMutex* sHistoryThreadsMutex; + static LLMutex* historyThreadsMutex(); }; /** |