mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 13:53:37 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
36
drape_frontend/drape_notifier.cpp
Normal file
36
drape_frontend/drape_notifier.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "drape_frontend/drape_notifier.hpp"
|
||||
#include "drape_frontend/message_subclasses.hpp"
|
||||
|
||||
#include "drape/drape_routine.hpp"
|
||||
|
||||
namespace df
|
||||
{
|
||||
DrapeNotifier::DrapeNotifier(ref_ptr<ThreadsCommutator> commutator)
|
||||
: m_commutator(commutator)
|
||||
, m_counter(kInvalidId + 1)
|
||||
{}
|
||||
|
||||
uint64_t DrapeNotifier::Notify(ThreadsCommutator::ThreadName threadName,
|
||||
base::DelayedThreadPool::Duration const & duration, bool repeating,
|
||||
Functor && functor)
|
||||
{
|
||||
uint64_t const notifyId = m_counter++;
|
||||
NotifyImpl(threadName, duration, repeating, notifyId, std::move(functor));
|
||||
return notifyId;
|
||||
}
|
||||
|
||||
void DrapeNotifier::NotifyImpl(ThreadsCommutator::ThreadName threadName,
|
||||
base::DelayedThreadPool::Duration const & duration, bool repeating,
|
||||
uint64_t notifyId, Functor && functor)
|
||||
{
|
||||
dp::DrapeRoutine::RunDelayed(duration,
|
||||
[this, threadName, duration, repeating, notifyId, functor = std::move(functor)]() mutable
|
||||
{
|
||||
m_commutator->PostMessage(threadName,
|
||||
make_unique_dp<NotifyRenderThreadMessage>(functor, notifyId),
|
||||
MessagePriority::Normal);
|
||||
if (repeating)
|
||||
NotifyImpl(threadName, duration, repeating, notifyId, std::move(functor));
|
||||
});
|
||||
}
|
||||
} // namespace df
|
||||
Reference in New Issue
Block a user