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

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

Issue 1153613007: bindings: Use CreateDataProperty() instead of ForceSet() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "config.h" 2 #include "config.h"
3 {% filter conditional(conditional_string) %} 3 {% filter conditional(conditional_string) %}
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 30 matching lines...) Expand all
41 {# Constants #} 41 {# Constants #}
42 {% from 'constants.cpp' import constant_getter_callback 42 {% from 'constants.cpp' import constant_getter_callback
43 with context %} 43 with context %}
44 {% for constant in special_getter_constants %} 44 {% for constant in special_getter_constants %}
45 {{constant_getter_callback(constant)}} 45 {{constant_getter_callback(constant)}}
46 {% endfor %} 46 {% endfor %}
47 {# Attributes #} 47 {# Attributes #}
48 {% block replaceable_attribute_setter_and_callback %} 48 {% block replaceable_attribute_setter_and_callback %}
49 {% if has_replaceable_attributes or has_constructor_attributes %} 49 {% if has_replaceable_attributes or has_constructor_attributes %}
50 template<class CallbackInfo> 50 template<class CallbackInfo>
51 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::Name> name, v8::L ocal<v8::Value> v8Value, const CallbackInfo& info) 51 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::Name> name, v8::L ocal<v8::Value> v8Value, const CallbackInfo& info)
jsbell 2015/05/29 16:57:21 Don't forget to rename this function.
bashi 2015/06/02 00:12:53 Sure. Will rename it.
52 { 52 {
53 {% if is_check_security %} 53 {% if is_check_security %}
54 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 54 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
55 v8::String::Utf8Value attributeName(name); 55 v8::String::Utf8Value attributeName(name);
56 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 56 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
57 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { 57 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
58 exceptionState.throwIfNeeded(); 58 exceptionState.throwIfNeeded();
59 return; 59 return;
60 } 60 }
61 {% endif %} 61 {% endif %}
62 ASSERT(info.This()->IsObject()); 62 ASSERT(info.This()->IsObject());
63 // TODO(bashi): Consider using CreateDataProperty() instead of ForceSet().
63 v8::Local<v8::Object>::Cast(info.This())->ForceSet(info.GetIsolate()->GetCur rentContext(), name, v8Value); 64 v8::Local<v8::Object>::Cast(info.This())->ForceSet(info.GetIsolate()->GetCur rentContext(), name, v8Value);
64 } 65 }
65 66
66 {% if has_constructor_attributes %} 67 {% if has_constructor_attributes %}
67 static void {{cpp_class}}ConstructorAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 68 static void {{cpp_class}}ConstructorAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
68 { 69 {
69 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); 70 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
70 do { 71 do {
71 v8::Local<v8::Value> data = info.Data(); 72 v8::Local<v8::Value> data = info.Data();
72 ASSERT(data->IsExternal()); 73 ASSERT(data->IsExternal());
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 {% endfor %} 495 {% endfor %}
495 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 496 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
496 {{attribute_getter_implemented_in_private_script(attribute)}} 497 {{attribute_getter_implemented_in_private_script(attribute)}}
497 {% if attribute.has_setter %} 498 {% if attribute.has_setter %}
498 {{attribute_setter_implemented_in_private_script(attribute)}} 499 {{attribute_setter_implemented_in_private_script(attribute)}}
499 {% endif %} 500 {% endif %}
500 {% endfor %} 501 {% endfor %}
501 {% block partial_interface %}{% endblock %} 502 {% block partial_interface %}{% endblock %}
502 } // namespace blink 503 } // namespace blink
503 {% endfilter %} 504 {% endfilter %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698