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