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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
888 } | 888 } |
889 | 889 |
890 void operator delete(void* p) | 890 void operator delete(void* p) |
891 { | 891 { |
892 ASSERT_NOT_REACHED(); | 892 ASSERT_NOT_REACHED(); |
893 } | 893 } |
894 | 894 |
895 protected: | 895 protected: |
896 HeapAllocated() { ASSERT(ThreadStateFor<ThreadingTrait<T>::Affinity>::State( )->contains(reinterpret_cast<Address>(this))); } | 896 HeapAllocated() { ASSERT(ThreadStateFor<ThreadingTrait<T>::Affinity>::State( )->contains(reinterpret_cast<Address>(this))); } |
897 ~HeapAllocated() { } | 897 ~HeapAllocated() { } |
898 | |
899 public: | |
900 typedef T HeapAllocatedBase; | |
898 }; | 901 }; |
899 | 902 |
900 // Forward declaration. | 903 // Forward declaration. |
901 template<typename T> class Persistent; | 904 template<typename T> class Persistent; |
902 #if defined(TRACE_GC_MARKING) && TRACE_GC_MARKING | 905 #if defined(TRACE_GC_MARKING) && TRACE_GC_MARKING |
903 template<typename T> class NamedPersistent; | 906 template<typename T> class NamedPersistent; |
904 #endif | 907 #endif |
905 | 908 |
906 // Base class for the transition period. Provides new and delete | 909 // Base class for the transition period. Provides new and delete |
907 // operators for allocation on the heap as well as finalization | 910 // operators for allocation on the heap as well as finalization |
908 // behavior. | 911 // behavior. |
909 template<typename T> | 912 template<typename T> |
910 class HeapAllocatedFinalized : public HeapAllocated<T> { | 913 class HeapAllocatedFinalized : public HeapAllocated<T> { |
911 WTF_MAKE_NONCOPYABLE(HeapAllocatedFinalized); | 914 WTF_MAKE_NONCOPYABLE(HeapAllocatedFinalized); |
912 | 915 |
913 protected: | 916 protected: |
914 // Finalize is called when the object is freed from the heap. Finalize | 917 // Finalize is called when the object is freed from the heap. Finalize |
915 // can be overridden to support calling the destructor of a subclass. | 918 // can be overridden to support calling the destructor of a subclass. |
916 // This is similar to the way deref is overridden to call delete on | 919 // This is similar to the way deref is overridden to call delete on |
917 // the correct subtype. | 920 // the correct subtype. |
918 void finalize() | 921 void finalize() |
919 { | 922 { |
920 static_cast<T*>(this)->~T(); | 923 static_cast<T*>(this)->~T(); |
921 } | 924 } |
925 template<typename Any> friend struct FinalizerTrait; | |
kouhei (in TOK)
2014/02/19 02:02:53
Maybe this can be made public? all override of thi
zerny-chromium
2014/02/19 09:44:48
If this is the only friend declaration we need (ie
| |
922 | 926 |
923 HeapAllocatedFinalized() { } | 927 HeapAllocatedFinalized() { } |
924 ~HeapAllocatedFinalized() { } | 928 ~HeapAllocatedFinalized() { } |
925 friend void heapAllocatedFinalizer<T>(void*); | 929 friend void heapAllocatedFinalizer<T>(void*); |
926 template<typename U> friend struct HasFinalizer; | 930 template<typename U> friend struct HasFinalizer; |
927 template<typename U, bool> friend struct FinalizerTraitImpl; | 931 template<typename U, bool> friend struct FinalizerTraitImpl; |
928 }; | 932 }; |
929 | 933 |
930 // Base class for objects that are in the heap and are still reference | 934 // Base class for objects that are in the heap and are still reference |
931 // counted. | 935 // counted. |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1329 | 1333 |
1330 template<typename T, typename Traits> | 1334 template<typename T, typename Traits> |
1331 class HeapVectorBacking { }; | 1335 class HeapVectorBacking { }; |
1332 template<typename Key, typename Value, typename Extractor, typename Traits, type name KeyTraits> | 1336 template<typename Key, typename Value, typename Extractor, typename Traits, type name KeyTraits> |
1333 class HeapHashTableBacking { }; | 1337 class HeapHashTableBacking { }; |
1334 | 1338 |
1335 | 1339 |
1336 } // namespace WebCore | 1340 } // namespace WebCore |
1337 | 1341 |
1338 #endif | 1342 #endif |
OLD | NEW |