| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8GlobalValueMap_h | 5 #ifndef V8GlobalValueMap_h |
| 6 #define V8GlobalValueMap_h | 6 #define V8GlobalValueMap_h |
| 7 | 7 |
| 8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 #include "wtf/HashMap.h" | 9 #include "wtf/HashMap.h" |
| 10 #include "wtf/text/StringHash.h" | 10 #include "wtf/text/StringHash.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 static KeyType Key(Iterator& iter) { return iter->key; } | 42 static KeyType Key(Iterator& iter) { return iter->key; } |
| 43 static v8::PersistentContainerValue Set(Impl* impl, | 43 static v8::PersistentContainerValue Set(Impl* impl, |
| 44 KeyType key, | 44 KeyType key, |
| 45 v8::PersistentContainerValue value) { | 45 v8::PersistentContainerValue value) { |
| 46 v8::PersistentContainerValue oldValue = Get(impl, key); | 46 v8::PersistentContainerValue oldValue = Get(impl, key); |
| 47 impl->set(key, value); | 47 impl->set(key, value); |
| 48 return oldValue; | 48 return oldValue; |
| 49 } | 49 } |
| 50 static v8::PersistentContainerValue Get(const Impl* impl, KeyType key) { | 50 static v8::PersistentContainerValue Get(const Impl* impl, KeyType key) { |
| 51 return impl->get(key); | 51 return impl->at(key); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static v8::PersistentContainerValue Remove(Impl* impl, KeyType key) { | 54 static v8::PersistentContainerValue Remove(Impl* impl, KeyType key) { |
| 55 return impl->take(key); | 55 return impl->take(key); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Weak traits: | 58 // Weak traits: |
| 59 static const v8::PersistentContainerCallbackType kCallbackType = type; | 59 static const v8::PersistentContainerCallbackType kCallbackType = type; |
| 60 typedef v8::GlobalValueMap<KeyType, | 60 typedef v8::GlobalValueMap<KeyType, |
| 61 ValueType, | 61 ValueType, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 public: | 110 public: |
| 111 typedef V8GlobalValueMapTraits<KeyType, ValueType, type> Traits; | 111 typedef V8GlobalValueMapTraits<KeyType, ValueType, type> Traits; |
| 112 explicit V8GlobalValueMap(v8::Isolate* isolate) | 112 explicit V8GlobalValueMap(v8::Isolate* isolate) |
| 113 : v8::GlobalValueMap<KeyType, ValueType, Traits>(isolate) {} | 113 : v8::GlobalValueMap<KeyType, ValueType, Traits>(isolate) {} |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace blink | 116 } // namespace blink |
| 117 | 117 |
| 118 #endif // V8GlobalValueMap_h | 118 #endif // V8GlobalValueMap_h |
| OLD | NEW |