Chromium Code Reviews| 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 "xfa/fxfa/parser/xfa_script_imp.h" | 7 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxfa/app/xfa_ffnotify.h" | 10 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 m_mapXFAToHValue.RemoveAll(); | 46 m_mapXFAToHValue.RemoveAll(); |
| 47 ReleaseVariablesMap(); | 47 ReleaseVariablesMap(); |
| 48 if (m_hFM2JSContext) { | 48 if (m_hFM2JSContext) { |
| 49 XFA_FM2JS_ContextRelease(m_hFM2JSContext); | 49 XFA_FM2JS_ContextRelease(m_hFM2JSContext); |
| 50 m_hFM2JSContext = NULL; | 50 m_hFM2JSContext = NULL; |
| 51 } | 51 } |
| 52 if (m_hJsContext) { | 52 if (m_hJsContext) { |
| 53 FXJSE_Context_Release(m_hJsContext); | 53 FXJSE_Context_Release(m_hJsContext); |
| 54 m_hJsContext = NULL; | 54 m_hJsContext = NULL; |
| 55 } | 55 } |
| 56 if (m_pResolveProcessor) { | 56 delete m_pResolveProcessor; |
| 57 delete m_pResolveProcessor; | |
| 58 m_pResolveProcessor = NULL; | |
| 59 } | |
| 60 m_upObjectArray.RemoveAll(); | 57 m_upObjectArray.RemoveAll(); |
| 61 for (int32_t i = 0; i < m_CacheListArray.GetSize(); i++) | 58 for (int32_t i = 0; i < m_CacheListArray.GetSize(); i++) |
| 62 delete m_CacheListArray[i]; | 59 delete m_CacheListArray[i]; |
| 63 } | 60 } |
| 64 void CXFA_ScriptContext::Initialize(FXJSE_HRUNTIME hRuntime) { | 61 void CXFA_ScriptContext::Initialize(FXJSE_HRUNTIME hRuntime) { |
| 65 m_hJsRuntime = hRuntime; | 62 m_hJsRuntime = hRuntime; |
| 66 DefineJsContext(); | 63 DefineJsContext(); |
| 67 DefineJsClass(); | 64 DefineJsClass(); |
| 68 m_pResolveProcessor = new CXFA_ResolveProcessor; | 65 m_pResolveProcessor = new CXFA_ResolveProcessor; |
| 69 } | 66 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 } | 505 } |
| 509 return bRes; | 506 return bRes; |
| 510 } | 507 } |
| 511 void CXFA_ScriptContext::ReleaseVariablesMap() { | 508 void CXFA_ScriptContext::ReleaseVariablesMap() { |
| 512 FX_POSITION ps = m_mapVariableToHValue.GetStartPosition(); | 509 FX_POSITION ps = m_mapVariableToHValue.GetStartPosition(); |
| 513 while (ps) { | 510 while (ps) { |
| 514 CXFA_Object* pScriptNode; | 511 CXFA_Object* pScriptNode; |
| 515 FXJSE_HCONTEXT hVariableContext; | 512 FXJSE_HCONTEXT hVariableContext; |
| 516 m_mapVariableToHValue.GetNextAssoc(ps, pScriptNode, hVariableContext); | 513 m_mapVariableToHValue.GetNextAssoc(ps, pScriptNode, hVariableContext); |
| 517 FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(hVariableContext); | 514 FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(hVariableContext); |
| 518 CXFA_Object* lpCurNode = (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); | 515 CXFA_Object* lpCurNode = (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); |
|
Tom Sepez
2016/04/28 21:47:22
Local not needed
Lei Zhang
2016/04/28 22:31:10
Done.
| |
| 519 if (lpCurNode) { | 516 delete lpCurNode; |
|
Tom Sepez
2016/04/28 21:47:22
virtual dtor, I presume?
Lei Zhang
2016/04/28 22:31:10
Sadly, no.
| |
| 520 delete (CXFA_ThisProxy*)lpCurNode; | 517 lpCurNode = nullptr; |
|
Tom Sepez
2016/04/28 21:47:22
Not needed, right?
Lei Zhang
2016/04/28 22:31:10
Done.
| |
| 521 lpCurNode = NULL; | |
| 522 } | |
| 523 FXJSE_Value_Release(hObject); | 518 FXJSE_Value_Release(hObject); |
| 524 FXJSE_Context_Release(hVariableContext); | 519 FXJSE_Context_Release(hVariableContext); |
| 525 hVariableContext = NULL; | 520 hVariableContext = NULL; |
| 526 } | 521 } |
| 527 m_mapVariableToHValue.RemoveAll(); | 522 m_mapVariableToHValue.RemoveAll(); |
| 528 } | 523 } |
| 529 void CXFA_ScriptContext::DefineJsClass() { | 524 void CXFA_ScriptContext::DefineJsClass() { |
| 530 m_JsNormalClass.constructor = NULL; | 525 m_JsNormalClass.constructor = NULL; |
| 531 m_JsNormalClass.name = "XFAObject"; | 526 m_JsNormalClass.name = "XFAObject"; |
| 532 m_JsNormalClass.propNum = 0; | 527 m_JsNormalClass.propNum = 0; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 } | 759 } |
| 765 } | 760 } |
| 766 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { | 761 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { |
| 767 if (!m_pScriptNodeArray) { | 762 if (!m_pScriptNodeArray) { |
| 768 return; | 763 return; |
| 769 } | 764 } |
| 770 if (m_pScriptNodeArray->Find(pNode) == -1) { | 765 if (m_pScriptNodeArray->Find(pNode) == -1) { |
| 771 m_pScriptNodeArray->Add(pNode); | 766 m_pScriptNodeArray->Add(pNode); |
| 772 } | 767 } |
| 773 } | 768 } |
| OLD | NEW |