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

Side by Side Diff: src/allocation.h

Issue 2108273003: Strictly disable instantiation of AllStatic class (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Strictly disable instantiation of AllStatic class Created 4 years, 5 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 | src/allocation.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 #ifndef V8_ALLOCATION_H_ 5 #ifndef V8_ALLOCATION_H_
6 #define V8_ALLOCATION_H_ 6 #define V8_ALLOCATION_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 27 matching lines...) Expand all
38 public: 38 public:
39 void* operator new(size_t size); 39 void* operator new(size_t size);
40 void operator delete(void* p); 40 void operator delete(void* p);
41 }; 41 };
42 #define BASE_EMBEDDED : public Embedded 42 #define BASE_EMBEDDED : public Embedded
43 #else 43 #else
44 #define BASE_EMBEDDED 44 #define BASE_EMBEDDED
45 #endif 45 #endif
46 46
47 47
48 // Superclass for classes only using statics. 48 // Superclass for classes only using static method functions.
49 // The subclass of AllStatic cannot be instantiated at all.
49 class AllStatic { 50 class AllStatic {
50 #ifdef DEBUG 51 #ifdef DEBUG
51 public: 52 public:
52 void* operator new(size_t size); 53 AllStatic() = delete;
53 void operator delete(void* p);
54 #endif 54 #endif
55 }; 55 };
56 56
57 57
58 template <typename T> 58 template <typename T>
59 T* NewArray(size_t size) { 59 T* NewArray(size_t size) {
60 T* result = new T[size]; 60 T* result = new T[size];
61 if (result == NULL) FatalProcessOutOfMemory("NewArray"); 61 if (result == NULL) FatalProcessOutOfMemory("NewArray");
62 return result; 62 return result;
63 } 63 }
(...skipping 21 matching lines...) Expand all
85 }; 85 };
86 86
87 87
88 void* AlignedAlloc(size_t size, size_t alignment); 88 void* AlignedAlloc(size_t size, size_t alignment);
89 void AlignedFree(void *ptr); 89 void AlignedFree(void *ptr);
90 90
91 } // namespace internal 91 } // namespace internal
92 } // namespace v8 92 } // namespace v8
93 93
94 #endif // V8_ALLOCATION_H_ 94 #endif // V8_ALLOCATION_H_
OLDNEW
« no previous file with comments | « no previous file | src/allocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698