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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // The FinalizerTraitImpl specifies how to finalize objects. Object | 89 // The FinalizerTraitImpl specifies how to finalize objects. Object |
90 // that inherit from GarbageCollectedFinalized are finalized by | 90 // that inherit from GarbageCollectedFinalized are finalized by |
91 // calling their 'finalize' method which by default will call the | 91 // calling their 'finalize' method which by default will call the |
92 // destructor on the object. | 92 // destructor on the object. |
93 template<typename T, bool isGarbageCollectedFinalized> | 93 template<typename T, bool isGarbageCollectedFinalized> |
94 struct FinalizerTraitImpl; | 94 struct FinalizerTraitImpl; |
95 | 95 |
96 template<typename T> | 96 template<typename T> |
97 struct FinalizerTraitImpl<T, true> { | 97 struct FinalizerTraitImpl<T, true> { |
98 static void finalize(void* obj) { static_cast<T*>(obj)->finalize(); }; | 98 static void finalize(void* obj) { static_cast<T*>(obj)->finalizeGarbageColle
ctedObject(); }; |
99 }; | 99 }; |
100 | 100 |
101 template<typename T> | 101 template<typename T> |
102 struct FinalizerTraitImpl<T, false> { | 102 struct FinalizerTraitImpl<T, false> { |
103 static void finalize(void* obj) { }; | 103 static void finalize(void* obj) { }; |
104 }; | 104 }; |
105 | 105 |
106 // The FinalizerTrait is used to determine if a type requires | 106 // The FinalizerTrait is used to determine if a type requires |
107 // finalization and what finalization means. | 107 // finalization and what finalization means. |
108 // | 108 // |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 struct GCInfoTrait { | 658 struct GCInfoTrait { |
659 static const GCInfo* get() | 659 static const GCInfo* get() |
660 { | 660 { |
661 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 661 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
662 } | 662 } |
663 }; | 663 }; |
664 | 664 |
665 } | 665 } |
666 | 666 |
667 #endif | 667 #endif |
OLD | NEW |