| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 class SupplementableTracing<T, true> : public virtual GarbageCollectedMixin { | 160 class SupplementableTracing<T, true> : public virtual GarbageCollectedMixin { |
| 161 WTF_MAKE_NONCOPYABLE(SupplementableTracing); | 161 WTF_MAKE_NONCOPYABLE(SupplementableTracing); |
| 162 public: | 162 public: |
| 163 DEFINE_INLINE_VIRTUAL_TRACE() | 163 DEFINE_INLINE_VIRTUAL_TRACE() |
| 164 { | 164 { |
| 165 visitor->trace(m_supplements); | 165 visitor->trace(m_supplements); |
| 166 } | 166 } |
| 167 | 167 |
| 168 protected: | 168 protected: |
| 169 SupplementableTracing() { } | 169 SupplementableTracing() { } |
| 170 typedef HeapHashMap<const char*, Member<SupplementBase<T, true>>, PtrHash<co
nst char*>> SupplementMap; | 170 typedef HeapHashMap<const char*, Member<SupplementBase<T, true>>, PtrHash<co
nst char>> SupplementMap; |
| 171 SupplementMap m_supplements; | 171 SupplementMap m_supplements; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 template<typename T> | 174 template<typename T> |
| 175 class SupplementableTracing<T, false> { | 175 class SupplementableTracing<T, false> { |
| 176 WTF_MAKE_NONCOPYABLE(SupplementableTracing); | 176 WTF_MAKE_NONCOPYABLE(SupplementableTracing); |
| 177 protected: | 177 protected: |
| 178 SupplementableTracing() { } | 178 SupplementableTracing() { } |
| 179 typedef HashMap<const char*, OwnPtr<SupplementBase<T, false>>, PtrHash<const
char*>> SupplementMap; | 179 typedef HashMap<const char*, OwnPtr<SupplementBase<T, false>>, PtrHash<const
char>> SupplementMap; |
| 180 SupplementMap m_supplements; | 180 SupplementMap m_supplements; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // Helper class for implementing Supplementable and HeapSupplementable. | 183 // Helper class for implementing Supplementable and HeapSupplementable. |
| 184 template<typename T, bool isGarbageCollected = false> | 184 template<typename T, bool isGarbageCollected = false> |
| 185 class SupplementableBase : public SupplementableTracing<T, isGarbageCollected> { | 185 class SupplementableBase : public SupplementableTracing<T, isGarbageCollected> { |
| 186 public: | 186 public: |
| 187 void provideSupplement(const char* key, typename SupplementableTraits<T, isG
arbageCollected>::SupplementArgumentType supplement) | 187 void provideSupplement(const char* key, typename SupplementableTraits<T, isG
arbageCollected>::SupplementArgumentType supplement) |
| 188 { | 188 { |
| 189 ASSERT(m_threadId == currentThread()); | 189 ASSERT(m_threadId == currentThread()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 template<typename T> | 239 template<typename T> |
| 240 struct ThreadingTrait<SupplementableBase<T, true>> { | 240 struct ThreadingTrait<SupplementableBase<T, true>> { |
| 241 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; | 241 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| 245 | 245 |
| 246 #endif // Supplementable_h | 246 #endif // Supplementable_h |
| OLD | NEW |