summaryrefslogtreecommitdiff
path: root/indra/newview/lllogchat.h
diff options
context:
space:
mode:
authorPavelK ProductEngine <pkrivich@productengine.com>2013-12-03 19:32:56 +0200
committerPavelK ProductEngine <pkrivich@productengine.com>2013-12-03 19:32:56 +0200
commit443c502ccc3abe50b7747fb2ba4d3b6bd74c1dc6 (patch)
tree0df01c5c629662d1f928a89c2e1cc82a91276bfb /indra/newview/lllogchat.h
parent21d9e524f64637cba6f96c21ff8a4bcf30afc961 (diff)
MAINT-3476 FIX Opening large chat histories from conversation log eats up huge amounts of memory, leading to viewer crash.
Diffstat (limited to 'indra/newview/lllogchat.h')
-rwxr-xr-xindra/newview/lllogchat.h64
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();
};
/**