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

Side by Side Diff: core/fxcrt/fx_memory.h

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fxcrt/fx_xml_parser.cpp » ('j') | 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 #ifndef CORE_FXCRT_FX_MEMORY_H_ 7 #ifndef CORE_FXCRT_FX_MEMORY_H_
8 #define CORE_FXCRT_FX_MEMORY_H_ 8 #define CORE_FXCRT_FX_MEMORY_H_
9 9
10 #include "core/fxcrt/fx_system.h" 10 #include "core/fxcrt/fx_system.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 struct FxFreeDeleter { 94 struct FxFreeDeleter {
95 inline void operator()(void* ptr) const { FX_Free(ptr); } 95 inline void operator()(void* ptr) const { FX_Free(ptr); }
96 }; 96 };
97 97
98 // Used with std::unique_ptr to Release() objects that can't be deleted. 98 // Used with std::unique_ptr to Release() objects that can't be deleted.
99 template <class T> 99 template <class T>
100 struct ReleaseDeleter { 100 struct ReleaseDeleter {
101 inline void operator()(T* ptr) const { ptr->Release(); } 101 inline void operator()(T* ptr) const { ptr->Release(); }
102 }; 102 };
103 103
104 // Used to help transfer ownership of a raw pointer to std::unique_ptr.
105 template <typename T>
106 std::unique_ptr<T> WrapUnique(T* ptr) {
107 return std::unique_ptr<T>(ptr);
108 }
109
110 #endif // __cplusplus 104 #endif // __cplusplus
111 105
112 #endif // CORE_FXCRT_FX_MEMORY_H_ 106 #endif // CORE_FXCRT_FX_MEMORY_H_
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fxcrt/fx_xml_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698