Use fxcrt::TimerHandlerIface in CXFA_FWLAdapterTimerMgr.
Replaces a usage of CPDFSDK_FormFillEnvironment with the lower
level abstraction on the XFA side.
Change-Id: Iaf5a40fa5404a76a638b465b1457e70a42c3da69
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/58773
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 349cc5d..f441d019 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -303,5 +303,6 @@
std::unique_ptr<IFWL_AdapterTimerMgr> CPDFXFA_Context::NewTimerMgr() {
if (!m_pFormFillEnv)
return nullptr;
- return pdfium::MakeUnique<CXFA_FWLAdapterTimerMgr>(m_pFormFillEnv.Get());
+ return pdfium::MakeUnique<CXFA_FWLAdapterTimerMgr>(
+ m_pFormFillEnv->GetSysHandler());
}
diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
index 6b17955..769401e 100644
--- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
+++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
@@ -10,7 +10,8 @@
#include <utility>
#include <vector>
-#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -42,10 +43,9 @@
} // namespace
-
CXFA_FWLAdapterTimerMgr::CXFA_FWLAdapterTimerMgr(
- CPDFSDK_FormFillEnvironment* pFormFillEnv)
- : m_pFormFillEnv(pFormFillEnv) {}
+ TimerHandlerIface* pTimerHandler)
+ : m_pTimerHandler(pTimerHandler) {}
CXFA_FWLAdapterTimerMgr::~CXFA_FWLAdapterTimerMgr() = default;
@@ -55,22 +55,22 @@
if (!g_TimerArray)
g_TimerArray = new std::vector<std::unique_ptr<CFWL_TimerInfo>>;
- if (!m_pFormFillEnv)
+ if (!m_pTimerHandler)
return nullptr;
- int32_t id_event = m_pFormFillEnv->SetTimer(dwElapse, TimerProc);
+ int32_t id_event = m_pTimerHandler->SetTimer(dwElapse, TimerProc);
g_TimerArray->push_back(
pdfium::MakeUnique<CFWL_FWLAdapterTimerInfo>(this, id_event, pTimer));
return g_TimerArray->back().get();
}
void CXFA_FWLAdapterTimerMgr::Stop(CFWL_TimerInfo* pTimerInfo) {
- if (!pTimerInfo || !m_pFormFillEnv)
+ if (!pTimerInfo || !m_pTimerHandler)
return;
CFWL_FWLAdapterTimerInfo* pInfo =
static_cast<CFWL_FWLAdapterTimerInfo*>(pTimerInfo);
- m_pFormFillEnv->KillTimer(pInfo->idEvent);
+ m_pTimerHandler->KillTimer(pInfo->idEvent);
if (!g_TimerArray)
return;
diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
index bb5afb8..3c477b8 100644
--- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
+++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h
@@ -9,14 +9,14 @@
#include <vector>
+#include "core/fxcrt/timerhandler_iface.h"
#include "core/fxcrt/unowned_ptr.h"
-#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fwl/cfwl_timerinfo.h"
#include "xfa/fwl/ifwl_adaptertimermgr.h"
class CXFA_FWLAdapterTimerMgr final : public IFWL_AdapterTimerMgr {
public:
- explicit CXFA_FWLAdapterTimerMgr(CPDFSDK_FormFillEnvironment* pFormFillEnv);
+ explicit CXFA_FWLAdapterTimerMgr(TimerHandlerIface* pTimerHandler);
~CXFA_FWLAdapterTimerMgr() override;
CFWL_TimerInfo* Start(CFWL_Timer* pTimer,
@@ -25,7 +25,7 @@
void Stop(CFWL_TimerInfo* pTimerInfo) override;
private:
- UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
+ UnownedPtr<TimerHandlerIface> const m_pTimerHandler;
};
#endif // FPDFSDK_FPDFXFA_CXFA_FWLADAPTERTIMERMGR_H_