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

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

Issue 759893002: IDL: Auto-generate NativeValueTraits for IDL dictionaries (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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_original_class}}.h" 8 #include "{{v8_original_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 %}
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 {% endif %} 51 {% endif %}
52 impl.{{member.setter_name}}({{member.name}}); 52 impl.{{member.setter_name}}({{member.name}});
53 } else if (block.HasCaught()) { 53 } else if (block.HasCaught()) {
54 exceptionState.rethrowV8Exception(block.Exception()); 54 exceptionState.rethrowV8Exception(block.Exception());
55 return; 55 return;
56 } 56 }
57 57
58 {% endfor %} 58 {% endfor %}
59 } 59 }
60 60
61 v8::Handle<v8::Value> toV8({{cpp_class}}& impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate) 61 v8::Handle<v8::Value> toV8(const {{cpp_class}}& impl, v8::Handle<v8::Object> cre ationContext, v8::Isolate* isolate)
62 { 62 {
63 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); 63 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
64 {% if parent_v8_class %} 64 {% if parent_v8_class %}
65 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate); 65 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate);
66 {% endif %} 66 {% endif %}
67 toV8{{cpp_class}}(impl, v8Object, creationContext, isolate); 67 toV8{{cpp_class}}(impl, v8Object, creationContext, isolate);
68 return v8Object; 68 return v8Object;
69 } 69 }
70 70
71 void toV8{{cpp_class}}({{cpp_class}}& impl, v8::Handle<v8::Object> dictionary, v 8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 71 template<>
72 v8::Handle<v8::Value> toV8NoInline(const {{cpp_class}}* impl, v8::Handle<v8::Obj ect> creationContext, v8::Isolate* isolate)
73 {
74 return toV8(*impl, creationContext, isolate);
75 }
76
77 void toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Handle<v8::Object> diction ary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
72 { 78 {
73 {% for member in members %} 79 {% for member in members %}
74 if (impl.{{member.has_method_name}}()) { 80 if (impl.{{member.has_method_name}}()) {
75 {% if member.is_object %} 81 {% if member.is_object %}
76 ASSERT(impl.{{member.cpp_name}}().isObject()); 82 ASSERT(impl.{{member.cpp_name}}().isObject());
77 {% endif %} 83 {% endif %}
78 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value _to_v8_value}}); 84 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value _to_v8_value}});
79 {% if member.v8_default_value %} 85 {% if member.v8_default_value %}
80 } else { 86 } else {
81 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul t_value}}); 87 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul t_value}});
82 {% endif %} 88 {% endif %}
83 } 89 }
84 90
85 {% endfor %} 91 {% endfor %}
86 } 92 }
87 93
94 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(const v8::Handle<v8: :Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
95 {
96 {{cpp_class}} impl;
97 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
98 return impl;
99 }
100
88 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/templates/dictionary_v8.h ('k') | Source/bindings/tests/idls/core/TestDictionary.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698