diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-03-16 16:25:41 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:04:07 +0300 |
commit | d7b1edc1c2a32e34530326a3d1ef3b8c523b164e (patch) | |
tree | 1bff439879414f853cd510b5eed0243fbd2f03a0 /drape_frontend/base_renderer.hpp | |
parent | 8505cb9824256b0c73be731f75866eb2ce8f4135 (diff) |
Fixed drape engine destruction on iOS, moved some common code to renderer
Diffstat (limited to 'drape_frontend/base_renderer.hpp')
-rw-r--r-- | drape_frontend/base_renderer.hpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drape_frontend/base_renderer.hpp b/drape_frontend/base_renderer.hpp index 391b5fda03..94b3fc8cb1 100644 --- a/drape_frontend/base_renderer.hpp +++ b/drape_frontend/base_renderer.hpp @@ -1,6 +1,9 @@ #pragma once #include "message_acceptor.hpp" +#include "../base/thread.hpp" +#include "../drape/oglcontextfactory.hpp" + #include "../std/atomic.hpp" #include "../std/condition_variable.hpp" #include "../std/function.hpp" @@ -9,18 +12,31 @@ namespace df { -class BaseRenderer : public MessageAcceptor +class ThreadsCommutator; + +class BaseRenderer : public MessageAcceptor, + public threads::IRoutine { public: using TCompletionHandler = function<void()>; - BaseRenderer(); + BaseRenderer(dp::RefPointer<ThreadsCommutator> commutator, + dp::RefPointer<dp::OGLContextFactory> oglcontextfactory); + void SetRenderingEnabled(bool const isEnabled); + void ClearRenderingQueueSynchronously(); protected: + dp::RefPointer<ThreadsCommutator> m_commutator; + dp::RefPointer<dp::OGLContextFactory> m_contextFactory; + + void StartThread(); + void StopThread(); void CheckRenderingEnabled(); private: + threads::Thread m_selfThread; + mutex m_renderingEnablingMutex; condition_variable m_renderingEnablingCondition; atomic<bool> m_isEnabled; @@ -29,6 +45,7 @@ private: void SetRenderingEnabled(bool const isEnabled, TCompletionHandler completionHandler); void Notify(); + void WakeUp(); }; } // namespace df |