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

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

Issue 1393303004: Remove some checks for object creation failures. They cannot fail. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 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 | « no previous file | 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {
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
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_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698