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

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

Issue 2794453002: [Bindings] Replace V8HiddenValue in generated code with V8PrivateProperty (Closed)
Patch Set: . Created 3 years, 8 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 {% extends 'interface_base.cpp.tmpl' %} 1 {% extends 'interface_base.cpp.tmpl' %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% block indexed_property_getter %} 4 {% block indexed_property_getter %}
5 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 5 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
6 {% set getter = indexed_property_getter %} 6 {% set getter = indexed_property_getter %}
7 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) { 7 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) {
8 {% if getter.is_raises_exception %} 8 {% if getter.is_raises_exception %}
9 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetter Context, "{{interface_name}}"); 9 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetter Context, "{{interface_name}}");
10 {% endif %} 10 {% endif %}
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 properly supports the incumbent realm. #} 484 properly supports the incumbent realm. #}
485 {% block origin_safe_method_setter %} 485 {% block origin_safe_method_setter %}
486 {% if has_origin_safe_method_setter %} 486 {% if has_origin_safe_method_setter %}
487 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) { 487 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
488 if (!name->IsString()) 488 if (!name->IsString())
489 return; 489 return;
490 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info .Holder(), info.GetIsolate()); 490 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info .Holder(), info.GetIsolate());
491 if (holder.IsEmpty()) 491 if (holder.IsEmpty())
492 return; 492 return;
493 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); 493 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
494 v8::String::Utf8Value attributeName(name); 494 v8::String::Utf8Value attributeName(name);
Yuki 2017/03/31 13:38:29 I'm uneasy with this name... This is a setter cal
peria 2017/04/03 04:58:43 Done.
495 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", *attributeName); 495 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", *attributeName);
496 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) { 496 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
497 return; 497 return;
498 } 498 }
499 499
500 {# The findInstanceInPrototypeChain() call above only returns a non-empty hand le if info.Holder() is an Object. #} 500 {# The findInstanceInPrototypeChain() call above only returns a non-empty hand le if info.Holder() is an Object. #}
501 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::Loc al<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value); 501 V8PrivateProperty::createSymbol(info.GetIsolate(), *attributeName)
Yuki 2017/03/31 13:38:29 Could you add a comment that attributeName must ma
peria 2017/04/03 04:58:43 Done.
502 .set(v8::Local<v8::Object>::Cast(info.Holder()), v8Value);
502 } 503 }
503 {% endif %} 504 {% endif %}
504 {% endblock %} 505 {% endblock %}
505 506
506 {% block origin_safe_method_setter_callback %} 507 {% block origin_safe_method_setter_callback %}
507 {% if has_origin_safe_method_setter %} 508 {% if has_origin_safe_method_setter %}
508 void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Lo cal<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo <void>& info) { 509 void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Lo cal<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo <void>& info) {
509 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, in fo); 510 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, in fo);
510 } 511 }
511 {% endif %} 512 {% endif %}
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 } 924 }
924 925
925 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 926 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
926 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 927 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
927 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 928 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
928 } 929 }
929 930
930 {% endfor %} 931 {% endfor %}
931 {% endif %} 932 {% endif %}
932 {% endblock %} 933 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698