| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (UNLIKELY(containsKey(key))) { | 72 if (UNLIKELY(containsKey(key))) { |
| 73 wrapper = newLocal(m_isolate, key); | 73 wrapper = newLocal(m_isolate, key); |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 v8::Global<v8::Object> global(m_isolate, wrapper); | 76 v8::Global<v8::Object> global(m_isolate, wrapper); |
| 77 wrapperTypeInfo->configureWrapper(&global); | 77 wrapperTypeInfo->configureWrapper(&global); |
| 78 m_map.Set(key, std::move(global)); | 78 m_map.Set(key, std::move(global)); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 void removeIfAny(KeyType* key) { | |
| 83 m_map.Remove(key); | |
| 84 } | |
| 85 | |
| 86 void clear() { m_map.Clear(); } | 82 void clear() { m_map.Clear(); } |
| 87 | 83 |
| 84 void removeAndDispose(KeyType* key) { |
| 85 ASSERT(containsKey(key)); |
| 86 m_map.Remove(key); |
| 87 } |
| 88 |
| 88 void markWrapper(KeyType* object) { | 89 void markWrapper(KeyType* object) { |
| 89 m_map.RegisterExternallyReferencedObject(object); | 90 m_map.RegisterExternallyReferencedObject(object); |
| 90 } | 91 } |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 class PersistentValueMapTraits { | 94 class PersistentValueMapTraits { |
| 94 STATIC_ONLY(PersistentValueMapTraits); | 95 STATIC_ONLY(PersistentValueMapTraits); |
| 95 | 96 |
| 96 public: | 97 public: |
| 97 // Map traits: | 98 // Map traits: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); | 156 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); |
| 156 }; | 157 }; |
| 157 | 158 |
| 158 v8::Isolate* m_isolate; | 159 v8::Isolate* m_isolate; |
| 159 typename PersistentValueMapTraits::MapType m_map; | 160 typename PersistentValueMapTraits::MapType m_map; |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace blink | 163 } // namespace blink |
| 163 | 164 |
| 164 #endif // DOMWrapperMap_h | 165 #endif // DOMWrapperMap_h |
| OLD | NEW |