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

Side by Side Diff: xfa/fgas/crt/fgas_memory.cpp

Issue 2453163002: Take advantage of implicit std::unique_ptr<>(nulltpr_t) ctor. (Closed)
Patch Set: Created 4 years, 1 month 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 | « fpdfsdk/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | 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/fgas/crt/fgas_memory.h" 7 #include "xfa/fgas/crt/fgas_memory.h"
8 8
9 #ifndef MEMORY_TOOL_REPLACES_ALLOCATOR 9 #ifndef MEMORY_TOOL_REPLACES_ALLOCATOR
10 // Use CFX_DefStore to replace CFX_FixedStore to simplify memory 10 // Use CFX_DefStore to replace CFX_FixedStore to simplify memory
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 new CFX_StaticStore(chunkSize)); 93 new CFX_StaticStore(chunkSize));
94 case FX_ALLOCTYPE_Fixed: 94 case FX_ALLOCTYPE_Fixed:
95 #ifdef MEMORY_TOOL_REPLACES_ALLOCATOR 95 #ifdef MEMORY_TOOL_REPLACES_ALLOCATOR
96 return std::unique_ptr<IFX_MemoryAllocator>(new CFX_DefStore()); 96 return std::unique_ptr<IFX_MemoryAllocator>(new CFX_DefStore());
97 #else 97 #else
98 return std::unique_ptr<IFX_MemoryAllocator>( 98 return std::unique_ptr<IFX_MemoryAllocator>(
99 new CFX_FixedStore(blockSize, chunkSize)); 99 new CFX_FixedStore(blockSize, chunkSize));
100 #endif // MEMORY_TOOL_REPLACES_ALLOCATOR 100 #endif // MEMORY_TOOL_REPLACES_ALLOCATOR
101 default: 101 default:
102 ASSERT(0); 102 ASSERT(0);
103 return std::unique_ptr<IFX_MemoryAllocator>(); 103 return nullptr;
104 } 104 }
105 } 105 }
106 106
107 CFX_StaticStore::CFX_StaticStore(size_t iDefChunkSize) 107 CFX_StaticStore::CFX_StaticStore(size_t iDefChunkSize)
108 : m_iAllocatedSize(0), 108 : m_iAllocatedSize(0),
109 m_iDefChunkSize(iDefChunkSize), 109 m_iDefChunkSize(iDefChunkSize),
110 m_pChunk(nullptr), 110 m_pChunk(nullptr),
111 m_pLastChunk(nullptr) { 111 m_pLastChunk(nullptr) {
112 ASSERT(m_iDefChunkSize != 0); 112 ASSERT(m_iDefChunkSize != 0);
113 } 113 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (!pPrior) { 245 if (!pPrior) {
246 m_pChunk = pChunk->pNextChunk; 246 m_pChunk = pChunk->pNextChunk;
247 } else { 247 } else {
248 pPrior->pNextChunk = pChunk->pNextChunk; 248 pPrior->pNextChunk = pChunk->pNextChunk;
249 } 249 }
250 FX_Free(pChunk); 250 FX_Free(pChunk);
251 } 251 }
252 } 252 }
253 253
254 #endif // MEMORY_TOOL_REPLACES_ALLOCATOR 254 #endif // MEMORY_TOOL_REPLACES_ALLOCATOR
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698