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

Side by Side Diff: xfa/fxfa/parser/xfa_object_imp.cpp

Issue 2062113002: Cleanup ownership in CXFA_ScriptContext. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review feedback Created 4 years, 6 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 | xfa/fxfa/parser/xfa_script_imp.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 "xfa/fxfa/parser/xfa_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 5068 matching lines...) Expand 10 before | Expand all | Expand 10 after
5079 for (; pSrcChild && pDstChild; 5079 for (; pSrcChild && pDstChild;
5080 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), 5080 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling),
5081 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 5081 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
5082 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); 5082 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE);
5083 } 5083 }
5084 } 5084 }
5085 pSrcModule->MoveBufferMapData(pDstModule, pKey); 5085 pSrcModule->MoveBufferMapData(pDstModule, pKey);
5086 } 5086 }
5087 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) 5087 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
5088 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { 5088 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) {
5089 m_pDocument->GetScriptContext()->CacheList(this); 5089 m_pDocument->GetScriptContext()->AddToCacheList(
5090 std::unique_ptr<CXFA_NodeList>(this));
5090 } 5091 }
5091 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { 5092 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
5092 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); 5093 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false);
5093 int32_t iCount = GetLength(); 5094 int32_t iCount = GetLength();
5094 for (int32_t i = 0; i < iCount; i++) { 5095 for (int32_t i = 0; i < iCount; i++) {
5095 CXFA_Node* ret = Item(i); 5096 CXFA_Node* ret = Item(i);
5096 if (dwHashCode == ret->GetNameHash()) 5097 if (dwHashCode == ret->GetNameHash())
5097 return ret; 5098 return ret;
5098 } 5099 }
5099 return nullptr; 5100 return nullptr;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5248 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5249 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5249 } 5250 }
5250 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5251 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5251 return m_pAttachNode->RemoveChild(pNode); 5252 return m_pAttachNode->RemoveChild(pNode);
5252 } 5253 }
5253 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5254 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5254 return m_pAttachNode->GetChild( 5255 return m_pAttachNode->GetChild(
5255 iIndex, XFA_ELEMENT_UNKNOWN, 5256 iIndex, XFA_ELEMENT_UNKNOWN,
5256 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5257 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5257 } 5258 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fxfa/parser/xfa_script_imp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698