Add Dictionary::CreateEmpty
This commit is contained in:
parent
67d9eaa215
commit
b6c353ee80
2 changed files with 6 additions and 0 deletions
|
@ -19,6 +19,10 @@ Dictionary::Dictionary(v8::Isolate* isolate,
|
||||||
Dictionary::~Dictionary() {
|
Dictionary::~Dictionary() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary Dictionary::CreateEmpty(v8::Isolate* isolate) {
|
||||||
|
return Dictionary(isolate, v8::Object::New(isolate));;
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> Dictionary::GetHandle() const {
|
v8::Local<v8::Object> Dictionary::GetHandle() const {
|
||||||
return object_;
|
return object_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ class Dictionary {
|
||||||
Dictionary(v8::Isolate* isolate, v8::Local<v8::Object> object);
|
Dictionary(v8::Isolate* isolate, v8::Local<v8::Object> object);
|
||||||
~Dictionary();
|
~Dictionary();
|
||||||
|
|
||||||
|
static Dictionary CreateEmpty(v8::Isolate* isolate);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool Get(const base::StringPiece& key, T* out) const {
|
bool Get(const base::StringPiece& key, T* out) const {
|
||||||
v8::Local<v8::Value> val = GetHandle()->Get(StringToV8(isolate_, key));
|
v8::Local<v8::Value> val = GetHandle()->Get(StringToV8(isolate_, key));
|
||||||
|
|
Loading…
Reference in a new issue