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

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

Issue 531183003: bindings: Retires manual dispatching in createV8{HTML,SVG}Wrapper, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed bindings/modules/v8/custom/custom.gni 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 | Annotate | Revision Log
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block constructor_getter %} 5 {% block constructor_getter %}
6 {% if has_constructor_attributes %} 6 {% if has_constructor_attributes %}
7 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info) 7 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info)
8 { 8 {
9 v8::Handle<v8::Value> data = info.Data(); 9 v8::Handle<v8::Value> data = info.Data();
10 ASSERT(data->IsExternal()); 10 ASSERT(data->IsExternal());
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld); 1134 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld);
1135 } 1135 }
1136 } 1136 }
1137 1137
1138 {% endif %} 1138 {% endif %}
1139 {% endblock %} 1139 {% endblock %}
1140 1140
1141 1141
1142 {##############################################################################} 1142 {##############################################################################}
1143 {% block wrap %} 1143 {% block wrap %}
1144 {% if not is_script_wrappable %}
1144 {% if special_wrap_for or is_document %} 1145 {% if special_wrap_for or is_document %}
1145 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate) 1146 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate)
1146 { 1147 {
1147 ASSERT(impl); 1148 ASSERT(impl);
1148 {% for special_wrap_interface in special_wrap_for %} 1149 {% for special_wrap_interface in special_wrap_for %}
1149 if (impl->is{{special_wrap_interface}}()) 1150 if (impl->is{{special_wrap_interface}}())
1150 return wrap(to{{special_wrap_interface}}(impl), creationContext, isolate ); 1151 return wrap(to{{special_wrap_interface}}(impl), creationContext, isolate );
1151 {% endfor %} 1152 {% endfor %}
1152 v8::Handle<v8::Object> wrapper = {{v8_class}}::createWrapper(impl, creationC ontext, isolate); 1153 v8::Handle<v8::Object> wrapper = {{v8_class}}::createWrapper(impl, creationC ontext, isolate);
1153 {% if is_document %} 1154 {% if is_document %}
(...skipping 10 matching lines...) Expand all
1164 1165
1165 {% elif not has_custom_to_v8 and not has_custom_wrap %} 1166 {% elif not has_custom_to_v8 and not has_custom_wrap %}
1166 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate) 1167 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate)
1167 { 1168 {
1168 ASSERT(impl); 1169 ASSERT(impl);
1169 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl, isolate)); 1170 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl, isolate));
1170 return {{v8_class}}::createWrapper(impl, creationContext, isolate); 1171 return {{v8_class}}::createWrapper(impl, creationContext, isolate);
1171 } 1172 }
1172 1173
1173 {% endif %} 1174 {% endif %}
1175 {% endif %}
1174 {% endblock %} 1176 {% endblock %}
1175 1177
1176 1178
1177 {##############################################################################} 1179 {##############################################################################}
1178 {% block create_wrapper %} 1180 {% block create_wrapper %}
1179 {% if not has_custom_to_v8 %} 1181 {% if not has_custom_to_v8 and not is_script_wrappable %}
1180 v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate) 1182 v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate)
1181 { 1183 {
1182 ASSERT(impl); 1184 ASSERT(impl);
1183 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl.get(), isolate)); 1185 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl.get(), isolate));
1184 {% if is_script_wrappable %}
1185 const WrapperTypeInfo* actualInfo = impl->typeInfo();
1186 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperType Info. These will both have
1187 // the same object de-ref functions, though, so use that as the basis of the check.
1188 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
1189 {% endif %}
1190 1186
1191 {% if is_document %} 1187 {% if is_document %}
1192 if (LocalFrame* frame = impl->frame()) { 1188 if (LocalFrame* frame = impl->frame()) {
1193 if (frame->script().initializeMainWorld()) { 1189 if (frame->script().initializeMainWorld()) {
1194 // initializeMainWorld may have created a wrapper for the object, re try from the start. 1190 // initializeMainWorld may have created a wrapper for the object, re try from the start.
1195 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class }}>(impl.get(), isolate); 1191 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class }}>(impl.get(), isolate);
1196 if (!wrapper.IsEmpty()) 1192 if (!wrapper.IsEmpty())
1197 return wrapper; 1193 return wrapper;
1198 } 1194 }
1199 } 1195 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 {% endif %} 1259 {% endif %}
1264 } 1260 }
1265 1261
1266 template<> 1262 template<>
1267 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1263 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1268 { 1264 {
1269 return toV8(impl, creationContext, isolate); 1265 return toV8(impl, creationContext, isolate);
1270 } 1266 }
1271 1267
1272 {% endblock %} 1268 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698