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 if (containsKey(key)) | |
haraken
2017/02/09 12:46:40
Nit: Do you need this check?
Yuki
2017/02/10 07:47:21
Seems not necessary. Removed.
| |
84 m_map.Remove(key); | |
85 } | |
86 | |
82 void clear() { m_map.Clear(); } | 87 void clear() { m_map.Clear(); } |
83 | 88 |
84 void removeAndDispose(KeyType* key) { | |
85 ASSERT(containsKey(key)); | |
86 m_map.Remove(key); | |
87 } | |
88 | |
89 void markWrapper(KeyType* object) { | 89 void markWrapper(KeyType* object) { |
90 m_map.RegisterExternallyReferencedObject(object); | 90 m_map.RegisterExternallyReferencedObject(object); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 class PersistentValueMapTraits { | 94 class PersistentValueMapTraits { |
95 STATIC_ONLY(PersistentValueMapTraits); | 95 STATIC_ONLY(PersistentValueMapTraits); |
96 | 96 |
97 public: | 97 public: |
98 // Map traits: | 98 // Map traits: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); | 156 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); |
157 }; | 157 }; |
158 | 158 |
159 v8::Isolate* m_isolate; | 159 v8::Isolate* m_isolate; |
160 typename PersistentValueMapTraits::MapType m_map; | 160 typename PersistentValueMapTraits::MapType m_map; |
161 }; | 161 }; |
162 | 162 |
163 } // namespace blink | 163 } // namespace blink |
164 | 164 |
165 #endif // DOMWrapperMap_h | 165 #endif // DOMWrapperMap_h |
OLD | NEW |