summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/global_timer.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-30 20:20:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-10-30 20:20:42 +0000
commite0345a4aecfd16264d393234cf8fe22250d771fe (patch)
tree046f8e6c074b8525d6cf71daf4f2039582fb572a /fpdfsdk/javascript/global_timer.cpp
parent341ec6256457c53d50f2d0a0667e61041d4d89be (diff)
downloadpdfium-e0345a4aecfd16264d393234cf8fe22250d771fe.tar.xz
Move fpdfsdk/javascript to fxjs/
This CL moves all of the CJS files into fxjs. The :javascript build rule is removed and :fxjs is used instead. Change-Id: I1701b308f51317d0346c7401b43812c3f43a27bf Reviewed-on: https://pdfium-review.googlesource.com/17047 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/global_timer.cpp')
-rw-r--r--fpdfsdk/javascript/global_timer.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/fpdfsdk/javascript/global_timer.cpp b/fpdfsdk/javascript/global_timer.cpp
deleted file mode 100644
index 8e30cf92f0..0000000000
--- a/fpdfsdk/javascript/global_timer.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fpdfsdk/javascript/global_timer.h"
-
-GlobalTimer::GlobalTimer(app* pObj,
- CPDFSDK_FormFillEnvironment* pFormFillEnv,
- CJS_Runtime* pRuntime,
- int nType,
- const WideString& script,
- uint32_t dwElapse,
- uint32_t dwTimeOut)
- : m_nTimerID(0),
- m_pEmbedObj(pObj),
- m_bProcessing(false),
- m_nType(nType),
- m_dwTimeOut(dwTimeOut),
- m_swJScript(script),
- m_pRuntime(pRuntime),
- m_pFormFillEnv(pFormFillEnv) {
- CFX_SystemHandler* pHandler = m_pFormFillEnv->GetSysHandler();
- m_nTimerID = pHandler->SetTimer(dwElapse, Trigger);
- if (m_nTimerID)
- (*GetGlobalTimerMap())[m_nTimerID] = this;
-}
-
-GlobalTimer::~GlobalTimer() {
- if (!m_nTimerID)
- return;
-
- if (GetRuntime())
- m_pFormFillEnv->GetSysHandler()->KillTimer(m_nTimerID);
-
- GetGlobalTimerMap()->erase(m_nTimerID);
-}
-
-// static
-void GlobalTimer::Trigger(int nTimerID) {
- auto it = GetGlobalTimerMap()->find(nTimerID);
- if (it == GetGlobalTimerMap()->end())
- return;
-
- GlobalTimer* 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 GlobalTimer::Cancel(int nTimerID) {
- auto it = GetGlobalTimerMap()->find(nTimerID);
- if (it == GetGlobalTimerMap()->end())
- return;
-
- GlobalTimer* pTimer = it->second;
- pTimer->m_pEmbedObj->CancelProc(pTimer);
-}
-
-// static
-GlobalTimer::TimerMap* GlobalTimer::GetGlobalTimerMap() {
- // Leak the timer array at shutdown.
- static auto* s_TimerMap = new TimerMap;
- return s_TimerMap;
-}