[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / gin / dictionary.cc
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gin/dictionary.h"
6
7 namespace gin {
8
9 Dictionary::Dictionary(v8::Isolate* isolate)
10     : isolate_(isolate) {
11 }
12
13 Dictionary::Dictionary(v8::Isolate* isolate,
14                        v8::Local<v8::Object> object)
15     : isolate_(isolate),
16       object_(object) {
17 }
18
19 Dictionary::Dictionary(const Dictionary& other) = default;
20
21 Dictionary::~Dictionary() = default;
22
23 Dictionary Dictionary::CreateEmpty(v8::Isolate* isolate) {
24   Dictionary dictionary(isolate);
25   dictionary.object_ = v8::Object::New(isolate);
26   return dictionary;
27 }
28
29 v8::Local<v8::Value> Converter<Dictionary>::ToV8(v8::Isolate* isolate,
30                                                   Dictionary val) {
31   return val.object_;
32 }
33
34 bool Converter<Dictionary>::FromV8(v8::Isolate* isolate,
35                                    v8::Local<v8::Value> val,
36                                    Dictionary* out) {
37   if (!val->IsObject())
38     return false;
39   *out = Dictionary(isolate, v8::Local<v8::Object>::Cast(val));
40   return true;
41 }
42
43 }  // namespace gin