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

Side by Side Diff: core/include/fxcrt/fx_basic.h

Issue 1351383004: Change nonstd::unique_ptr to take a custom deleter. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 years, 3 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 | « BUILD.gn ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_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_INCLUDE_FXCRT_FX_BASIC_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_
9 9
10 #include "fx_memory.h" 10 #include "fx_memory.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 m_Location = location; 940 m_Location = location;
941 m_OldValue = *location; 941 m_OldValue = *location;
942 } 942 }
943 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } 943 ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
944 944
945 private: 945 private:
946 T* m_Location; 946 T* m_Location;
947 T m_OldValue; 947 T m_OldValue;
948 }; 948 };
949 949
950 // Used with nonstd::unique_ptr to Release() objects that can't be deleted.
951 template <class T>
952 struct ReleaseDeleter {
953 inline void operator()(T* ptr) const { ptr->Release(); }
954 };
955
956 // TODO(thestig) Remove in favor of nonstd::unique_ptr.
950 template <class T> 957 template <class T>
951 class CFX_SmartPointer { 958 class CFX_SmartPointer {
952 public: 959 public:
953 CFX_SmartPointer(T* pObj) : m_pObj(pObj) {} 960 CFX_SmartPointer(T* pObj) : m_pObj(pObj) {}
954 ~CFX_SmartPointer() { m_pObj->Release(); } 961 ~CFX_SmartPointer() { m_pObj->Release(); }
955 T* Get(void) { return m_pObj; } 962 T* Get(void) { return m_pObj; }
956 T& operator*(void) { return *m_pObj; } 963 T& operator*(void) { return *m_pObj; }
957 T* operator->(void) { return m_pObj; } 964 T* operator->(void) { return m_pObj; }
958 965
959 protected: 966 protected:
960 T* m_pObj; 967 T* m_pObj;
961 }; 968 };
969
962 #define FX_DATALIST_LENGTH 1024 970 #define FX_DATALIST_LENGTH 1024
963 template <size_t unit> 971 template <size_t unit>
964 class CFX_SortListArray { 972 class CFX_SortListArray {
965 protected: 973 protected:
966 struct DataList { 974 struct DataList {
967 int32_t start; 975 int32_t start;
968 976
969 int32_t count; 977 int32_t count;
970 uint8_t* data; 978 uint8_t* data;
971 }; 979 };
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 FX_FLOAT c; 1147 FX_FLOAT c;
1140 FX_FLOAT d; 1148 FX_FLOAT d;
1141 FX_FLOAT e; 1149 FX_FLOAT e;
1142 FX_FLOAT f; 1150 FX_FLOAT f;
1143 FX_FLOAT g; 1151 FX_FLOAT g;
1144 FX_FLOAT h; 1152 FX_FLOAT h;
1145 FX_FLOAT i; 1153 FX_FLOAT i;
1146 }; 1154 };
1147 1155
1148 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ 1156 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698