| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 virtual void willBeDestroyed() { } | 147 virtual void willBeDestroyed() { } |
| 148 | 148 |
| 149 // FIXME: Oilpan: Remove this callback once PersistentHeapSupplementable is
removed again. | 149 // FIXME: Oilpan: Remove this callback once PersistentHeapSupplementable is
removed again. |
| 150 virtual void persistentHostHasBeenDestroyed() { } | 150 virtual void persistentHostHasBeenDestroyed() { } |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 template<typename T, bool> | 153 template<typename T, bool> |
| 154 class SupplementableTracing; | 154 class SupplementableTracing; |
| 155 | 155 |
| 156 template<typename T> | 156 template<typename T> |
| 157 class SupplementableTracing<T, true> { }; | 157 class SupplementableTracing<T, true> { |
| 158 public: |
| 159 // We have a trace method in SupplementableTracing<T, true> to ensure we hav
e |
| 160 // the vtable at the first word of the object. However we don't trace the |
| 161 // m_supplements here, but in the partially specialized template subclasses |
| 162 // since we only want to trace it for garbage collected classes. |
| 163 virtual void trace(Visitor*) { } |
| 164 }; |
| 158 | 165 |
| 159 template<typename T> | 166 template<typename T> |
| 160 class SupplementableTracing<T, false> { }; | 167 class SupplementableTracing<T, false> { }; |
| 161 | 168 |
| 162 // Helper class for implementing Supplementable, HeapSupplementable, and | 169 // Helper class for implementing Supplementable, HeapSupplementable, and |
| 163 // PersistentHeapSupplementable. | 170 // PersistentHeapSupplementable. |
| 164 template<typename T, bool isGarbageCollected = false> | 171 template<typename T, bool isGarbageCollected = false> |
| 165 class SupplementableBase : public SupplementableTracing<T, isGarbageCollected> { | 172 class SupplementableBase : public SupplementableTracing<T, isGarbageCollected> { |
| 166 public: | 173 public: |
| 167 void provideSupplement(const char* key, typename SupplementableTraits<T, isG
arbageCollected>::SupplementArgumentType supplement) | 174 void provideSupplement(const char* key, typename SupplementableTraits<T, isG
arbageCollected>::SupplementArgumentType supplement) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 183 return this->m_supplements.get(key); | 190 return this->m_supplements.get(key); |
| 184 } | 191 } |
| 185 | 192 |
| 186 void reattachThread() | 193 void reattachThread() |
| 187 { | 194 { |
| 188 #if ENABLE(ASSERT) | 195 #if ENABLE(ASSERT) |
| 189 m_threadId = currentThread(); | 196 m_threadId = currentThread(); |
| 190 #endif | 197 #endif |
| 191 } | 198 } |
| 192 | 199 |
| 193 // We have a trace method in the SupplementableBase class to ensure we have | |
| 194 // the vtable at the first word of the object. However we don't trace the | |
| 195 // m_supplements here, but in the partially specialized template subclasses | |
| 196 // since we only want to trace it for garbage collected classes. | |
| 197 virtual void trace(Visitor*) { } | |
| 198 | |
| 199 void willBeDestroyed() | 200 void willBeDestroyed() |
| 200 { | 201 { |
| 201 typedef typename SupplementableTraits<T, isGarbageCollected>::Supplement
Map::iterator SupplementIterator; | 202 typedef typename SupplementableTraits<T, isGarbageCollected>::Supplement
Map::iterator SupplementIterator; |
| 202 for (SupplementIterator it = m_supplements.begin(); it != m_supplements.
end(); ++it) | 203 for (SupplementIterator it = m_supplements.begin(); it != m_supplements.
end(); ++it) |
| 203 it->value->willBeDestroyed(); | 204 it->value->willBeDestroyed(); |
| 204 } | 205 } |
| 205 | 206 |
| 206 // FIXME: Oilpan: Make private and remove this ignore once PersistentHeapSup
plementable is removed again. | 207 // FIXME: Oilpan: Make private and remove this ignore once PersistentHeapSup
plementable is removed again. |
| 207 protected: | 208 protected: |
| 208 GC_PLUGIN_IGNORE("") | 209 GC_PLUGIN_IGNORE("") |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 }; | 290 }; |
| 290 | 291 |
| 291 template<typename T> | 292 template<typename T> |
| 292 struct ThreadingTrait<blink::SupplementableBase<T, true> > { | 293 struct ThreadingTrait<blink::SupplementableBase<T, true> > { |
| 293 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 294 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
| 294 }; | 295 }; |
| 295 | 296 |
| 296 } // namespace blink | 297 } // namespace blink |
| 297 | 298 |
| 298 #endif // Supplementable_h | 299 #endif // Supplementable_h |
| OLD | NEW |