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

Unified Diff: include/v8-util.h

Issue 1104463002: add StdGlobalValueMap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-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 8199016a89fd5e554af4177d5909d97514542b0d..6454a19b7e4fe103523e790c10274ffc3e0dbfb4 100644
--- a/include/v8-util.h
+++ b/include/v8-util.h
@@ -117,25 +117,25 @@ class DefaultGlobalMapTraits : public StdMapTraits<K, V> {
public:
// Weak callback & friends:
static const PersistentContainerCallbackType kCallbackType = kNotWeak;
- typedef PersistentValueMap<K, V, DefaultGlobalMapTraits<K, V> > MapType;
- typedef void WeakCallbackInfoType;
+ typedef GlobalValueMap<K, V, DefaultGlobalMapTraits<K, V> > MapType;
+ typedef void WeakCallbackDataType;
- static WeakCallbackInfoType* WeakCallbackParameter(MapType* map, const K& key,
+ static WeakCallbackDataType* WeakCallbackParameter(MapType* map, const K& key,
Local<V> value) {
return nullptr;
}
static MapType* MapFromWeakCallbackInfo(
- const WeakCallbackInfo<WeakCallbackInfoType>& data) {
+ const WeakCallbackInfo<WeakCallbackDataType>& data) {
return nullptr;
}
static K KeyFromWeakCallbackInfo(
- const WeakCallbackInfo<WeakCallbackInfoType>& data) {
+ const WeakCallbackInfo<WeakCallbackDataType>& data) {
return K();
}
- static void DisposeCallbackData(WeakCallbackInfoType* data) {}
+ static void DisposeCallbackData(WeakCallbackDataType* data) {}
static void Dispose(Isolate* isolate, Global<V> value, K key) {}
// This is a second pass callback, so SetSecondPassCallback cannot be called.
- static void DisposeWeak(const WeakCallbackInfo<WeakCallbackInfoType>& data) {}
+ static void DisposeWeak(const WeakCallbackInfo<WeakCallbackDataType>& data) {}
private:
template <typename T>
@@ -504,6 +504,22 @@ class StdPersistentValueMap : public PersistentValueMap<K, V, Traits> {
};
+/**
+ * A map that uses Global as value and std::map as the backing
+ * implementation. Globals are held non-weak.
+ *
+ * C++11 embedders don't need this class, as they can use
+ * Global directly in std containers.
+ */
+template <typename K, typename V,
+ typename Traits = DefaultGlobalMapTraits<K, V> >
+class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> {
+ public:
+ explicit StdGlobalValueMap(Isolate* isolate)
+ : GlobalValueMap<K, V, Traits>(isolate) {}
+};
+
+
class DefaultPersistentValueVectorTraits {
public:
typedef std::vector<PersistentContainerValue> Impl;
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698