mirror of
https://github.com/electron/electron.git
synced 2026-02-16 18:16:39 -05:00
Add PersistentDictionary.
This commit is contained in:
34
native_mate/persistent_dictionary.cc
Normal file
34
native_mate/persistent_dictionary.cc
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2014 Cheng Zhao. All rights reserved.
|
||||
// Use of this source code is governed by MIT license that can be found in the
|
||||
// LICENSE file.
|
||||
|
||||
#include "native_mate/persistent_dictionary.h"
|
||||
|
||||
namespace mate {
|
||||
|
||||
PersistentDictionary::PersistentDictionary() {
|
||||
}
|
||||
|
||||
PersistentDictionary::PersistentDictionary(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Object> object)
|
||||
: handle_(new RefCountedPersistent<v8::Object>(isolate, object)) {
|
||||
isolate_ = isolate;
|
||||
}
|
||||
|
||||
PersistentDictionary::~PersistentDictionary() {
|
||||
}
|
||||
|
||||
v8::Handle<v8::Object> PersistentDictionary::GetHandle() const {
|
||||
return handle_->NewHandle();
|
||||
}
|
||||
|
||||
bool Converter<PersistentDictionary>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
PersistentDictionary* out) {
|
||||
if (!val->IsObject())
|
||||
return false;
|
||||
*out = PersistentDictionary(isolate, v8::Handle<v8::Object>::Cast(val));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mate
|
||||
Reference in New Issue
Block a user