OLD | NEW |
---|---|
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 {% filter conditional(conditional_string) %} | 8 {% filter conditional(conditional_string) %} |
9 #include "{{v8_class_or_partial}}.h" | 9 #include "{{v8_class_or_partial}}.h" |
10 | 10 |
11 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 11 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
12 #include "{{filename}}" | 12 #include "{{filename}}" |
13 {% endfor %} | 13 {% endfor %} |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class | 16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class |
17 if is_active_dom_object else '0' %} | 17 if is_active_dom_object else '0' %} |
18 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class | 18 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class |
19 if has_visit_dom_wrapper else '0' %} | 19 if has_visit_dom_wrapper else '0' %} |
20 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface | 20 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface |
21 if parent_interface else '0' %} | 21 if parent_interface else '0' %} |
22 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else | 22 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else |
23 'WrapperTypeObjectPrototype' %} | 23 'WrapperTypeObjectPrototype' %} |
24 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %} | 24 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %} |
25 | 25 |
26 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} | 26 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} |
27 {% if not is_partial %} | 27 {% if not is_partial %} |
28 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::deref Object, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{ v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditional lyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_ty pe_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_ target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type} } }; | 28 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::deref Object, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{ v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditional lyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, Wrapper TypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, Wra pperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, Wrapp erTypeInfo::{{gc_type}} }; |
29 | 29 |
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. | 30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. |
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
32 // bindings/core/v8/ScriptWrappable.h. | 32 // bindings/core/v8/ScriptWrappable.h. |
33 {% if is_typed_array_type %} | 33 {% if is_typed_array_type %} |
34 template<> | 34 template<> |
35 {% endif %} | 35 {% endif %} |
36 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; | 36 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; |
37 | 37 |
38 {% endif %} | 38 {% endif %} |
(...skipping 23 matching lines...) Expand all Loading... | |
62 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); | 62 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); |
63 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { | 63 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { |
64 exceptionState.throwIfNeeded(); | 64 exceptionState.throwIfNeeded(); |
65 return; | 65 return; |
66 } | 66 } |
67 {% endif %} | 67 {% endif %} |
68 ASSERT(info.This()->IsObject()); | 68 ASSERT(info.This()->IsObject()); |
69 v8::Local<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | 69 v8::Local<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
70 } | 70 } |
71 | 71 |
72 {% for attribute in attributes | |
73 if (attribute.constructor_type and | |
74 attribute.name == attribute.constructor_type and | |
75 not attribute.is_expose_js_accessors) %} | |
76 {% if loop.first %} | |
haraken
2015/03/17 00:06:07
Instead of using loop.first, can we introduce has_
Yuki
2015/03/17 08:35:19
Done.
| |
77 static void {{cpp_class}}ConstructorAttributeSetterCallbackAsProperty(v8::Local< v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
haraken
2015/03/17 00:06:07
I'm just curious, but how many constructor attribu
Yuki
2015/03/17 08:35:19
We've not yet moved any of constructor attribute t
| |
78 { | |
79 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
80 do { | |
haraken
2015/03/17 00:06:08
What is the do...while for?
Yuki
2015/03/17 08:35:19
Added a comment. It's for use of 'break'.
We need
| |
81 v8::Local<v8::Value> data = info.Data(); | |
haraken
2015/03/17 00:06:08
Not related to your CL, we want to deprecate info.
Yuki
2015/03/17 08:35:19
We could use "hidden value" instead of info.Data()
| |
82 ASSERT(data->IsExternal()); | |
83 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()- >CreationContext()); | |
84 if (!perContextData) | |
85 break; | |
86 const WrapperTypeInfo* wrapperTypeInfo = WrapperTypeInfo::unwrap(data); | |
87 if (!wrapperTypeInfo) | |
88 break; | |
89 {{cpp_class}}ForceSetAttributeOnThis(v8String(info.GetIsolate(), wrapper TypeInfo->interfaceName), v8Value, info); | |
haraken
2015/03/17 00:06:07
Not related to your CL, I want to understand why t
Yuki
2015/03/17 08:35:19
My understanding is:
Set = regular assignment, w
| |
90 } while (false); | |
91 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
92 } | |
93 | |
94 {% endif %} | |
95 {% endfor %} | |
96 {% for attribute in attributes | |
97 if (attribute.constructor_type and | |
98 attribute.name == attribute.constructor_type and | |
99 attribute.is_expose_js_accessors) %} | |
100 {% if loop.first %} | |
haraken
2015/03/17 00:06:08
Ditto. I'd prefer has_constructor_attribute_setter
Yuki
2015/03/17 08:35:19
Done.
| |
101 static void {{cpp_class}}ConstructorAttributeSetterCallbackAsAccessor(const v8:: FunctionCallbackInfo<v8::Value>& info) | |
102 { | |
103 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
104 do { | |
haraken
2015/03/17 00:06:07
What is the do...while for?
Yuki
2015/03/17 08:35:19
Done.
| |
105 v8::Local<v8::Value> v8Value = info[0]; | |
106 v8::Local<v8::Value> data = info.Data(); | |
107 ASSERT(data->IsExternal()); | |
108 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()- >CreationContext()); | |
109 if (!perContextData) | |
110 break; | |
111 const WrapperTypeInfo* wrapperTypeInfo = WrapperTypeInfo::unwrap(data); | |
112 if (!wrapperTypeInfo) | |
113 break; | |
114 {{cpp_class}}ForceSetAttributeOnThis(v8String(info.GetIsolate(), wrapper TypeInfo->interfaceName), v8Value, info); | |
115 } while (false); | |
116 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
117 } | |
118 | |
119 {% endif %} | |
120 {% endfor %} | |
72 {% endif %} | 121 {% endif %} |
73 {% endblock %} | 122 {% endblock %} |
74 {##############################################################################} | 123 {##############################################################################} |
75 {% from 'attributes.cpp' import constructor_getter_callback, | 124 {% from 'attributes.cpp' import constructor_getter_callback, |
76 attribute_getter, attribute_getter_callback, | 125 attribute_getter, attribute_getter_callback, |
77 attribute_setter, attribute_setter_callback, | 126 attribute_setter, attribute_setter_callback, |
78 attribute_getter_implemented_in_private_script, | 127 attribute_getter_implemented_in_private_script, |
79 attribute_setter_implemented_in_private_script | 128 attribute_setter_implemented_in_private_script |
80 with context %} | 129 with context %} |
81 {% for attribute in attributes if attribute.should_be_exposed_to_script %} | 130 {% for attribute in attributes if attribute.should_be_exposed_to_script %} |
82 {% for world_suffix in attribute.world_suffixes %} | 131 {% for world_suffix in attribute.world_suffixes %} |
83 {% if not attribute.constructor_type %} | 132 {% if not attribute.constructor_type %} |
84 {% if not attribute.has_custom_getter %} | 133 {% if not attribute.has_custom_getter %} |
85 {{attribute_getter(attribute, world_suffix)}} | 134 {{attribute_getter(attribute, world_suffix)}} |
86 {% endif %} | 135 {% endif %} |
87 {{attribute_getter_callback(attribute, world_suffix)}} | 136 {{attribute_getter_callback(attribute, world_suffix)}} |
88 {% endif %} | 137 {% endif %} |
89 {% if attribute.has_setter %} | 138 {% if attribute.has_setter %} |
90 {% if not attribute.has_custom_setter %} | 139 {% if not (attribute.has_custom_setter or |
140 (attribute.constructor_type and attribute.name == attribute.construct or_type)) %} | |
haraken
2015/03/17 00:06:08
Maybe I'm wrong, but can we avoid introducing the
Yuki
2015/03/17 08:35:19
No, we cannot. At least there is case that 1) the
| |
91 {{attribute_setter(attribute, world_suffix)}} | 141 {{attribute_setter(attribute, world_suffix)}} |
92 {% endif %} | 142 {% endif %} |
143 {% if not (attribute.constructor_type and attribute.name == attribute.constructo r_type) %} | |
93 {{attribute_setter_callback(attribute, world_suffix)}} | 144 {{attribute_setter_callback(attribute, world_suffix)}} |
94 {% endif %} | 145 {% endif %} |
146 {% endif %} | |
95 {% endfor %} | 147 {% endfor %} |
96 {% endfor %} | 148 {% endfor %} |
97 {##############################################################################} | 149 {##############################################################################} |
98 {% for attribute in attributes if attribute.needs_constructor_getter_callback %} | 150 {% for attribute in attributes if attribute.needs_constructor_getter_callback %} |
99 {% for world_suffix in attribute.world_suffixes %} | 151 {% for world_suffix in attribute.world_suffixes %} |
100 {{constructor_getter_callback(attribute, world_suffix)}} | 152 {{constructor_getter_callback(attribute, world_suffix)}} |
101 {% endfor %} | 153 {% endfor %} |
102 {% endfor %} | 154 {% endfor %} |
103 {##############################################################################} | 155 {##############################################################################} |
104 {% block security_check_functions %} | 156 {% block security_check_functions %} |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 {% endfor %} | 529 {% endfor %} |
478 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 530 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
479 {{attribute_getter_implemented_in_private_script(attribute)}} | 531 {{attribute_getter_implemented_in_private_script(attribute)}} |
480 {% if attribute.has_setter %} | 532 {% if attribute.has_setter %} |
481 {{attribute_setter_implemented_in_private_script(attribute)}} | 533 {{attribute_setter_implemented_in_private_script(attribute)}} |
482 {% endif %} | 534 {% endif %} |
483 {% endfor %} | 535 {% endfor %} |
484 {% block partial_interface %}{% endblock %} | 536 {% block partial_interface %}{% endblock %} |
485 } // namespace blink | 537 } // namespace blink |
486 {% endfilter %} | 538 {% endfilter %} |
OLD | NEW |