Mark GlobalTimer::m_nTimerID as const.
Initialize it in the initializer list. Also initialize m_bProcessing in
the header.
Change-Id: I3316927b4ad80218c10b6786cebe2beebdc4c4d7
Reviewed-on: https://pdfium-review.googlesource.com/c/47950
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/global_timer.cpp b/fxjs/global_timer.cpp
index 8027820..f4d16a5 100644
--- a/fxjs/global_timer.cpp
+++ b/fxjs/global_timer.cpp
@@ -15,16 +15,13 @@
const WideString& script,
uint32_t dwElapse,
uint32_t dwTimeOut)
- : m_nTimerID(0),
+ : m_nTimerID(pFormFillEnv->GetSysHandler()->SetTimer(dwElapse, Trigger)),
m_pEmbedApp(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;
}
diff --git a/fxjs/global_timer.h b/fxjs/global_timer.h
index 83081f6..0bb0d41 100644
--- a/fxjs/global_timer.h
+++ b/fxjs/global_timer.h
@@ -38,9 +38,9 @@
using TimerMap = std::map<uint32_t, GlobalTimer*>;
static TimerMap* GetGlobalTimerMap();
- uint32_t m_nTimerID;
+ const uint32_t m_nTimerID;
CJS_App* const m_pEmbedApp;
- bool m_bProcessing;
+ bool m_bProcessing = false;
// data
const int m_nType; // 0:Interval; 1:TimeOut