From 0024a22b4a793630a1a8e8d85c4525c7b82a3ed7 Mon Sep 17 00:00:00 2001 From: weili Date: Sun, 24 Jul 2016 08:26:49 -0700 Subject: Remove CFX_Deletable Change the last use of CFX_Deletable to its actual type and remove the use of CFX_Deletable. Review-Url: https://codereview.chromium.org/2178613002 --- core/fxcodec/jbig2/JBig2_Context.cpp | 6 +++--- core/fxcodec/jbig2/JBig2_Context.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'core/fxcodec/jbig2') diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 1e4c35a625..256ce3910a 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -591,7 +591,8 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, if (it->first == key) { std::unique_ptr copy(it->second->DeepCopy()); pSegment->m_Result.sd = copy.release(); - m_pSymbolDictCache->push_front(*it); + m_pSymbolDictCache->push_front( + CJBig2_CachePair(key, std::move(it->second))); m_pSymbolDictCache->erase(it); cache_hit = true; break; @@ -621,11 +622,10 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, pSegment->m_Result.sd->DeepCopy(); int size = pdfium::CollectionSize(*m_pSymbolDictCache); while (size >= kSymbolDictCacheMaxSize) { - delete m_pSymbolDictCache->back().second; m_pSymbolDictCache->pop_back(); --size; } - m_pSymbolDictCache->push_front(CJBig2_CachePair(key, value.release())); + m_pSymbolDictCache->push_front(CJBig2_CachePair(key, std::move(value))); } } if (wFlags & 0x0200) { diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 1577b22d37..a0e1a8fcac 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -25,8 +25,8 @@ class IFX_Pause; // Cache is keyed by the ObjNum of a stream and an index within the stream. using CJBig2_CacheKey = std::pair; -// NB: CJBig2_SymbolDict* is owned. -using CJBig2_CachePair = std::pair; +using CJBig2_CachePair = + std::pair>; #define JBIG2_SUCCESS 0 #define JBIG2_FAILED -1 -- cgit v1.2.3