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

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

Issue 116153002: IDL compiler: [NamedConstructor] (basic) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %}
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
123 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, jsValue, info); 123 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, jsValue, info);
124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
125 } 125 }
126 126
127 {% endif %} 127 {% endif %}
128 {% endblock %} 128 {% endblock %}
129 129
130 130
131 {##############################################################################} 131 {##############################################################################}
132 {% block overloaded_constructor_callback %} 132 {% from 'methods.cpp' import named_constructor_callback with context %}
133 {% block named_constructor %}
134 {% if named_constructor %}
135 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, 0, 0, 0 , {{v8_class}}::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype } ;
136
137 {{named_constructor_callback(named_constructor)}}
138 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate, WrapperWorldType currentWorldType)
139 {
140 // This is only for getting a unique pointer which we can pass to privateTem plate.
141 static int privateTemplateUniqueKey;
142 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
143 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre ntWorldType, &privateTemplateUniqueKey);
144 if (!result.IsEmpty())
145 return result;
146
147 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
148 v8::EscapableHandleScope scope(isolate);
149 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ;
150
151 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
152 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
153 result->SetClassName(v8::String::NewFromUtf8(isolate, "{{cpp_class}}", v8::S tring::kInternalizedString));
154 result->Inherit({{v8_class}}::domTemplate(isolate, currentWorldType));
155 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result );
156
157 return scope.Escape(result);
158 }
159
160 {% endif %}
161 {% endblock %}
162
163 {##############################################################################}
164 {% block overloaded_constructor %}
133 {% if constructors|length > 1 %} 165 {% if constructors|length > 1 %}
134 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 166 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
135 { 167 {
136 {% for constructor in constructors %} 168 {% for constructor in constructors %}
137 if ({{constructor.overload_resolution_expression}}) { 169 if ({{constructor.overload_resolution_expression}}) {
138 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ; 170 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ;
139 return; 171 return;
140 } 172 }
141 {% endfor %} 173 {% endfor %}
142 {% if interface_length %} 174 {% if interface_length %}
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 fromInternalPointer(object)->deref(); 711 fromInternalPointer(object)->deref();
680 } 712 }
681 713
682 template<> 714 template<>
683 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 715 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
684 { 716 {
685 return toV8(impl, creationContext, isolate); 717 return toV8(impl, creationContext, isolate);
686 } 718 }
687 719
688 {% endblock %} 720 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698