diff options
author | weili <weili@chromium.org> | 2016-07-21 14:44:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-21 14:44:17 -0700 |
commit | c38cd6eb274429a5755e04d2e22a606375851717 (patch) | |
tree | 158c1e58b7d66a715cd7ba1459c55d329f08c49d /core/fxcrt | |
parent | 1d3348ce0092d6d2a40de5f8433c0d0c16a1e12e (diff) | |
download | pdfium-c38cd6eb274429a5755e04d2e22a606375851717.tar.xz |
Use smart pointers for graphics device classes
Use unique_ptr for class owned member variables. Also clean up some
style issues such as removing unused functions and casting to raw pointer.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2163103002
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/include/fx_memory.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/include/fx_memory.h b/core/fxcrt/include/fx_memory.h index fa8da6067c..53e6b9d1eb 100644 --- a/core/fxcrt/include/fx_memory.h +++ b/core/fxcrt/include/fx_memory.h @@ -23,6 +23,7 @@ void FXMEM_DefaultFree(void* pointer, int flags); #include <stdlib.h> #include <limits> +#include <memory> #include <new> NEVER_INLINE void FX_OutOfMemoryTerminate(); @@ -100,6 +101,12 @@ struct ReleaseDeleter { inline void operator()(T* ptr) const { ptr->Release(); } }; +// Used to help transfer ownership of a raw pointer to std::unique_ptr. +template <typename T> +std::unique_ptr<T> WrapUnique(T* ptr) { + return std::unique_ptr<T>(ptr); +} + class CFX_Deletable { public: virtual ~CFX_Deletable() {} |