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 if (m_pApp == NULL) { | 200 if (m_pApp == NULL) { |
201 m_sTimeMap.RemoveAt(m_nTimerID); | 201 m_sTimeMap.RemoveAt(m_nTimerID); |
Bo Xu
2015/01/05 22:05:39
This one is not fixed?
brucedawson
2015/01/05 22:18:20
Good catch. I guess I'm merging over without enoug
| |
202 m_nTimerID = 0; | 202 m_nTimerID = 0; |
203 return; | 203 return; |
204 } | 204 } |
205 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); | 205 IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); |
206 pHandler->KillTimer(m_nTimerID); | 206 pHandler->KillTimer(m_nTimerID); |
207 » » » m_sTimeMap.RemoveAt(m_nTimerID); | 207 » » » GetTimeMap().RemoveAt(m_nTimerID); |
208 m_nTimerID = 0; | 208 m_nTimerID = 0; |
209 } | 209 } |
210 }; | 210 }; |
211 | 211 |
212 void SetType(int nType) | 212 void SetType(int nType) |
213 { | 213 { |
214 m_nType = nType; | 214 m_nType = nType; |
215 } | 215 } |
216 | 216 |
217 int GetType() const | 217 int GetType() const |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 m_swJScript = script; | 254 m_swJScript = script; |
255 } | 255 } |
256 | 256 |
257 CFX_WideString GetJScript() const | 257 CFX_WideString GetJScript() const |
258 { | 258 { |
259 return m_swJScript; | 259 return m_swJScript; |
260 } | 260 } |
261 | 261 |
262 static void TimerProc(int idEvent) | 262 static void TimerProc(int idEvent) |
263 { | 263 { |
264 » » if (CJS_Timer * pTimer = m_sTimeMap.GetAt(idEvent)) | 264 » » if (CJS_Timer * pTimer = GetTimeMap().GetAt(idEvent)) |
265 { | 265 { |
266 if (!pTimer->m_bProcessing) | 266 if (!pTimer->m_bProcessing) |
267 { | 267 { |
268 pTimer->m_bProcessing = TRUE; | 268 pTimer->m_bProcessing = TRUE; |
269 if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->Ti merProc(pTimer); | 269 if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->Ti merProc(pTimer); |
270 pTimer->m_bProcessing = FALSE; | 270 pTimer->m_bProcessing = FALSE; |
271 } | 271 } |
272 else | 272 else |
273 { | 273 { |
274 // TRACE(L"BUSY!\n"); | 274 // TRACE(L"BUSY!\n"); |
(...skipping 10 matching lines...) Expand all Loading... | |
285 FX_DWORD m_dwStartTime; | 285 FX_DWORD m_dwStartTime; |
286 FX_DWORD m_dwTimeOut; | 286 FX_DWORD m_dwTimeOut; |
287 FX_DWORD m_dwElapse; | 287 FX_DWORD m_dwElapse; |
288 CJS_Runtime* m_pRuntime; | 288 CJS_Runtime* m_pRuntime; |
289 CFX_WideString m_swJScript; | 289 CFX_WideString m_swJScript; |
290 int m_nType; //0:Interval; 1:TimeOut | 290 int m_nType; //0:Interval; 1:TimeOut |
291 | 291 |
292 CPDFDoc_Environment* m_pApp; | 292 CPDFDoc_Environment* m_pApp; |
293 }; | 293 }; |
294 #endif //_JS_OBJECT_H_ | 294 #endif //_JS_OBJECT_H_ |
OLD | NEW |