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

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

Issue 554893004: IDL: Add more test cases to idl-dictionary-unittest.html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "{{v8_class}}.h" 8 #include "{{v8_class}}.h"
9 9
10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
11 #include "{{filename}}" 11 #include "{{filename}}"
12 {% endfor %} 12 {% endfor %}
13 13
14 namespace blink { 14 namespace blink {
15 15
16 {{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value) 16 {{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value)
17 { 17 {
18 {{cpp_class}}* impl = {{cpp_class}}::create(); 18 {{cpp_class}}* impl = {{cpp_class}}::create();
19 // FIXME: Do not use Dictionary and DictionaryHelper 19 // FIXME: Do not use Dictionary and DictionaryHelper
20 // https://crbug.com/321462 20 // https://crbug.com/321462
21 Dictionary dictionary(v8Value, isolate); 21 Dictionary dictionary(v8Value, isolate);
22 {% for member in members %} 22 {% for member in members %}
23 {{member.cpp_type}} {{member.name}}; 23 {{member.cpp_type}} {{member.name}};
24 if (DictionaryHelper::get(dictionary, "{{member.name}}", {{member.name}})) 24 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name }}", {{member.name}}))
25 impl->{{member.setter_name}}({{member.name}}); 25 impl->{{member.setter_name}}({{member.name}});
26 {% endfor %} 26 {% endfor %}
27 return impl; 27 return impl;
28 } 28 }
29 29
30 v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate) 30 v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate)
31 { 31 {
32 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); 32 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
33 {% for member in members %} 33 {% for member in members %}
34 if (impl->{{member.has_method_name}}()) 34 if (impl->{{member.has_method_name}}())
35 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_t o_v8_value}}); 35 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_t o_v8_value}});
36 {% if member.v8_default_value %} 36 {% if member.v8_default_value %}
37 else 37 else
38 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}}); 38 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}});
39 {% endif %} 39 {% endif %}
40 {% endfor %} 40 {% endfor %}
41 return v8Object; 41 return v8Object;
42 } 42 }
43 43
44 } // namespace blink 44 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/DictionaryHelperForCore.cpp ('k') | Source/bindings/tests/results/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698