OLD | NEW |
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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 // destructor is called on an instance when the garbage collector | 853 // destructor is called on an instance when the garbage collector |
854 // determines that it is no longer reachable. | 854 // determines that it is no longer reachable. |
855 template<typename T> | 855 template<typename T> |
856 class GarbageCollected { | 856 class GarbageCollected { |
857 WTF_MAKE_NONCOPYABLE(GarbageCollected); | 857 WTF_MAKE_NONCOPYABLE(GarbageCollected); |
858 | 858 |
859 // For now direct allocation of arrays on the heap is not allowed. | 859 // For now direct allocation of arrays on the heap is not allowed. |
860 void* operator new[](size_t size); | 860 void* operator new[](size_t size); |
861 void operator delete[](void* p); | 861 void operator delete[](void* p); |
862 public: | 862 public: |
| 863 typedef T GarbageCollectedBase; |
| 864 |
863 void* operator new(size_t size) | 865 void* operator new(size_t size) |
864 { | 866 { |
865 return Heap::allocate<T>(size); | 867 return Heap::allocate<T>(size); |
866 } | 868 } |
867 | 869 |
868 void operator delete(void* p) | 870 void operator delete(void* p) |
869 { | 871 { |
870 ASSERT_NOT_REACHED(); | 872 ASSERT_NOT_REACHED(); |
871 } | 873 } |
872 | 874 |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 // to export. This forces it to export all the methods from ThreadHeap. | 1670 // to export. This forces it to export all the methods from ThreadHeap. |
1669 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); | 1671 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); |
1670 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); | 1672 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); |
1671 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; | 1673 extern template class HEAP_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; |
1672 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; | 1674 extern template class HEAP_EXPORT ThreadHeap<HeapObjectHeader>; |
1673 #endif | 1675 #endif |
1674 | 1676 |
1675 } | 1677 } |
1676 | 1678 |
1677 #endif // Heap_h | 1679 #endif // Heap_h |
OLD | NEW |