// Copyright 2019 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CORE_FXCRT_FX_MEMORY_WRAPPERS_H_ #define CORE_FXCRT_FX_MEMORY_WRAPPERS_H_ #include <limits> #include <type_traits> #include <utility> #include "core/fxcrt/fx_memory.h" // Used with std::unique_ptr to FX_Free raw memory. struct FxFreeDeleter { … }; // Escape hatch mechanism to allow non_arithmetic types into data partition. template <typename T> struct IsFXDataPartitionException : std::false_type { … }; // Use with caution. No further checks are made to see if `T` is appropriate // for the Data Partition (e.g. no pointers, strings, vtables, etc.). This // declaration must occur in the top-level namespace. #define FX_DATA_PARTITION_EXCEPTION(T) … // Allocators for mapping STL containers onto Partition Alloc. // Otherwise, replacing e.g. the FX_AllocUninit/FX_Free pairs with STL may // undo some of the nice segregation that we get from PartitionAlloc. template <class T, void* Alloc(size_t, size_t), void Free(void*)> struct FxPartitionAllocAllocator { … }; // Used to put backing store for std::vector<> and such into the // general partition, ensuring they contain data only. FxAllocAllocator; // Used to put backing store for std::string<> and std::ostringstream<> // into the string partition. FxStringAllocator; #endif // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_