Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / gin / dictionary.cc
blobd3361228bb21a9e61f03c1f858f1dc45c3d590bf
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gin/dictionary.h"
7 namespace gin {
9 Dictionary::Dictionary(v8::Isolate* isolate)
10 : isolate_(isolate) {
13 Dictionary::Dictionary(v8::Isolate* isolate,
14 v8::Handle<v8::Object> object)
15 : isolate_(isolate),
16 object_(object) {
19 Dictionary::~Dictionary() {
22 Dictionary Dictionary::CreateEmpty(v8::Isolate* isolate) {
23 Dictionary dictionary(isolate);
24 dictionary.object_ = v8::Object::New(isolate);
25 return dictionary;
28 v8::Handle<v8::Value> Converter<Dictionary>::ToV8(v8::Isolate* isolate,
29 Dictionary val) {
30 return val.object_;
33 bool Converter<Dictionary>::FromV8(v8::Isolate* isolate,
34 v8::Handle<v8::Value> val,
35 Dictionary* out) {
36 if (!val->IsObject())
37 return false;
38 *out = Dictionary(isolate, v8::Handle<v8::Object>::Cast(val));
39 return true;
42 } // namespace gin