summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
commit606346f584700bdae0741066f2e6d2481744032c (patch)
tree8f6afe79644cc515795af83dc8a06b207afb1bd6 /fpdfsdk/src/pdfwindow
parent6d8b1c2c7b1cbada20109f70ae971a4192330bb5 (diff)
downloadpdfium-606346f584700bdae0741066f2e6d2481744032c.tar.xz
Merge to XFA: Replace some CFX_MapPtrTemplates with std::map.
There are more CFX_MapPtrTemplate usage on the XFA branch, so it is not removed. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1181593003. (cherry picked from commit e8d3691c82d1be805ffdce3329d00313af7ce0ab) Review URL: https://codereview.chromium.org/1198663004.
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Wnd.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index dcc6e409a4..89d4babcd7 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <map>
+
#include "../../include/pdfwindow/PDFWindow.h"
#include "../../include/pdfwindow/PWL_Wnd.h"
#include "../../include/pdfwindow/PWL_Utils.h"
@@ -11,10 +13,10 @@
/* -------------------------- CPWL_Timer -------------------------- */
-static CFX_MapPtrTemplate<int32_t, CPWL_Timer*>& GetPWLTimeMap()
+static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap()
{
// Leak the object at shutdown.
- static auto timeMap = new CFX_MapPtrTemplate<int32_t, CPWL_Timer*>;
+ static auto timeMap = new std::map<int32_t, CPWL_Timer*>;
return *timeMap;
}
@@ -34,33 +36,33 @@ CPWL_Timer::~CPWL_Timer()
int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse)
{
- if (m_nTimerID != 0) KillPWLTimer();
- m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
- GetPWLTimeMap().SetAt(m_nTimerID, this);
- return m_nTimerID;
+ if (m_nTimerID != 0)
+ KillPWLTimer();
+ m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
+
+ GetPWLTimeMap()[m_nTimerID] = this;
+ return m_nTimerID;
}
void CPWL_Timer::KillPWLTimer()
{
- if (m_nTimerID != 0)
- {
- m_pSystemHandler->KillTimer(m_nTimerID);
- GetPWLTimeMap().RemoveKey(m_nTimerID);
- m_nTimerID = 0;
- }
+ if (m_nTimerID == 0)
+ return;
+
+ m_pSystemHandler->KillTimer(m_nTimerID);
+ GetPWLTimeMap().erase(m_nTimerID);
+ m_nTimerID = 0;
}
void CPWL_Timer::TimerProc(int32_t idEvent)
{
- CPWL_Timer* pTimer = NULL;
- if (GetPWLTimeMap().Lookup(idEvent, pTimer))
- {
- if (pTimer)
- {
- if (pTimer->m_pAttached)
- pTimer->m_pAttached->TimerProc();
- }
- }
+ auto it = GetPWLTimeMap().find(idEvent);
+ if (it == GetPWLTimeMap().end())
+ return;
+
+ CPWL_Timer* pTimer = it->second;
+ if (pTimer->m_pAttached)
+ pTimer->m_pAttached->TimerProc();
}
/* -------------------------- CPWL_TimerHandler -------------------------- */