electron/native_mate/dictionary.cc

41 lines
1 KiB
C++
Raw Normal View History

2014-04-15 03:04:36 +00:00
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE.chromium file.
#include "native_mate/dictionary.h"
namespace mate {
Dictionary::Dictionary()
: isolate_(NULL) {
2014-04-15 03:04:36 +00:00
}
Dictionary::Dictionary(v8::Isolate* isolate,
v8::Handle<v8::Object> object)
: isolate_(isolate),
object_(object) {
}
Dictionary::~Dictionary() {
}
2014-09-09 06:12:59 +00:00
v8::Handle<v8::Object> Dictionary::GetHandle() const {
return object_;
}
2014-04-15 03:04:36 +00:00
v8::Handle<v8::Value> Converter<Dictionary>::ToV8(v8::Isolate* isolate,
Dictionary val) {
2014-09-09 06:12:59 +00:00
return val.GetHandle();
2014-04-15 03:04:36 +00:00
}
bool Converter<Dictionary>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
Dictionary* out) {
if (!val->IsObject())
return false;
*out = Dictionary(isolate, v8::Handle<v8::Object>::Cast(val));
return true;
}
} // namespace mate