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

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

Issue 426583003: Revert of Enable the WebIDL [Exposed] annotation on an interface's members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« 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 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 554
555 {##############################################################################} 555 {##############################################################################}
556 {% from 'methods.cpp' import generate_constructor with context %} 556 {% from 'methods.cpp' import generate_constructor with context %}
557 {% block named_constructor %} 557 {% block named_constructor %}
558 {% if named_constructor %} 558 {% if named_constructor %}
559 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 559 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
560 if is_active_dom_object else '0' %} 560 if is_active_dom_object else '0' %}
561 {% set to_event_target = '%s::toEventTarget' % v8_class 561 {% set to_event_target = '%s::toEventTarget' % v8_class
562 if is_event_target else '0' %} 562 if is_event_target else '0' %}
563 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installConditionallyEna bledMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} }; 563 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnable dMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} };
564 564
565 {{generate_constructor(named_constructor)}} 565 {{generate_constructor(named_constructor)}}
566 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate) 566 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate)
567 { 567 {
568 static int domTemplateKey; // This address is used for a key to look up the dom template. 568 static int domTemplateKey; // This address is used for a key to look up the dom template.
569 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 569 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
570 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey); 570 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
571 if (!result.IsEmpty()) 571 if (!result.IsEmpty())
572 return result; 572 return result;
573 573
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 {##############################################################################} 742 {##############################################################################}
743 {% block install_attributes %} 743 {% block install_attributes %}
744 {% if has_attribute_configuration %} 744 {% if has_attribute_configuration %}
745 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { 745 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
746 {% for attribute in attributes 746 {% for attribute in attributes
747 if not (attribute.is_expose_js_accessors or 747 if not (attribute.is_expose_js_accessors or
748 attribute.is_static or 748 attribute.is_static or
749 attribute.runtime_enabled_function or 749 attribute.runtime_enabled_function or
750 attribute.per_context_enabled_function or 750 attribute.per_context_enabled_function or
751 attribute.exposed_test or
752 (interface_name == 'Window' and attribute.is_unforgeable)) 751 (interface_name == 'Window' and attribute.is_unforgeable))
753 and attribute.should_be_exposed_to_script %} 752 and attribute.should_be_exposed_to_script %}
754 {% filter conditional(attribute.conditional_string) %} 753 {% filter conditional(attribute.conditional_string) %}
755 {{attribute_configuration(attribute)}}, 754 {{attribute_configuration(attribute)}},
756 {% endfilter %} 755 {% endfilter %}
757 {% endfor %} 756 {% endfor %}
758 }; 757 };
759 758
760 {% endif %} 759 {% endif %}
761 {% endblock %} 760 {% endblock %}
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 functionTemplate->SetLength({{interface_length}}); 915 functionTemplate->SetLength({{interface_length}});
917 {% endif %} 916 {% endif %}
918 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate(); 917 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
919 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate(); 918 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
920 {% if is_check_security and interface_name != 'Window' %} 919 {% if is_check_security and interface_name != 'Window' %}
921 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); 920 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
922 {% endif %} 921 {% endif %}
923 {% for attribute in attributes 922 {% for attribute in attributes
924 if attribute.runtime_enabled_function and 923 if attribute.runtime_enabled_function and
925 not attribute.per_context_enabled_function and 924 not attribute.per_context_enabled_function and
926 not attribute.exposed_test and
927 not attribute.is_static %} 925 not attribute.is_static %}
928 {% filter conditional(attribute.conditional_string) %} 926 {% filter conditional(attribute.conditional_string) %}
929 if ({{attribute.runtime_enabled_function}}()) { 927 if ({{attribute.runtime_enabled_function}}()) {
930 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 928 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
931 {{attribute_configuration(attribute)}}; 929 {{attribute_configuration(attribute)}};
932 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); 930 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
933 } 931 }
934 {% endfilter %} 932 {% endfilter %}
935 {% endfor %} 933 {% endfor %}
936 {% if constants %} 934 {% if constants %}
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 {% block to_native_with_type_check %} 1148 {% block to_native_with_type_check %}
1151 {{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Han dle<v8::Value> value) 1149 {{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Han dle<v8::Value> value)
1152 { 1150 {
1153 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; 1151 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
1154 } 1152 }
1155 1153
1156 {% endblock %} 1154 {% endblock %}
1157 1155
1158 1156
1159 {##############################################################################} 1157 {##############################################################################}
1160 {% block install_conditional_attributes %} 1158 {% block install_per_context_attributes %}
1161 {% if has_conditional_attributes %} 1159 {% if has_per_context_enabled_attributes %}
1162 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceTemplate, v8::Isolate* isolate) 1160 void {{v8_class}}::installPerContextEnabledProperties(v8::Handle<v8::Object> ins tanceTemplate, {{cpp_class}}* impl, v8::Isolate* isolate)
1163 { 1161 {
1164 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype()); 1162 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype());
1165 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext()); 1163 {% for attribute in attributes if attribute.per_context_enabled_function %}
1166 1164 if ({{attribute.per_context_enabled_function}}(impl->document())) {
1167 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} 1165 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
1168 {% filter per_context_enabled(attribute.per_context_enabled_function) %} 1166 {{attribute_configuration(attribute)}};
1169 {% filter exposed(attribute.exposed_test) %} 1167 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
1170 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\ 1168 }
1171 {{attribute_configuration(attribute)}};
1172 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, at tributeConfiguration, isolate);
1173 {% endfilter %}
1174 {% endfilter %}
1175 {% endfor %} 1169 {% endfor %}
1176 } 1170 }
1177 1171
1178 {% endif %} 1172 {% endif %}
1179 {% endblock %} 1173 {% endblock %}
1180 1174
1181 1175
1182 {##############################################################################} 1176 {##############################################################################}
1183 {% block install_conditional_methods %} 1177 {% block install_per_context_methods %}
1184 {% if conditionally_enabled_methods %} 1178 {% if per_context_enabled_methods %}
1185 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro totypeTemplate, v8::Isolate* isolate) 1179 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot ypeTemplate, v8::Isolate* isolate)
1186 { 1180 {
1187 {# Define per-context enabled operations #} 1181 {# Define per-context enabled operations #}
1188 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate)); 1182 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
1183
1189 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext()); 1184 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext());
1190 1185 {% for method in per_context_enabled_methods %}
1191 {% for method in conditionally_enabled_methods %} 1186 if (context && context->isDocument() && {{method.per_context_enabled_functio n}}(toDocument(context)))
1192 {% filter per_context_enabled(method.per_context_enabled_function) %} 1187 prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::F unctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCall back, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})- >GetFunction());
1193 {% filter exposed(method.exposed_test) %}
1194 prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Funct ionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback , v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->Get Function());
1195 {% endfilter %}
1196 {% endfilter %}
1197 {% endfor %} 1188 {% endfor %}
1198 } 1189 }
1199 1190
1200 {% endif %} 1191 {% endif %}
1201 {% endblock %} 1192 {% endblock %}
1202 1193
1203 1194
1204 {##############################################################################} 1195 {##############################################################################}
1205 {% block to_active_dom_object %} 1196 {% block to_active_dom_object %}
1206 {% if is_active_dom_object %} 1197 {% if is_active_dom_object %}
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 {% if is_audio_buffer %} 1314 {% if is_audio_buffer %}
1324 {# We only setDeallocationObservers on array buffers that are held by some 1315 {# We only setDeallocationObservers on array buffers that are held by some
1325 object in the V8 heap, not in the ArrayBuffer constructor itself. 1316 object in the V8 heap, not in the ArrayBuffer constructor itself.
1326 This is because V8 GC only cares about memory it can free on GC, and 1317 This is because V8 GC only cares about memory it can free on GC, and
1327 until the object is exposed to JavaScript, V8 GC doesn't affect it. #} 1318 until the object is exposed to JavaScript, V8 GC doesn't affect it. #}
1328 for (unsigned i = 0, n = impl->numberOfChannels(); i < n; i++) { 1319 for (unsigned i = 0, n = impl->numberOfChannels(); i < n; i++) {
1329 Float32Array* channelData = impl->getChannelData(i); 1320 Float32Array* channelData = impl->getChannelData(i);
1330 channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocation Observer::instanceTemplate()); 1321 channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocation Observer::instanceTemplate());
1331 } 1322 }
1332 {% endif %} 1323 {% endif %}
1333 installConditionallyEnabledProperties(wrapper, isolate); 1324 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
1334 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInf o, wrapper, isolate, {{wrapper_configuration}}); 1325 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInf o, wrapper, isolate, {{wrapper_configuration}});
1335 return wrapper; 1326 return wrapper;
1336 } 1327 }
1337 1328
1338 {% endif %} 1329 {% endif %}
1339 {% endblock %} 1330 {% endblock %}
1340 1331
1341 1332
1342 {##############################################################################} 1333 {##############################################################################}
1343 {% block deref_object_and_to_v8_no_inline %} 1334 {% block deref_object_and_to_v8_no_inline %}
1344 void {{v8_class}}::derefObject(void* object) 1335 void {{v8_class}}::derefObject(void* object)
1345 { 1336 {
1346 {% if gc_type == 'RefCountedObject' %} 1337 {% if gc_type == 'RefCountedObject' %}
1347 fromInternalPointer(object)->deref(); 1338 fromInternalPointer(object)->deref();
1348 {% elif gc_type == 'WillBeGarbageCollectedObject' %} 1339 {% elif gc_type == 'WillBeGarbageCollectedObject' %}
1349 {% filter conditional('!ENABLE(OILPAN)') %} 1340 {% filter conditional('!ENABLE(OILPAN)') %}
1350 fromInternalPointer(object)->deref(); 1341 fromInternalPointer(object)->deref();
1351 {% endfilter %} 1342 {% endfilter %}
1352 {% endif %} 1343 {% endif %}
1353 } 1344 }
1354 1345
1355 template<> 1346 template<>
1356 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1347 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1357 { 1348 {
1358 return toV8(impl, creationContext, isolate); 1349 return toV8(impl, creationContext, isolate);
1359 } 1350 }
1360 1351
1361 {% endblock %} 1352 {% 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