| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // non-trival destructors in a given class or any of its subclasses, | 876 // non-trival destructors in a given class or any of its subclasses, |
| 877 // GarbageCollectedFinalized should be used which guarantees that the | 877 // GarbageCollectedFinalized should be used which guarantees that the |
| 878 // destructor is called on an instance when the garbage collector | 878 // destructor is called on an instance when the garbage collector |
| 879 // determines that it is no longer reachable. | 879 // determines that it is no longer reachable. |
| 880 template<typename T> | 880 template<typename T> |
| 881 class GarbageCollected { | 881 class GarbageCollected { |
| 882 WTF_MAKE_NONCOPYABLE(GarbageCollected); | 882 WTF_MAKE_NONCOPYABLE(GarbageCollected); |
| 883 | 883 |
| 884 // For now direct allocation of arrays on the heap is not allowed. | 884 // For now direct allocation of arrays on the heap is not allowed. |
| 885 void* operator new[](size_t size); | 885 void* operator new[](size_t size); |
| 886 #if OS(WIN) && COMPILER(MSVC) |
| 887 // Due to some quirkiness in the MSVC compiler we have to provide |
| 888 // the delete[] operator in the GarbageCollected subclasses as it |
| 889 // is called when a class is exported in a DLL. |
| 890 protected: |
| 891 void operator delete[](void* p) |
| 892 { |
| 893 ASSERT_NOT_REACHED(); |
| 894 } |
| 895 #else |
| 886 void operator delete[](void* p); | 896 void operator delete[](void* p); |
| 897 #endif |
| 887 public: | 898 public: |
| 888 typedef T GarbageCollectedBase; | 899 typedef T GarbageCollectedBase; |
| 889 | 900 |
| 890 void* operator new(size_t size) | 901 void* operator new(size_t size) |
| 891 { | 902 { |
| 892 return Heap::allocate<T>(size); | 903 return Heap::allocate<T>(size); |
| 893 } | 904 } |
| 894 | 905 |
| 895 void operator delete(void* p) | 906 void operator delete(void* p) |
| 896 { | 907 { |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 // to export. This forces it to export all the methods from ThreadHeap. | 1880 // to export. This forces it to export all the methods from ThreadHeap. |
| 1870 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); | 1881 template<> void ThreadHeap<FinalizedHeapObjectHeader>::addPageToHeap(const GCInf
o*); |
| 1871 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); | 1882 template<> void ThreadHeap<HeapObjectHeader>::addPageToHeap(const GCInfo*); |
| 1872 extern template class PLATFORM_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; | 1883 extern template class PLATFORM_EXPORT ThreadHeap<FinalizedHeapObjectHeader>; |
| 1873 extern template class PLATFORM_EXPORT ThreadHeap<HeapObjectHeader>; | 1884 extern template class PLATFORM_EXPORT ThreadHeap<HeapObjectHeader>; |
| 1874 #endif | 1885 #endif |
| 1875 | 1886 |
| 1876 } | 1887 } |
| 1877 | 1888 |
| 1878 #endif // Heap_h | 1889 #endif // Heap_h |
| OLD | NEW |