Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: fpdfsdk/fpdfxfa/fpdfxfa_util.cpp

Issue 1952693003: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/fpdfxfa/include/fpdfxfa_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "fpdfsdk/include/fsdk_define.h" 11 #include "fpdfsdk/include/fsdk_define.h"
12 #include "fpdfsdk/include/fsdk_mgr.h" 12 #include "fpdfsdk/include/fsdk_mgr.h"
13 13
14 std::vector<CFWL_TimerInfo*>* CXFA_FWLAdapterTimerMgr::s_TimerArray = nullptr; 14 std::vector<CFWL_TimerInfo*>* CXFA_FWLAdapterTimerMgr::s_TimerArray = nullptr;
15 15
16 FWL_ERR CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer, 16 FWL_Error CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer,
17 uint32_t dwElapse, 17 uint32_t dwElapse,
18 FWL_HTIMER& hTimer, 18 FWL_HTIMER& hTimer,
19 FX_BOOL bImmediately) { 19 FX_BOOL bImmediately) {
20 if (!m_pEnv) 20 if (!m_pEnv)
21 return FWL_ERR_Indefinite; 21 return FWL_Error::Indefinite;
22 22
23 int32_t id_event = m_pEnv->FFI_SetTimer(dwElapse, TimerProc); 23 int32_t id_event = m_pEnv->FFI_SetTimer(dwElapse, TimerProc);
24 if (!s_TimerArray) 24 if (!s_TimerArray)
25 s_TimerArray = new std::vector<CFWL_TimerInfo*>; 25 s_TimerArray = new std::vector<CFWL_TimerInfo*>;
26 s_TimerArray->push_back(new CFWL_TimerInfo(id_event, pTimer)); 26 s_TimerArray->push_back(new CFWL_TimerInfo(id_event, pTimer));
27 hTimer = reinterpret_cast<FWL_HTIMER>(s_TimerArray->back()); 27 hTimer = reinterpret_cast<FWL_HTIMER>(s_TimerArray->back());
28 return FWL_ERR_Succeeded; 28 return FWL_Error::Succeeded;
29 } 29 }
30 30
31 FWL_ERR CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) { 31 FWL_Error CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) {
32 if (!hTimer || !m_pEnv) 32 if (!hTimer || !m_pEnv)
33 return FWL_ERR_Indefinite; 33 return FWL_Error::Indefinite;
34 34
35 CFWL_TimerInfo* pInfo = reinterpret_cast<CFWL_TimerInfo*>(hTimer); 35 CFWL_TimerInfo* pInfo = reinterpret_cast<CFWL_TimerInfo*>(hTimer);
36 m_pEnv->FFI_KillTimer(pInfo->idEvent); 36 m_pEnv->FFI_KillTimer(pInfo->idEvent);
37 if (s_TimerArray) { 37 if (s_TimerArray) {
38 auto it = std::find(s_TimerArray->begin(), s_TimerArray->end(), pInfo); 38 auto it = std::find(s_TimerArray->begin(), s_TimerArray->end(), pInfo);
39 if (it != s_TimerArray->end()) { 39 if (it != s_TimerArray->end()) {
40 s_TimerArray->erase(it); 40 s_TimerArray->erase(it);
41 delete pInfo; 41 delete pInfo;
42 } 42 }
43 } 43 }
44 return FWL_ERR_Succeeded; 44 return FWL_Error::Succeeded;
45 } 45 }
46 46
47 // static 47 // static
48 void CXFA_FWLAdapterTimerMgr::TimerProc(int32_t idEvent) { 48 void CXFA_FWLAdapterTimerMgr::TimerProc(int32_t idEvent) {
49 if (!s_TimerArray) 49 if (!s_TimerArray)
50 return; 50 return;
51 51
52 for (CFWL_TimerInfo* pInfo : *s_TimerArray) { 52 for (CFWL_TimerInfo* pInfo : *s_TimerArray) {
53 if (pInfo->idEvent == idEvent) { 53 if (pInfo->idEvent == idEvent) {
54 pInfo->pTimer->Run(reinterpret_cast<FWL_HTIMER>(pInfo)); 54 pInfo->pTimer->Run(reinterpret_cast<FWL_HTIMER>(pInfo));
55 break; 55 break;
56 } 56 }
57 } 57 }
58 } 58 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fpdfxfa/include/fpdfxfa_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698