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 #ifndef _JS_OBJECT_H_ | 7 #ifndef _JS_OBJECT_H_ |
8 #define _JS_OBJECT_H_ | 8 #define _JS_OBJECT_H_ |
9 | 9 |
10 class CJS_Object; | 10 class CJS_Object; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return i; | 150 return i; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 return -1; | 154 return -1; |
155 } | 155 } |
156 | 156 |
157 CTimerMapArray m_Array; | 157 CTimerMapArray m_Array; |
158 }; | 158 }; |
159 | 159 |
160 static JS_TIMER_MAPARRAY» m_sTimeMap; | 160 JS_TIMER_MAPARRAY& GetTimeMap(); |
161 | 161 |
162 class CJS_Runtime; | 162 class CJS_Runtime; |
163 | 163 |
164 class CJS_Timer | 164 class CJS_Timer |
165 { | 165 { |
166 public: | 166 public: |
167 CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): | 167 CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): |
168 m_nTimerID(0), | 168 m_nTimerID(0), |
169 m_pEmbedObj(pObj), | 169 m_pEmbedObj(pObj), |
170 m_bProcessing(FALSE), | 170 m_bProcessing(FALSE), |
(...skipping 10 matching lines...) Expand all Loading... |
181 { | 181 { |
182 KillJSTimer(); | 182 KillJSTimer(); |
183 } | 183 } |
184 | 184 |
185 public: | 185 public: |
186 FX_UINT SetJSTimer(FX_UINT nElapse) | 186 FX_UINT SetJSTimer(FX_UINT nElapse) |
187 { | 187 { |
188 if (m_nTimerID)KillJSTimer(); | 188 if (m_nTimerID)KillJSTimer(); |
189 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); | 189 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); |
190 m_nTimerID = pHandler->SetTimer(nElapse,TimerProc); | 190 m_nTimerID = pHandler->SetTimer(nElapse,TimerProc); |
191 » » m_sTimeMap.SetAt(m_nTimerID,this); | 191 » » GetTimeMap().SetAt(m_nTimerID,this); |
192 m_dwElapse = nElapse; | 192 m_dwElapse = nElapse; |
193 return m_nTimerID; | 193 return m_nTimerID; |
194 }; | 194 }; |
195 | 195 |
196 void KillJSTimer() | 196 void KillJSTimer() |
197 { | 197 { |
198 if (m_nTimerID) | 198 if (m_nTimerID) |
199 { | 199 { |
200 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); | 200 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); |
201 pHandler->KillTimer(m_nTimerID); | 201 pHandler->KillTimer(m_nTimerID); |
202 » » » m_sTimeMap.RemoveAt(m_nTimerID); | 202 » » » GetTimeMap().RemoveAt(m_nTimerID); |
203 m_nTimerID = 0; | 203 m_nTimerID = 0; |
204 } | 204 } |
205 }; | 205 }; |
206 | 206 |
207 void SetType(int nType) | 207 void SetType(int nType) |
208 { | 208 { |
209 m_nType = nType; | 209 m_nType = nType; |
210 } | 210 } |
211 | 211 |
212 int GetType() const | 212 int GetType() const |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 m_swJScript = script; | 249 m_swJScript = script; |
250 } | 250 } |
251 | 251 |
252 CFX_WideString GetJScript() const | 252 CFX_WideString GetJScript() const |
253 { | 253 { |
254 return m_swJScript; | 254 return m_swJScript; |
255 } | 255 } |
256 | 256 |
257 static void TimerProc(int idEvent) | 257 static void TimerProc(int idEvent) |
258 { | 258 { |
259 » » if (CJS_Timer * pTimer = m_sTimeMap.GetAt(idEvent)) | 259 » » if (CJS_Timer * pTimer = GetTimeMap().GetAt(idEvent)) |
260 { | 260 { |
261 if (!pTimer->m_bProcessing) | 261 if (!pTimer->m_bProcessing) |
262 { | 262 { |
263 pTimer->m_bProcessing = TRUE; | 263 pTimer->m_bProcessing = TRUE; |
264 if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->Ti
merProc(pTimer); | 264 if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->Ti
merProc(pTimer); |
265 pTimer->m_bProcessing = FALSE; | 265 pTimer->m_bProcessing = FALSE; |
266 } | 266 } |
267 else | 267 else |
268 { | 268 { |
269 // TRACE(L"BUSY!\n"); | 269 // TRACE(L"BUSY!\n"); |
(...skipping 10 matching lines...) Expand all Loading... |
280 FX_DWORD m_dwStar
tTime; | 280 FX_DWORD m_dwStar
tTime; |
281 FX_DWORD m_dwTime
Out; | 281 FX_DWORD m_dwTime
Out; |
282 FX_DWORD m_dwElapse; | 282 FX_DWORD m_dwElapse; |
283 CJS_Runtime* m_pRuntime; | 283 CJS_Runtime* m_pRuntime; |
284 CFX_WideString m_swJScript; | 284 CFX_WideString m_swJScript; |
285 int m_nType;
//0:Interval; 1:TimeOut | 285 int m_nType;
//0:Interval; 1:TimeOut |
286 | 286 |
287 CPDFDoc_Environment* m_pApp; | 287 CPDFDoc_Environment* m_pApp; |
288 }; | 288 }; |
289 #endif //_JS_OBJECT_H_ | 289 #endif //_JS_OBJECT_H_ |
OLD | NEW |