Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 struct FxFreeDeleter { | 948 struct FxFreeDeleter { |
| 949 inline void operator()(void* ptr) const { FX_Free(ptr); } | 949 inline void operator()(void* ptr) const { FX_Free(ptr); } |
| 950 }; | 950 }; |
| 951 | 951 |
| 952 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. | 952 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. |
| 953 template <class T> | 953 template <class T> |
| 954 struct ReleaseDeleter { | 954 struct ReleaseDeleter { |
| 955 inline void operator()(T* ptr) const { ptr->Release(); } | 955 inline void operator()(T* ptr) const { ptr->Release(); } |
| 956 }; | 956 }; |
| 957 | 957 |
| 958 // TODO(thestig) Remove in favor of nonstd::unique_ptr. | |
| 959 template <class T> | |
| 960 class CFX_SmartPointer { | |
|
Tom Sepez
2015/10/09 16:47:31
This gets replaced with a ReleaseDelete, eh? Its
Lei Zhang
2015/10/19 08:05:51
Ya, it's not great, but it beats having to manuall
| |
| 961 public: | |
| 962 CFX_SmartPointer(T* pObj) : m_pObj(pObj) {} | |
| 963 ~CFX_SmartPointer() { m_pObj->Release(); } | |
| 964 T* Get(void) { return m_pObj; } | |
| 965 T& operator*(void) { return *m_pObj; } | |
| 966 T* operator->(void) { return m_pObj; } | |
| 967 | |
| 968 protected: | |
| 969 T* m_pObj; | |
| 970 }; | |
| 971 | |
| 972 #define FX_DATALIST_LENGTH 1024 | 958 #define FX_DATALIST_LENGTH 1024 |
| 973 template <size_t unit> | 959 template <size_t unit> |
| 974 class CFX_SortListArray { | 960 class CFX_SortListArray { |
| 975 protected: | 961 protected: |
| 976 struct DataList { | 962 struct DataList { |
| 977 int32_t start; | 963 int32_t start; |
| 978 | 964 |
| 979 int32_t count; | 965 int32_t count; |
| 980 uint8_t* data; | 966 uint8_t* data; |
| 981 }; | 967 }; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 FX_FLOAT c; | 1135 FX_FLOAT c; |
| 1150 FX_FLOAT d; | 1136 FX_FLOAT d; |
| 1151 FX_FLOAT e; | 1137 FX_FLOAT e; |
| 1152 FX_FLOAT f; | 1138 FX_FLOAT f; |
| 1153 FX_FLOAT g; | 1139 FX_FLOAT g; |
| 1154 FX_FLOAT h; | 1140 FX_FLOAT h; |
| 1155 FX_FLOAT i; | 1141 FX_FLOAT i; |
| 1156 }; | 1142 }; |
| 1157 | 1143 |
| 1158 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1144 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| OLD | NEW |