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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 | 56 |
57 bool setReturnValueFrom(v8::ReturnValue<v8::Value> returnValue, KeyType* key ) | 57 bool setReturnValueFrom(v8::ReturnValue<v8::Value> returnValue, KeyType* key ) |
58 { | 58 { |
59 typename MapType::iterator it = m_map.find(key); | 59 typename MapType::iterator it = m_map.find(key); |
60 if (it == m_map.end()) | 60 if (it == m_map.end()) |
61 return false; | 61 return false; |
62 returnValue.Set(*(it->value.persistent())); | 62 returnValue.Set(*(it->value.persistent())); |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 void setReferenceFrom(const v8::Persistent<v8::Object>& parent, KeyType* key , v8::Isolate* isolate) | |
67 { | |
68 m_map.get(key).setReferenceFrom(parent, isolate); | |
haraken
2013/10/17 00:47:31
It looks OK to use UnsafePersistent in DOMWrapperM
kouhei (in TOK)
2013/10/17 02:30:09
Discussed offline.
This is also called from DOMWr
| |
69 } | |
70 | |
66 bool containsKey(KeyType* key) | 71 bool containsKey(KeyType* key) |
67 { | 72 { |
68 return m_map.find(key) != m_map.end(); | 73 return m_map.find(key) != m_map.end(); |
69 } | 74 } |
70 | 75 |
71 bool containsKeyAndValue(KeyType* key, const v8::Persistent<v8::Object>& val ue) | 76 bool containsKeyAndValue(KeyType* key, const v8::Persistent<v8::Object>& val ue) |
72 { | 77 { |
73 typename MapType::iterator it = m_map.find(key); | 78 typename MapType::iterator it = m_map.find(key); |
74 if (it == m_map.end()) | 79 if (it == m_map.end()) |
75 return false; | 80 return false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 ASSERT(type->derefObjectFunction); | 130 ASSERT(type->derefObjectFunction); |
126 void* key = static_cast<void*>(toNative(*wrapper)); | 131 void* key = static_cast<void*>(toNative(*wrapper)); |
127 ASSERT(*(map->m_map.get(key).persistent()) == *wrapper); | 132 ASSERT(*(map->m_map.get(key).persistent()) == *wrapper); |
128 map->removeAndDispose(key); | 133 map->removeAndDispose(key); |
129 type->derefObject(key); | 134 type->derefObject(key); |
130 } | 135 } |
131 | 136 |
132 } // namespace WebCore | 137 } // namespace WebCore |
133 | 138 |
134 #endif // DOMWrapperMap_h | 139 #endif // DOMWrapperMap_h |
OLD | NEW |