Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 1df17bbaf5107619ca6245610c32a8e9cda9322e..9e3dc33256a1da095bd534c68d6ea61699ff6a24 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -1527,6 +1527,30 @@ class V8_EXPORT JSON { |
| }; |
| +/** |
| + * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap |
| + * but |
| + * can be created without entering a v8::Context. |
|
Michael Starzinger
2015/02/03 13:21:54
nit: Can we add "... and hence shouldn't escape to
yurys
2015/02/03 13:39:06
Absolutely. Done.
|
| + */ |
| +class V8_EXPORT WeakMap { |
| + public: |
| + static WeakMap* New(Isolate* isolate); |
| + void Set(Handle<Value> key, Handle<Value> value); |
| + Local<Value> Get(Handle<Value> key); |
| + bool Has(Handle<Value> key); |
| + bool Delete(Handle<Value> key); |
| + |
| + private: |
| + WeakMap(Isolate* isolate, Handle<Object> weak_map) |
| + : isolate_(isolate), map_(isolate, weak_map) {} |
| + Isolate* isolate_; |
| + UniquePersistent<Object> map_; |
| + |
| + WeakMap(WeakMap&); |
|
Michael Starzinger
2015/02/03 13:21:54
nit: // Disallow copying and assigning.
yurys
2015/02/03 13:39:07
Done.
|
| + void operator=(WeakMap&); |
| +}; |
| + |
| + |
| // --- Value --- |