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

Unified Diff: xfa/fgas/crt/fgas_memory.cpp

Issue 2208423002: Use smart pointers for class owned pointers under xfa/fde (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: one more change Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fgas/crt/fgas_memory.h ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/crt/fgas_memory.cpp
diff --git a/xfa/fgas/crt/fgas_memory.cpp b/xfa/fgas/crt/fgas_memory.cpp
index d218f42aa418834329a285d311daf080f18a9e91..e587f5a5b0d49d1f3196773676857bf197086255 100644
--- a/xfa/fgas/crt/fgas_memory.cpp
+++ b/xfa/fgas/crt/fgas_memory.cpp
@@ -27,10 +27,11 @@ class CFX_DefStore : public IFX_MemoryAllocator, public CFX_Target {
} // namespace
-IFX_MemoryAllocator* IFX_MemoryAllocator::Create(FX_ALLOCTYPE eType,
- size_t chunkSize,
- size_t blockSize) {
- return new CFX_DefStore();
+std::unique_ptr<IFX_MemoryAllocator> IFX_MemoryAllocator::Create(
+ FX_ALLOCTYPE eType,
+ size_t chunkSize,
+ size_t blockSize) {
+ return std::unique_ptr<IFX_MemoryAllocator>(new CFX_DefStore());
}
#else // MEMORY_TOOL_REPLACES_ALLOCATOR
@@ -88,17 +89,19 @@ class CFX_FixedStore : public IFX_MemoryAllocator, public CFX_Target {
#define FX_4BYTEALIGN(size) (((size) + 3) & ~3)
-IFX_MemoryAllocator* IFX_MemoryAllocator::Create(FX_ALLOCTYPE eType,
- size_t chunkSize,
- size_t blockSize) {
+std::unique_ptr<IFX_MemoryAllocator> IFX_MemoryAllocator::Create(
+ FX_ALLOCTYPE eType,
+ size_t chunkSize,
+ size_t blockSize) {
switch (eType) {
case FX_ALLOCTYPE_Static:
- return new CFX_StaticStore(chunkSize);
+ return std::unique_ptr<IFX_MemoryAllocator>(
+ new CFX_StaticStore(chunkSize));
case FX_ALLOCTYPE_Fixed:
- return new CFX_FixedStore(blockSize, chunkSize);
+ return std::unique_ptr<IFX_MemoryAllocator>(new CFX_FixedStore(blockSize, chunkSize);
default:
ASSERT(0);
- return nullptr;
+ return std::unique_ptr<IFX_MemoryAllocator>();
}
}
« no previous file with comments | « xfa/fgas/crt/fgas_memory.h ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698