Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: Source/bindings/templates/dictionary_v8.cpp

Issue 386963003: [WIP][NotForLand] IDL dictionary support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6
7 #include "config.h"
8 {% filter conditional(conditional_string) %}
9 #include "{{v8_class}}.h"
10
11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
12 #include "{{filename}}"
13 {% endfor %}
14
15 namespace WebCore {
16
17 {{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Han dle<v8::Value> v8Value)
18 {
19 {{cpp_class}}* impl = {{cpp_class}}::create();
20 // FIXME: Do not use Dictionary and DictionaryHelper
Nils Barth (inactive) 2014/07/18 21:52:35 Bug number?
bashi 2014/07/22 02:33:58 Done.
21 Dictionary dictionary(v8Value, isolate);
22 {% for member in members %}
23 impl->m_{{member.has_name}} = DictionaryHelper::get(dictionary, "{{member.na me}}", impl->m_{{member.name}});
24 {% if member.default_value %}
25 if (!impl->m_{{member.has_name}})
26 impl->{{member.setter_name}}({{member.default_value}});
27 {% endif %}
28 {% endfor %}
29 return impl;
30 }
31
32 v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate)
33 {
34 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
35 {% for member in members %}
36 if (impl->{{member.has_name}}())
37 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_t o_v8_value}});
38 {% if member.v8_default_value %}
39 else
40 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}});
41 {% endif %}
42
43 {% endfor %}
44 return v8Object;
45 }
46
47 } // namespace WebCore
48 {% endfilter %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698