diff options
author | igrechuhin <i.grechuhin@gmail.com> | 2016-06-01 15:05:27 +0300 |
---|---|---|
committer | igrechuhin <i.grechuhin@gmail.com> | 2016-06-01 15:05:27 +0300 |
commit | 4ded724a1ab01730e5324b6cdc587ba6c335ecbc (patch) | |
tree | 3d2e9ba9a97d5b3a1263d193a951f6ed9eeab4be /map/framework.hpp | |
parent | a15e1ca1f08123c31bb48f2e217c468931d91717 (diff) | |
parent | 0ae019f82dc2d4e30a1bbf3ea924d07d22621a52 (diff) |
Merge pull request #3387 from mgsergio/get-user-stats-from-server
[editor] Get user stats from server
Diffstat (limited to 'map/framework.hpp')
-rw-r--r-- | map/framework.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/map/framework.hpp b/map/framework.hpp index 1fd41a1d7f..1e8a4c2dea 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -43,7 +43,6 @@ #include "base/thread_checker.hpp" #include "std/list.hpp" -#include "std/shared_ptr.hpp" #include "std/target_os.hpp" #include "std/unique_ptr.hpp" #include "std/vector.hpp" @@ -675,15 +674,24 @@ private: public: //@{ - //User statistics. - editor::UserStats const * GetUserStats() const { return m_userStats.get(); } - /// Sends a synchronous request to the server and updates user's stats. - /// @returns true on success. - bool UpdateUserStats(string const & userName); - void DropUserStats() { m_userStats = nullptr; } + // User statistics. + + editor::UserStats GetUserStats(string const & userName) const + { + return m_userStatsLoader.GetStats(userName); + } + + // Reads user stats from server or gets it from cache calls |fn| on success. + void UpdateUserStats(string const & userName, + editor::UserStatsLoader::TOnUpdateCallback fn) + { + m_userStatsLoader.Update(userName, fn); + } + + void DropUserStats(string const & userName) { m_userStatsLoader.DropStats(userName); } private: - unique_ptr<editor::UserStats> m_userStats; + editor::UserStatsLoader m_userStatsLoader; //@} DECLARE_THREAD_CHECKER(m_threadChecker); |