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

Unified Diff: core/fxcrt/include/fx_memory.h

Issue 2163103002: Use smart pointers for graphics device classes (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix all platforms Created 4 years, 5 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 | « core/fpdfapi/fpdf_render/render_int.h ('k') | core/fxge/agg/fx_agg_driver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/fx_memory.h
diff --git a/core/fxcrt/include/fx_memory.h b/core/fxcrt/include/fx_memory.h
index fa8da6067c53d0cb6a5fd4f7fcbffbde8b3b581d..53e6b9d1eb61a118afe8867e915cf4b48eed2199 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() {}
« no previous file with comments | « core/fpdfapi/fpdf_render/render_int.h ('k') | core/fxge/agg/fx_agg_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698