Use the new Constructor API.
This commit is contained in:
parent
8162689014
commit
1ae30328d6
3 changed files with 46 additions and 35 deletions
|
@ -18,19 +18,16 @@ namespace atom {
|
|||
namespace api {
|
||||
|
||||
// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
|
||||
class IDWeakMap : public mate::Wrappable<IDWeakMap> {
|
||||
class IDWeakMap : public mate::Wrappable {
|
||||
public:
|
||||
IDWeakMap();
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> exports);
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Handle<v8::ObjectTemplate> prototype);
|
||||
|
||||
private:
|
||||
virtual ~IDWeakMap();
|
||||
|
||||
static void WeakCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* value,
|
||||
IDWeakMap* self);
|
||||
|
||||
int32_t Add(v8::Isolate* isolate, v8::Handle<v8::Object> object);
|
||||
v8::Handle<v8::Value> Get(int32_t key);
|
||||
bool Has(int32_t key) const;
|
||||
|
@ -38,6 +35,10 @@ class IDWeakMap : public mate::Wrappable<IDWeakMap> {
|
|||
void Remove(int32_t key);
|
||||
int GetNextID();
|
||||
|
||||
static void WeakCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* value,
|
||||
IDWeakMap* self);
|
||||
|
||||
int32_t next_id_;
|
||||
std::map<int32_t, RefCountedV8Object> map_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue