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