7#include "core/fxcrt/cfx_timer.h"
11#include "third_party/base/check.h"
15using TimerMap = std::map<int32_t, CFX_Timer*>;
16TimerMap* g_pwl_timer_map =
nullptr;
22 CHECK(!g_pwl_timer_map);
23 g_pwl_timer_map =
new TimerMap();
28 delete g_pwl_timer_map;
29 g_pwl_timer_map =
nullptr;
36 DCHECK(m_pCallbackIface);
37 if (m_pHandlerIface) {
38 m_nTimerID = m_pHandlerIface->SetTimer(nInterval, TimerProc);
40 (*g_pwl_timer_map)[m_nTimerID] =
this;
46 g_pwl_timer_map->erase(m_nTimerID);
48 m_pHandlerIface->KillTimer(m_nTimerID);
53void CFX_Timer::TimerProc(int32_t idEvent) {
54 auto it = g_pwl_timer_map->find(idEvent);
55 if (it != g_pwl_timer_map->end()) {
56 it->second->m_pCallbackIface->OnTimerFired();
static void DestroyGlobals()
CFX_Timer(HandlerIface *pHandlerIface, CallbackIface *pCallbackIface, int32_t nInterval)
static void InitializeGlobals()