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

Unified Diff: include/v8-util.h

Issue 1026283004: fix disposal of phantom handles in GlobalValueMap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8-util.h
diff --git a/include/v8-util.h b/include/v8-util.h
index 1ee1c721349bbcc7f3c18c82de0154ed43d4ab6c..21990a8fd9c681c91c2599ab40434520a22b3a78 100644
--- a/include/v8-util.h
+++ b/include/v8-util.h
@@ -134,6 +134,9 @@ class DefaultGlobalMapTraits : public StdMapTraits<K, V> {
}
static void DisposeCallbackData(WeakCallbackInfoType* data) {}
static void Dispose(Isolate* isolate, Global<V> value, K key) {}
+ static void DisposeWeak(Isolate* isolate,
+ const WeakCallbackInfo<WeakCallbackInfoType>& data,
+ K key) {}
private:
template <typename T>
@@ -319,6 +322,8 @@ class PersistentValueMapBase {
return p.Pass();
}
+ void RemoveWeak(const K& key) { Traits::Remove(&impl_, key); }
+
private:
PersistentValueMapBase(PersistentValueMapBase&);
void operator=(PersistentValueMapBase&);
@@ -469,8 +474,8 @@ class GlobalValueMap : public PersistentValueMapBase<K, V, Traits> {
GlobalValueMap<K, V, Traits>* persistentValueMap =
Traits::MapFromWeakCallbackInfo(data);
K key = Traits::KeyFromWeakCallbackInfo(data);
- Traits::Dispose(data.GetIsolate(), persistentValueMap->Remove(key).Pass(),
- key);
+ persistentValueMap->RemoveWeak(key);
+ Traits::DisposeWeak(data.GetIsolate(), data, key);
Traits::DisposeCallbackData(data.GetParameter());
}
}
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698