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

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

Issue 1001023003: Revert "Kill CFX_GrowOnlyPool." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 9 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/fxcrt/fx_basic_memmgr.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 _FX_MEMORY_H_ 7 #ifndef _FX_MEMORY_H_
8 #define _FX_MEMORY_H_ 8 #define _FX_MEMORY_H_
9 #ifndef _FX_SYSTEM_H_ 9 #ifndef _FX_SYSTEM_H_
10 #include "fx_system.h" 10 #include "fx_system.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void operator delete[] (void* p) 58 void operator delete[] (void* p)
59 { 59 {
60 free(p); 60 free(p);
61 } 61 }
62 void* operator new (size_t, void* buf) 62 void* operator new (size_t, void* buf)
63 { 63 {
64 return buf; 64 return buf;
65 } 65 }
66 void operator delete (void*, void*) {} 66 void operator delete (void*, void*) {}
67 }; 67 };
68 #endif
69 #ifdef __cplusplus
68 #if defined(_DEBUG) 70 #if defined(_DEBUG)
69 #define FX_NEW new(__FILE__, __LINE__) 71 #define FX_NEW new(__FILE__, __LINE__)
70 #else 72 #else
73
71 #define FX_NEW new 74 #define FX_NEW new
72 #endif 75 #endif
73 #define FX_NEW_VECTOR(Pointer, Class, Count) \ 76 #define FX_NEW_VECTOR(Pointer, Class, Count) \
74 { \ 77 { \
75 Pointer = FX_Alloc(Class, Count); \ 78 Pointer = FX_Alloc(Class, Count); \
76 if (Pointer) { \ 79 if (Pointer) { \
77 for (int i = 0; i < (Count); i ++) new (Pointer + i) Class; \ 80 for (int i = 0; i < (Count); i ++) new (Pointer + i) Class; \
78 } \ 81 } \
79 } 82 }
80 #define FX_DELETE_VECTOR(Pointer, Class, Count) \ 83 #define FX_DELETE_VECTOR(Pointer, Class, Count) \
81 { \ 84 { \
82 for (int i = 0; i < (Count); i ++) Pointer[i].~Class(); \ 85 for (int i = 0; i < (Count); i ++) Pointer[i].~Class(); \
83 FX_Free(Pointer); \ 86 FX_Free(Pointer); \
84 } 87 }
85 class CFX_DestructObject : public CFX_Object 88 class CFX_DestructObject : public CFX_Object
86 { 89 {
87 public: 90 public:
88 91
89 virtual ~CFX_DestructObject() {} 92 virtual ~CFX_DestructObject() {}
90 }; 93 };
91 #endif // __cplusplus 94 class CFX_GrowOnlyPool : public CFX_Object
92 #endif // _FX_MEMORY_H_ 95 {
96 public:
97
98 CFX_GrowOnlyPool(size_t trunk_size = 16384);
99
100 ~CFX_GrowOnlyPool();
101
102 void» SetTrunkSize(size_t trunk_size)
103 {
104 m_TrunkSize = trunk_size;
105 }
106
107 void*» AllocDebug(size_t size, FX_LPCSTR file, int line)
108 {
109 return Alloc(size);
110 }
111
112 void*» Alloc(size_t size);
113
114 void*» ReallocDebug(void* p, size_t new_size, FX_LPCSTR file, int line)
115 {
116 return NULL;
117 }
118
119 void*» Realloc(void* p, size_t new_size)
120 {
121 return NULL;
122 }
123
124 void» Free(void*) {}
125
126 void» FreeAll();
127 private:
128
129 size_t» m_TrunkSize;
130
131 void*» m_pFirstTrunk;
132 };
133 #endif
134 #endif
OLDNEW
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_memmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698