Commit b6054826 authored by hlopko's avatar hlopko Committed by Commit bot

Add RegisterExternallyReferencedObject to PersistenValueMap

PersistentValueMap is used to hold per-world wrappers in the blink. Currently,
when we trace wrappers, we visit wrappers in all worlds via this PersistentValueMap. This cl introduces convenient (and faster) way of registering these external references.

BUG=468240
LOG=no

Review URL: https://codereview.chromium.org/1883043003

Cr-Commit-Position: refs/heads/master@{#35523}
parent 96ddf420
......@@ -205,6 +205,17 @@ class PersistentValueMapBase {
reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))));
}
/**
* Call V8::RegisterExternallyReferencedObject with the map value for given
* key.
*/
void RegisterExternallyReferencedObject(K& key) {
DCHECK(Contains(key));
V8::RegisterExternallyReferencedObject(
reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))),
reinterpret_cast<internal::Isolate*>(GetIsolate()));
}
/**
* Return value for key and remove it from the map.
*/
......
......@@ -6641,8 +6641,6 @@ class V8_EXPORT V8 {
static internal::Object** CopyPersistent(internal::Object** handle);
static void DisposeGlobal(internal::Object** global_handle);
typedef WeakCallbackData<Value, void>::Callback WeakCallback;
static void RegisterExternallyReferencedObject(internal::Object** object,
internal::Isolate* isolate);
static void MakeWeak(internal::Object** global_handle, void* data,
WeakCallback weak_callback);
static void MakeWeak(internal::Object** global_handle, void* data,
......@@ -6660,6 +6658,11 @@ class V8_EXPORT V8 {
int* index);
static Local<Value> GetEternal(Isolate* isolate, int index);
static void RegisterExternallyReferencedObject(internal::Object** object,
internal::Isolate* isolate);
template <class K, class V, class T>
friend class PersistentValueMapBase;
static void FromJustIsNothing();
static void ToLocalEmpty();
static void InternalFieldOutOfBounds(int index);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment