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 531183003: bindings: Retires manual dispatching in createV8{HTML,SVG}Wrapper, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added FIXME comments. 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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld); 1138 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld);
1139 } 1139 }
1140 } 1140 }
1141 1141
1142 {% endif %} 1142 {% endif %}
1143 {% endblock %} 1143 {% endblock %}
1144 1144
1145 1145
1146 {##############################################################################} 1146 {##############################################################################}
1147 {% block wrap %} 1147 {% block wrap %}
1148 {% if not is_script_wrappable %}
1148 {% if special_wrap_for or is_document %} 1149 {% if special_wrap_for or is_document %}
1149 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate) 1150 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate)
1150 { 1151 {
1151 ASSERT(impl); 1152 ASSERT(impl);
1152 {% for special_wrap_interface in special_wrap_for %} 1153 {% for special_wrap_interface in special_wrap_for %}
1153 if (impl->is{{special_wrap_interface}}()) 1154 if (impl->is{{special_wrap_interface}}())
1154 return wrap(to{{special_wrap_interface}}(impl), creationContext, isolate ); 1155 return wrap(to{{special_wrap_interface}}(impl), creationContext, isolate );
1155 {% endfor %} 1156 {% endfor %}
1156 v8::Handle<v8::Object> wrapper = {{v8_class}}::createWrapper(impl, creationC ontext, isolate); 1157 v8::Handle<v8::Object> wrapper = {{v8_class}}::createWrapper(impl, creationC ontext, isolate);
1157 {% if is_document %} 1158 {% if is_document %}
(...skipping 10 matching lines...) Expand all
1168 1169
1169 {% elif not has_custom_to_v8 and not has_custom_wrap %} 1170 {% elif not has_custom_to_v8 and not has_custom_wrap %}
1170 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate) 1171 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate)
1171 { 1172 {
1172 ASSERT(impl); 1173 ASSERT(impl);
1173 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl, isolate)); 1174 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl, isolate));
1174 return {{v8_class}}::createWrapper(impl, creationContext, isolate); 1175 return {{v8_class}}::createWrapper(impl, creationContext, isolate);
1175 } 1176 }
1176 1177
1177 {% endif %} 1178 {% endif %}
1179 {% endif %}
1178 {% endblock %} 1180 {% endblock %}
1179 1181
1180 1182
1181 {##############################################################################} 1183 {##############################################################################}
1182 {% block create_wrapper %} 1184 {% block create_wrapper %}
1183 {% if not has_custom_to_v8 %} 1185 {% if not has_custom_to_v8 and not is_script_wrappable %}
1184 v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate) 1186 v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate)
1185 { 1187 {
1186 ASSERT(impl); 1188 ASSERT(impl);
1187 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl.get(), isolate)); 1189 ASSERT(!DOMDataStore::containsWrapper<{{v8_class}}>(impl.get(), isolate));
1188 {% if is_script_wrappable %}
1189 const WrapperTypeInfo* actualInfo = impl->typeInfo();
1190 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperType Info. These will both have
1191 // the same object de-ref functions, though, so use that as the basis of the check.
1192 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
1193 {% endif %}
1194 1190
1195 {% if is_document %} 1191 {% if is_document %}
1196 if (LocalFrame* frame = impl->frame()) { 1192 if (LocalFrame* frame = impl->frame()) {
1197 if (frame->script().initializeMainWorld()) { 1193 if (frame->script().initializeMainWorld()) {
1198 // initializeMainWorld may have created a wrapper for the object, re try from the start. 1194 // initializeMainWorld may have created a wrapper for the object, re try from the start.
1199 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class }}>(impl.get(), isolate); 1195 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class }}>(impl.get(), isolate);
1200 if (!wrapper.IsEmpty()) 1196 if (!wrapper.IsEmpty())
1201 return wrapper; 1197 return wrapper;
1202 } 1198 }
1203 } 1199 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 {% endif %} 1263 {% endif %}
1268 } 1264 }
1269 1265
1270 template<> 1266 template<>
1271 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1267 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1272 { 1268 {
1273 return toV8(impl, creationContext, isolate); 1269 return toV8(impl, creationContext, isolate);
1274 } 1270 }
1275 1271
1276 {% endblock %} 1272 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/tests/results/V8SVGTestInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698