| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 } | 922 } |
| 923 | 923 |
| 924 void operator delete(void* p) | 924 void operator delete(void* p) |
| 925 { | 925 { |
| 926 ASSERT_NOT_REACHED(); | 926 ASSERT_NOT_REACHED(); |
| 927 } | 927 } |
| 928 | 928 |
| 929 protected: | 929 protected: |
| 930 GarbageCollected() { ASSERT(ThreadStateFor<ThreadingTrait<T>::Affinity>::Sta
te()->contains(reinterpret_cast<Address>(this))); } | 930 GarbageCollected() { ASSERT(ThreadStateFor<ThreadingTrait<T>::Affinity>::Sta
te()->contains(reinterpret_cast<Address>(this))); } |
| 931 ~GarbageCollected() { } | 931 ~GarbageCollected() { } |
| 932 |
| 933 public: |
| 934 typedef T GarbageCollectedBase; |
| 932 }; | 935 }; |
| 933 | 936 |
| 934 // Forward declaration. | 937 // Forward declaration. |
| 935 template<typename T> class Persistent; | 938 template<typename T> class Persistent; |
| 936 #if defined(TRACE_GC_MARKING) && TRACE_GC_MARKING | 939 #if defined(TRACE_GC_MARKING) && TRACE_GC_MARKING |
| 937 template<typename T> class NamedPersistent; | 940 template<typename T> class NamedPersistent; |
| 938 #endif | 941 #endif |
| 939 | 942 |
| 940 // Base class for the transition period. Provides new and delete | 943 // Base class for the transition period. Provides new and delete |
| 941 // operators for allocation on the heap as well as finalization | 944 // operators for allocation on the heap as well as finalization |
| 942 // behavior. | 945 // behavior. |
| 943 template<typename T> | 946 template<typename T> |
| 944 class GarbageCollectedFinalized : public GarbageCollected<T> { | 947 class GarbageCollectedFinalized : public GarbageCollected<T> { |
| 945 WTF_MAKE_NONCOPYABLE(GarbageCollectedFinalized); | 948 WTF_MAKE_NONCOPYABLE(GarbageCollectedFinalized); |
| 946 | 949 |
| 947 protected: | 950 protected: |
| 948 // Finalize is called when the object is freed from the heap. Finalize | 951 // Finalize is called when the object is freed from the heap. Finalize |
| 949 // can be overridden to support calling the destructor of a subclass. | 952 // can be overridden to support calling the destructor of a subclass. |
| 950 // This is similar to the way deref is overridden to call delete on | 953 // This is similar to the way deref is overridden to call delete on |
| 951 // the correct subtype. | 954 // the correct subtype. |
| 952 void finalize() | 955 void finalize() |
| 953 { | 956 { |
| 954 static_cast<T*>(this)->~T(); | 957 static_cast<T*>(this)->~T(); |
| 955 } | 958 } |
| 959 template<typename Any> friend struct FinalizerTrait; |
| 956 | 960 |
| 957 GarbageCollectedFinalized() { } | 961 GarbageCollectedFinalized() { } |
| 958 ~GarbageCollectedFinalized() { } | 962 ~GarbageCollectedFinalized() { } |
| 959 friend void heapAllocatedFinalizer<T>(void*); | 963 friend void heapAllocatedFinalizer<T>(void*); |
| 960 template<typename U> friend struct HasFinalizer; | 964 template<typename U> friend struct HasFinalizer; |
| 961 template<typename U, bool> friend struct FinalizerTraitImpl; | 965 template<typename U, bool> friend struct FinalizerTraitImpl; |
| 962 }; | 966 }; |
| 963 | 967 |
| 964 // Base class for objects that are in the heap and are still reference | 968 // Base class for objects that are in the heap and are still reference |
| 965 // counted. | 969 // counted. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 }; | 1373 }; |
| 1370 | 1374 |
| 1371 template<typename T, typename Traits> | 1375 template<typename T, typename Traits> |
| 1372 class HeapVectorBacking { }; | 1376 class HeapVectorBacking { }; |
| 1373 template<typename Key, typename Value, typename Extractor, typename Traits, type
name KeyTraits> | 1377 template<typename Key, typename Value, typename Extractor, typename Traits, type
name KeyTraits> |
| 1374 class HeapHashTableBacking { }; | 1378 class HeapHashTableBacking { }; |
| 1375 | 1379 |
| 1376 } // namespace WebCore | 1380 } // namespace WebCore |
| 1377 | 1381 |
| 1378 #endif | 1382 #endif |
| OLD | NEW |