From 4d5c1c96366637604b1900f462804dc427bbe403 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 21 Aug 2018 20:55:07 +0000 Subject: Avoid copying some big vectors in JBIG2_SymbolDict Change-Id: I662f65b53a1a17be0062c92452d82acbbe157477 Reviewed-on: https://pdfium-review.googlesource.com/40910 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcodec/jbig2/JBig2_Context.cpp | 4 ++-- core/fxcodec/jbig2/JBig2_SymbolDict.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index d976abdf31..d019cc148e 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -603,9 +603,9 @@ JBig2_Result CJBig2_Context::ParseSymbolDict(CJBig2_Segment* pSegment) { } if (wFlags & 0x0200) { if (bUseGbContext) - pSegment->m_SymbolDict->SetGbContext(gbContext); + pSegment->m_SymbolDict->SetGbContext(std::move(gbContext)); if (bUseGrContext) - pSegment->m_SymbolDict->SetGrContext(grContext); + pSegment->m_SymbolDict->SetGrContext(std::move(grContext)); } return JBig2_Result::kSuccess; } diff --git a/core/fxcodec/jbig2/JBig2_SymbolDict.h b/core/fxcodec/jbig2/JBig2_SymbolDict.h index 83c419637a..956c83b12f 100644 --- a/core/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/fxcodec/jbig2/JBig2_SymbolDict.h @@ -32,11 +32,11 @@ class CJBig2_SymbolDict { const std::vector& GbContext() const { return m_gbContext; } const std::vector& GrContext() const { return m_grContext; } - void SetGbContext(const std::vector& gbContext) { - m_gbContext = gbContext; + void SetGbContext(std::vector gbContext) { + m_gbContext = std::move(gbContext); } - void SetGrContext(const std::vector& grContext) { - m_grContext = grContext; + void SetGrContext(std::vector grContext) { + m_grContext = std::move(grContext); } private: -- cgit v1.2.3