Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: include/v8-util.h

Issue 1883043003: Add RegisterExternallyReferencedObject to PersistenValueMap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Leave RegisterExternallyReferencedObject private Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 V8_UTIL_H_ 5 #ifndef V8_UTIL_H_
6 #define V8_UTIL_H_ 6 #define V8_UTIL_H_
7 7
8 #include "v8.h" // NOLINT(build/include) 8 #include "v8.h" // NOLINT(build/include)
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 * Call Isolate::SetReference with the given parent and the map value. 199 * Call Isolate::SetReference with the given parent and the map value.
200 */ 200 */
201 void SetReference(const K& key, 201 void SetReference(const K& key,
202 const Persistent<Object>& parent) { 202 const Persistent<Object>& parent) {
203 GetIsolate()->SetReference( 203 GetIsolate()->SetReference(
204 reinterpret_cast<internal::Object**>(parent.val_), 204 reinterpret_cast<internal::Object**>(parent.val_),
205 reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key)))); 205 reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))));
206 } 206 }
207 207
208 /** 208 /**
209 * Call V8::RegisterExternallyReferencedObject with the map value for given
210 * key.
211 */
212 void RegisterExternallyReferencedObject(K& key) {
213 DCHECK(Contains(key));
214 V8::RegisterExternallyReferencedObject(
215 reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))),
216 reinterpret_cast<internal::Isolate*>(GetIsolate()));
217 }
218
219 /**
209 * Return value for key and remove it from the map. 220 * Return value for key and remove it from the map.
210 */ 221 */
211 Global<V> Remove(const K& key) { 222 Global<V> Remove(const K& key) {
212 return Release(Traits::Remove(&impl_, key)).Pass(); 223 return Release(Traits::Remove(&impl_, key)).Pass();
213 } 224 }
214 225
215 /** 226 /**
216 * Traverses the map repeatedly, 227 * Traverses the map repeatedly,
217 * in case side effects of disposal cause insertions. 228 * in case side effects of disposal cause insertions.
218 **/ 229 **/
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return reinterpret_cast<V*>(v); 645 return reinterpret_cast<V*>(v);
635 } 646 }
636 647
637 Isolate* isolate_; 648 Isolate* isolate_;
638 typename Traits::Impl impl_; 649 typename Traits::Impl impl_;
639 }; 650 };
640 651
641 } // namespace v8 652 } // namespace v8
642 653
643 #endif // V8_UTIL_H 654 #endif // V8_UTIL_H
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698