summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript/JS_Object.cpp')
-rw-r--r--fpdfsdk/javascript/JS_Object.cpp82
1 files changed, 0 insertions, 82 deletions
diff --git a/fpdfsdk/javascript/JS_Object.cpp b/fpdfsdk/javascript/JS_Object.cpp
index b65699a18b..e72d0f3872 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -72,85 +72,3 @@ void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
if (pApp)
pApp->JS_appAlert(swMsg, nullptr, 0, 3);
}
-
-CJS_Timer::CJS_Timer(CJS_EmbedObj* pObj,
- CPDFDoc_Environment* pApp,
- CJS_Runtime* pRuntime,
- int nType,
- const CFX_WideString& script,
- uint32_t dwElapse,
- uint32_t dwTimeOut)
- : m_nTimerID(0),
- m_pEmbedObj(pObj),
- m_bProcessing(false),
- m_bValid(true),
- m_nType(nType),
- m_dwTimeOut(dwTimeOut),
- m_swJScript(script),
- m_pRuntime(pRuntime),
- m_pApp(pApp) {
- CFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- m_nTimerID = pHandler->SetTimer(dwElapse, Trigger);
- (*GetGlobalTimerMap())[m_nTimerID] = this;
- m_pRuntime->AddObserver(this);
-}
-
-CJS_Timer::~CJS_Timer() {
- CJS_Runtime* pRuntime = GetRuntime();
- if (pRuntime)
- pRuntime->RemoveObserver(this);
-
- if (!m_nTimerID)
- return;
-
- if (m_bValid)
- m_pApp->GetSysHandler()->KillTimer(m_nTimerID);
-
- GetGlobalTimerMap()->erase(m_nTimerID);
-}
-
-// static
-void CJS_Timer::Trigger(int nTimerID) {
- auto it = GetGlobalTimerMap()->find(nTimerID);
- if (it == GetGlobalTimerMap()->end())
- return;
-
- CJS_Timer* pTimer = it->second;
- if (pTimer->m_bProcessing)
- return;
-
- pTimer->m_bProcessing = true;
- if (pTimer->m_pEmbedObj)
- pTimer->m_pEmbedObj->TimerProc(pTimer);
-
- // Timer proc may have destroyed timer, find it again.
- it = GetGlobalTimerMap()->find(nTimerID);
- if (it == GetGlobalTimerMap()->end())
- return;
-
- pTimer = it->second;
- pTimer->m_bProcessing = false;
- if (pTimer->IsOneShot())
- pTimer->m_pEmbedObj->CancelProc(pTimer);
-}
-
-// static
-void CJS_Timer::Cancel(int nTimerID) {
- auto it = GetGlobalTimerMap()->find(nTimerID);
- if (it == GetGlobalTimerMap()->end())
- return;
-
- CJS_Timer* pTimer = it->second;
- pTimer->m_pEmbedObj->CancelProc(pTimer);
-}
-
-// static
-CJS_Timer::TimerMap* CJS_Timer::GetGlobalTimerMap() {
- // Leak the timer array at shutdown.
- static auto* s_TimerMap = new TimerMap;
- return s_TimerMap;
-}
-
-void CJS_Timer::OnDestroyed() {
- m_bValid = false;
-}