Resolve additional non-performant std::move() issues. See the list in the linked bug for details. -- Don't move into find(T&). -- Don't pass RetainPtr by reference. -- Don't move from T*. Bug: 364788123 Change-Id: Id5a563b8dce9e772225f5ae9eb301a07cb64e18f Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/124090 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 0f6afc9..0d0cfd0 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -481,7 +481,7 @@ return; pStreamAcc.Reset(); // Drop moved caller's reference. - auto it = m_FontFileMap.find(std::move(pFontStream)); + auto it = m_FontFileMap.find(pFontStream); if (it != m_FontFileMap.end() && it->second->HasOneRef()) m_FontFileMap.erase(it); }
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index fa4b73f..f289d1f 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -620,7 +620,7 @@ int dest_top, int width, int height, - const RetainPtr<const CFX_DIBBase>& pMask, + RetainPtr<const CFX_DIBBase> pMask, uint32_t color, int src_left, int src_top,
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index 7464bf3..0d4ff42 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h
@@ -125,7 +125,7 @@ int dest_top, int width, int height, - const RetainPtr<const CFX_DIBBase>& pMask, + RetainPtr<const CFX_DIBBase> pMask, uint32_t color, int src_left, int src_top,
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index bb79069..08c7817 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp
@@ -313,7 +313,7 @@ } if (pFakeXMLRoot) { - pFakeRoot->SetXMLMappingNode(std::move(pFakeXMLRoot)); + pFakeRoot->SetXMLMappingNode(pFakeXMLRoot); } pFakeRoot->SetFlag(XFA_NodeFlag::kHasRemovedChildren);
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index a90c0cc..77e6aba 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -362,7 +362,7 @@ } CXFA_FontMgr* pFontMgr = doc->GetApp()->GetXFAFontMgr(); - return pFontMgr->GetFont(doc, std::move(wsFamily), dwStyle); + return pFontMgr->GetFont(doc, wsFamily, dwStyle); } float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 3da69e3..251e3fa 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -1285,7 +1285,7 @@ notify_(notify), node_owner_(cppgc::MakeGarbageCollected<CXFA_NodeOwner>( heap->GetAllocationHandle())), - m_pLayoutProcessor(std::move(pLayout)) { + m_pLayoutProcessor(pLayout) { if (m_pLayoutProcessor) m_pLayoutProcessor->SetDocument(this); }