diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-08-10 16:31:03 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-08-10 16:40:05 +0300 |
commit | 6c87c2a9ae5614b3db5b5a574f579c5082790263 (patch) | |
tree | dc362e8557dfef0c49d25d991169f9554c57704e /platform/platform.hpp | |
parent | a83b3f15f0a8fcfa070b0643903d348244e7dbcd (diff) |
[platform] added possibility to change gui thread
Diffstat (limited to 'platform/platform.hpp')
-rw-r--r-- | platform/platform.hpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/platform/platform.hpp b/platform/platform.hpp index 25c31816cf..fd6782d2ca 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -1,16 +1,19 @@ #pragma once #include "platform/country_defines.hpp" +#include "platform/gui_thread.hpp" #include "platform/marketing_service.hpp" #include "coding/reader.hpp" #include "base/exception.hpp" +#include "base/task_loop.hpp" #include "std/bitset.hpp" #include "std/function.hpp" #include "std/map.hpp" #include "std/string.hpp" +#include "std/unique_ptr.hpp" #include "std/utility.hpp" #include "std/vector.hpp" @@ -91,6 +94,8 @@ protected: /// Platform-dependent marketing services. MarketingService m_marketingService; + unique_ptr<base::TaskLoop> m_guiThread; + public: Platform(); @@ -188,8 +193,9 @@ public: /// @name Functions for concurrent tasks. //@{ - typedef function<void()> TFunctor; - void RunOnGuiThread(TFunctor const & fn); + void RunOnGuiThread(base::TaskLoop::Task && task); + void RunOnGuiThread(base::TaskLoop::Task const & task); + enum Priority { EPriorityBackground, @@ -197,6 +203,7 @@ public: EPriorityDefault, EPriorityHigh }; + using TFunctor = function<void()>; void RunAsync(TFunctor const & fn, Priority p = EPriorityDefault); //@} @@ -239,6 +246,9 @@ public: MarketingService & GetMarketingService() { return m_marketingService; } + // Use this method for testing purposes only. + void SetGuiThread(unique_ptr<base::TaskLoop> guiThread); + private: void GetSystemFontNames(FilesList & res) const; }; |