Chromium Code Reviews| 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 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 { | 86 { |
| 87 m_map.Clear(); | 87 m_map.Clear(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void removeAndDispose(KeyType* key) | 90 void removeAndDispose(KeyType* key) |
| 91 { | 91 { |
| 92 ASSERT(containsKey(key)); | 92 ASSERT(containsKey(key)); |
| 93 m_map.Remove(key); | 93 m_map.Remove(key); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void markWrapper(KeyType* object) | |
| 97 { | |
| 98 m_map.RegisterExternallyReferencedObject(object); | |
|
haraken
2016/04/18 04:35:41
I'm okay with this, but it would be nicer if all c
Marcel Hlopko
2016/04/18 11:45:34
I don't think we can unify this elegantly, the map
| |
| 99 } | |
| 100 | |
| 96 private: | 101 private: |
| 97 class PersistentValueMapTraits { | 102 class PersistentValueMapTraits { |
| 98 STATIC_ONLY(PersistentValueMapTraits); | 103 STATIC_ONLY(PersistentValueMapTraits); |
| 99 public: | 104 public: |
| 100 // Map traits: | 105 // Map traits: |
| 101 typedef HashMap<KeyType*, v8::PersistentContainerValue> Impl; | 106 typedef HashMap<KeyType*, v8::PersistentContainerValue> Impl; |
| 102 typedef typename Impl::iterator Iterator; | 107 typedef typename Impl::iterator Iterator; |
| 103 static size_t Size(const Impl* impl) { return impl->size(); } | 108 static size_t Size(const Impl* impl) { return impl->size(); } |
| 104 static bool Empty(Impl* impl) { return impl->isEmpty(); } | 109 static bool Empty(Impl* impl) { return impl->isEmpty(); } |
| 105 static void Swap(Impl& impl, Impl& other) { impl.swap(other); } | 110 static void Swap(Impl& impl, Impl& other) { impl.swap(other); } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType> &); | 161 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType> &); |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 v8::Isolate* m_isolate; | 164 v8::Isolate* m_isolate; |
| 160 typename PersistentValueMapTraits::MapType m_map; | 165 typename PersistentValueMapTraits::MapType m_map; |
| 161 }; | 166 }; |
| 162 | 167 |
| 163 } // namespace blink | 168 } // namespace blink |
| 164 | 169 |
| 165 #endif // DOMWrapperMap_h | 170 #endif // DOMWrapperMap_h |
| OLD | NEW |