diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-10-30 17:49:52 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-30 17:49:52 +0000 |
commit | c0858354f1e9ce1246b8af9ef2cd11623a1132dd (patch) | |
tree | 13db2ec010cdc05a8dd6f91cd06bbb0ccc6613f2 /fpdfsdk/javascript/global_timer.h | |
parent | a5c874c1240a0be86d6db0536940c1d0942b4c6d (diff) | |
download | pdfium-c0858354f1e9ce1246b8af9ef2cd11623a1132dd.tar.xz |
Rename app to cjs_app
This CL renames the app.{cpp|h} files to cjs_app.{cpp|h}. The
CJS_TimerObj and GlobalTimer objects have been moved to their own files.
Change-Id: I7a4063b212f1051b1517ec8902a0ee215854feaf
Reviewed-on: https://pdfium-review.googlesource.com/17040
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/global_timer.h')
-rw-r--r-- | fpdfsdk/javascript/global_timer.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/fpdfsdk/javascript/global_timer.h b/fpdfsdk/javascript/global_timer.h new file mode 100644 index 0000000000..bc65b976a9 --- /dev/null +++ b/fpdfsdk/javascript/global_timer.h @@ -0,0 +1,50 @@ +// 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 + +#ifndef FPDFSDK_JAVASCRIPT_GLOBAL_TIMER_H_ +#define FPDFSDK_JAVASCRIPT_GLOBAL_TIMER_H_ + +#include <map> + +#include "fpdfsdk/javascript/cjs_app.h" + +class GlobalTimer { + public: + GlobalTimer(app* pObj, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CJS_Runtime* pRuntime, + int nType, + const WideString& script, + uint32_t dwElapse, + uint32_t dwTimeOut); + ~GlobalTimer(); + + static void Trigger(int nTimerID); + static void Cancel(int nTimerID); + + bool IsOneShot() const { return m_nType == 1; } + uint32_t GetTimeOut() const { return m_dwTimeOut; } + int GetTimerID() const { return m_nTimerID; } + CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); } + WideString GetJScript() const { return m_swJScript; } + + private: + using TimerMap = std::map<uint32_t, GlobalTimer*>; + static TimerMap* GetGlobalTimerMap(); + + uint32_t m_nTimerID; + app* const m_pEmbedObj; + bool m_bProcessing; + + // data + const int m_nType; // 0:Interval; 1:TimeOut + const uint32_t m_dwTimeOut; + const WideString m_swJScript; + CJS_Runtime::ObservedPtr m_pRuntime; + CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; +}; + +#endif // FPDFSDK_JAVASCRIPT_GLOBAL_TIMER_H_ |