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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2645813003: [Bindings] Make exported functions visible from other components (Closed)
Patch Set: . Created 3 years, 11 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
OLDNEW
1 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 {% block named_property_enumerator_callback %}{% endblock %} 182 {% block named_property_enumerator_callback %}{% endblock %}
183 {% block indexed_property_getter %}{% endblock %} 183 {% block indexed_property_getter %}{% endblock %}
184 {% block indexed_property_getter_callback %}{% endblock %} 184 {% block indexed_property_getter_callback %}{% endblock %}
185 {% block indexed_property_setter %}{% endblock %} 185 {% block indexed_property_setter %}{% endblock %}
186 {% block indexed_property_setter_callback %}{% endblock %} 186 {% block indexed_property_setter_callback %}{% endblock %}
187 {% block indexed_property_deleter %}{% endblock %} 187 {% block indexed_property_deleter %}{% endblock %}
188 {% block indexed_property_deleter_callback %}{% endblock %} 188 {% block indexed_property_deleter_callback %}{% endblock %}
189 {##############################################################################} 189 {##############################################################################}
190 {% block security_check_functions %} 190 {% block security_check_functions %}
191 {% if has_access_check_callbacks and not is_partial %} 191 {% if has_access_check_callbacks and not is_partial %}
192 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object > accessedObject, v8::Local<v8::Value> data) { 192 {{exported}}bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Loca l<v8::Object> accessedObject, v8::Local<v8::Value> data) {
193 {% if interface_name == 'Window' %} 193 {% if interface_name == 'Window' %}
194 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 194 v8::Isolate* isolate = v8::Isolate::GetCurrent();
195 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed Object, isolate); 195 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed Object, isolate);
196 if (window.IsEmpty()) 196 if (window.IsEmpty())
197 return false; // the frame is gone. 197 return false; // the frame is gone.
198 198
199 const DOMWindow* targetWindow = V8Window::toImpl(window); 199 const DOMWindow* targetWindow = V8Window::toImpl(window);
200 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), targetWindow, BindingSecurity::ErrorReportOption::DoNotReport); 200 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), targetWindow, BindingSecurity::ErrorReportOption::DoNotReport);
201 {% else %}{# if interface_name == 'Window' #} 201 {% else %}{# if interface_name == 'Window' #}
202 {# Not 'Window' means it\'s Location. #} 202 {# Not 'Window' means it\'s Location. #}
(...skipping 20 matching lines...) Expand all
223 }, 223 },
224 {% endfor %} 224 {% endfor %}
225 {##### Cross-origin methods #####} 225 {##### Cross-origin methods #####}
226 {% for method in methods if method.is_cross_origin %} 226 {% for method in methods if method.is_cross_origin %}
227 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG etter, nullptr}, 227 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG etter, nullptr},
228 {% endfor %} 228 {% endfor %}
229 }; 229 };
230 {% endif %} 230 {% endif %}
231 231
232 {% if has_cross_origin_named_getter %} 232 {% if has_cross_origin_named_getter %}
233 void crossOriginNamedGetter(v8::Local<v8::Name> name, const v8::PropertyCallback Info<v8::Value>& info) { 233 {{exported}}void crossOriginNamedGetter(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info) {
234 if (!name->IsString()) 234 if (!name->IsString())
235 return; 235 return;
236 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 236 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
237 237
238 for (const auto& attribute : kCrossOriginAttributeTable) { 238 for (const auto& attribute : kCrossOriginAttributeTable) {
239 if (propertyName == attribute.name && attribute.getter) { 239 if (propertyName == attribute.name && attribute.getter) {
240 attribute.getter(info); 240 attribute.getter(info);
241 return; 241 return;
242 } 242 }
243 } 243 }
244 244
245 {% if named_property_getter and named_property_getter.is_cross_origin %} 245 {% if named_property_getter and named_property_getter.is_cross_origin %}
246 {% if named_property_getter.is_custom %} 246 {% if named_property_getter.is_custom %}
247 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); 247 {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
248 {% else %} 248 {% else %}
249 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); 249 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
250 {% endif %} 250 {% endif %}
251 {% else %} 251 {% else %}
252 BindingSecurity::failedAccessCheckFor( 252 BindingSecurity::failedAccessCheckFor(
253 info.GetIsolate(), 253 info.GetIsolate(),
254 {{v8_class}}::toImpl(info.Holder())->frame()); 254 {{v8_class}}::toImpl(info.Holder())->frame());
255 {% endif %} 255 {% endif %}
256 } 256 }
257 {% endif %} 257 {% endif %}
258 258
259 {% if has_cross_origin_named_setter %} 259 {% if has_cross_origin_named_setter %}
260 void crossOriginNamedSetter(v8::Local<v8::Name> name, v8::Local<v8::Value> value , const v8::PropertyCallbackInfo<v8::Value>& info) { 260 {{exported}}void crossOriginNamedSetter(v8::Local<v8::Name> name, v8::Local<v8:: Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {
261 if (!name->IsString()) 261 if (!name->IsString())
262 return; 262 return;
263 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 263 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
264 264
265 for (const auto& attribute : kCrossOriginAttributeTable) { 265 for (const auto& attribute : kCrossOriginAttributeTable) {
266 if (propertyName == attribute.name && attribute.setter) { 266 if (propertyName == attribute.name && attribute.setter) {
267 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder())); 267 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho lder()));
268 return; 268 return;
269 } 269 }
270 } 270 }
271 271
272 {# If there were no matches in the cross-origin attribute table, consider it 272 {# If there were no matches in the cross-origin attribute table, consider it
273 an access check failure: there are no custom named setters that are 273 an access check failure: there are no custom named setters that are
274 accessible from a cross-origin context. #} 274 accessible from a cross-origin context. #}
275 275
276 BindingSecurity::failedAccessCheckFor( 276 BindingSecurity::failedAccessCheckFor(
277 info.GetIsolate(), 277 info.GetIsolate(),
278 {{v8_class}}::toImpl(info.Holder())->frame()); 278 {{v8_class}}::toImpl(info.Holder())->frame());
279 } 279 }
280 {% endif %} 280 {% endif %}
281 281
282 {% if has_cross_origin_named_enumerator %} 282 {% if has_cross_origin_named_enumerator %}
283 void crossOriginNamedEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { 283 {{exported}}void crossOriginNamedEnumerator(const v8::PropertyCallbackInfo<v8::A rray>& info) {
284 Vector<String> names; 284 Vector<String> names;
285 for (const auto& attribute : kCrossOriginAttributeTable) 285 for (const auto& attribute : kCrossOriginAttributeTable)
286 names.push_back(attribute.name); 286 names.push_back(attribute.name);
287 287
288 v8SetReturnValue( 288 v8SetReturnValue(
289 info, 289 info,
290 ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); 290 ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
291 } 291 }
292 {% endif %} 292 {% endif %}
293 293
294 {% if has_cross_origin_indexed_getter %} 294 {% if has_cross_origin_indexed_getter %}
295 void crossOriginIndexedGetter(uint32_t index, const v8::PropertyCallbackInfo<v8: :Value>& info) { 295 {{exported}}void crossOriginIndexedGetter(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) {
296 {% if indexed_property_getter.is_custom %} 296 {% if indexed_property_getter.is_custom %}
297 {{v8_class}}::indexedPropertyGetterCustom(index, info); 297 {{v8_class}}::indexedPropertyGetterCustom(index, info);
298 {% else %} 298 {% else %}
299 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); 299 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info);
300 {% endif %} 300 {% endif %}
301 } 301 }
302 {% endif %} 302 {% endif %}
303 303
304 {% endif %} 304 {% endif %}
305 {% endblock %} 305 {% endblock %}
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 {% block has_instance %}{% endblock %} 654 {% block has_instance %}{% endblock %}
655 {% block to_impl %}{% endblock %} 655 {% block to_impl %}{% endblock %}
656 {% block to_impl_with_type_check %}{% endblock %} 656 {% block to_impl_with_type_check %}{% endblock %}
657 {##############################################################################} 657 {##############################################################################}
658 {% block prepare_prototype_and_interface_object %}{% endblock %} 658 {% block prepare_prototype_and_interface_object %}{% endblock %}
659 {##############################################################################} 659 {##############################################################################}
660 {% block partial_interface %}{% endblock %} 660 {% block partial_interface %}{% endblock %}
661 } // namespace blink 661 } // namespace blink
662 662
663 {% endfilter %}{# format_blink_cpp_source_code #} 663 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698