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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1017
1018 template<typename T> 1018 template<typename T>
1019 T* adoptRefCountedGarbageCollected(T* ptr) 1019 T* adoptRefCountedGarbageCollected(T* ptr)
1020 { 1020 {
1021 ASSERT(ptr->hasOneRef()); 1021 ASSERT(ptr->hasOneRef());
1022 ptr->deref(); 1022 ptr->deref();
1023 WTF::adopted(ptr); 1023 WTF::adopted(ptr);
1024 return ptr; 1024 return ptr;
1025 } 1025 }
1026 1026
1027 // Classes that contain heap references but aren't themselves heap
1028 // allocated, have some extra macros available which allows their use
1029 // to be restricted to cases where the garbage collector is able
1030 // to discover their heap references.
1031 //
1032 // STACK_ALLOCATED(): Use if the object is only stack allocated. Heap objects
1033 // should be in Members but you do not need the trace method as they are on
1034 // the stack. (Down the line these might turn in to raw pointers, but for
1035 // now Members indicates that we have thought about them and explicitly
1036 // taken care of them.)
1037 //
1038 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can
1039 // be a part object. If it has Members you need a trace method and the
1040 // containing object needs to call that trace method.
1041 //
1042 // ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator.
1043 // This disallows general allocation of this object but allows to put
1044 // the object as a value object in collections. If these have Members you
1045 // need to have a trace method. That trace method will be called
1046 // automatically by the Heap collections.
1047 //
1027 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) 1048 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
1028 #define DISALLOW_ALLOCATION() \ 1049 #define DISALLOW_ALLOCATION() \
1029 private: \ 1050 private: \
1030 void* operator new(size_t) = delete; \ 1051 void* operator new(size_t) = delete; \
1031 void* operator new(size_t, NotNullTag, void*) = delete; \ 1052 void* operator new(size_t, NotNullTag, void*) = delete; \
1032 void* operator new(size_t, void*) = delete; 1053 void* operator new(size_t, void*) = delete;
1033 1054
1034 #define ALLOW_ONLY_INLINE_ALLOCATION() \ 1055 #define ALLOW_ONLY_INLINE_ALLOCATION() \
1035 public: \ 1056 public: \
1036 void* operator new(size_t, NotNullTag, void* location) { return location ; } \ 1057 void* operator new(size_t, NotNullTag, void* location) { return location ; } \
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 // to export. This forces it to export all the methods from ThreadHeap. 1778 // to export. This forces it to export all the methods from ThreadHeap.
1758 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*); 1779 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf o*);
1759 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); 1780 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*);
1760 extern template class PLATFORM_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; 1781 extern template class PLATFORM_EXPORT ThreadHeap<FinalizedHeapObjectHeader>;
1761 extern template class PLATFORM_EXPORT ThreadHeap<HeapObjectHeader>; 1782 extern template class PLATFORM_EXPORT ThreadHeap<HeapObjectHeader>;
1762 #endif 1783 #endif
1763 1784
1764 } 1785 }
1765 1786
1766 #endif // Heap_h 1787 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698