| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/fsdk_define.h" | 7 #include "../../include/fsdk_define.h" |
| 8 #include "../../include/fsdk_mgr.h" | 8 #include "../../include/fsdk_mgr.h" |
| 9 #include "../../include/fpdfxfa/fpdfxfa_util.h" | 9 #include "../../include/fpdfxfa/fpdfxfa_util.h" |
| 10 | 10 |
| 11 CFX_PtrArray CXFA_FWLAdapterTimerMgr::ms_timerArray; | 11 CFX_PtrArray CXFA_FWLAdapterTimerMgr::ms_timerArray; |
| 12 | 12 |
| 13 FWL_ERR CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer *pTimer, FX_DWORD dwElapse, FW
L_HTIMER &hTimer, FX_BOOL bImmediately /* = TRUE */) | 13 FWL_ERR CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer *pTimer, FX_DWORD dwElapse, FW
L_HTIMER &hTimer, FX_BOOL bImmediately /* = TRUE */) |
| 14 { | 14 { |
| 15 if (m_pEnv) | 15 if (m_pEnv) |
| 16 { | 16 { |
| 17 » » FX_UINT32 uIDEvent = m_pEnv->FFI_SetTimer(dwElapse, TimerProc); | 17 » » uint32_t uIDEvent = m_pEnv->FFI_SetTimer(dwElapse, TimerProc); |
| 18 CFWL_TimerInfo *pInfo = FX_NEW CFWL_TimerInfo; | 18 CFWL_TimerInfo *pInfo = FX_NEW CFWL_TimerInfo; |
| 19 pInfo->uIDEvent = uIDEvent; | 19 pInfo->uIDEvent = uIDEvent; |
| 20 pInfo->pTimer = pTimer; | 20 pInfo->pTimer = pTimer; |
| 21 ms_timerArray.Add(pInfo); | 21 ms_timerArray.Add(pInfo); |
| 22 | 22 |
| 23 hTimer = (FWL_HTIMER)pInfo; | 23 hTimer = (FWL_HTIMER)pInfo; |
| 24 return FWL_ERR_Succeeded; | 24 return FWL_ERR_Succeeded; |
| 25 } | 25 } |
| 26 | 26 |
| 27 return FWL_ERR_Indefinite; | 27 return FWL_ERR_Indefinite; |
| 28 } | 28 } |
| 29 | 29 |
| 30 FWL_ERR CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) | 30 FWL_ERR CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) |
| 31 { | 31 { |
| 32 if (!hTimer) return FWL_ERR_Indefinite; | 32 if (!hTimer) return FWL_ERR_Indefinite; |
| 33 | 33 |
| 34 if (m_pEnv) | 34 if (m_pEnv) |
| 35 { | 35 { |
| 36 CFWL_TimerInfo *pInfo = (CFWL_TimerInfo*)hTimer; | 36 CFWL_TimerInfo *pInfo = (CFWL_TimerInfo*)hTimer; |
| 37 | 37 |
| 38 m_pEnv->FFI_KillTimer(pInfo->uIDEvent); | 38 m_pEnv->FFI_KillTimer(pInfo->uIDEvent); |
| 39 | 39 |
| 40 » » FX_INT32 index = ms_timerArray.Find(pInfo); | 40 » » int32_t index = ms_timerArray.Find(pInfo); |
| 41 if (index >= 0) | 41 if (index >= 0) |
| 42 { | 42 { |
| 43 ms_timerArray.RemoveAt(index); | 43 ms_timerArray.RemoveAt(index); |
| 44 delete pInfo; | 44 delete pInfo; |
| 45 } | 45 } |
| 46 return FWL_ERR_Succeeded; | 46 return FWL_ERR_Succeeded; |
| 47 } | 47 } |
| 48 | 48 |
| 49 return FWL_ERR_Indefinite; | 49 return FWL_ERR_Indefinite; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void CXFA_FWLAdapterTimerMgr::TimerProc(FX_INT32 idEvent) | 52 void CXFA_FWLAdapterTimerMgr::TimerProc(int32_t idEvent) |
| 53 { | 53 { |
| 54 CFWL_TimerInfo *pInfo = NULL; | 54 CFWL_TimerInfo *pInfo = NULL; |
| 55 » FX_INT32 iCount = CXFA_FWLAdapterTimerMgr::ms_timerArray.GetSize(); | 55 » int32_t iCount = CXFA_FWLAdapterTimerMgr::ms_timerArray.GetSize(); |
| 56 » for (FX_INT32 i = 0; i < iCount; i++) | 56 » for (int32_t i = 0; i < iCount; i++) |
| 57 { | 57 { |
| 58 CFWL_TimerInfo *pTemp = (CFWL_TimerInfo*)CXFA_FWLAdapterTimerMgr
::ms_timerArray.GetAt(i); | 58 CFWL_TimerInfo *pTemp = (CFWL_TimerInfo*)CXFA_FWLAdapterTimerMgr
::ms_timerArray.GetAt(i); |
| 59 if (pTemp->uIDEvent == idEvent) | 59 if (pTemp->uIDEvent == idEvent) |
| 60 { | 60 { |
| 61 pInfo = pTemp; break; | 61 pInfo = pTemp; break; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 if (pInfo) | 64 if (pInfo) |
| 65 { | 65 { |
| 66 pInfo->pTimer->Run((FWL_HTIMER)pInfo); | 66 pInfo->pTimer->Run((FWL_HTIMER)pInfo); |
| 67 } | 67 } |
| 68 } | 68 } |
| OLD | NEW |