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

Unified Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp

Issue 2008823002: bindings: Supports [SaveSameObject] extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the documentation. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/attributes.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp b/third_party/WebKit/Source/bindings/templates/attributes.cpp
index c5214d31fcee500ff52c725f4458158e5b256f5f..e253d3276a0c63195123c774152b14157c3b361f 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp
@@ -27,9 +27,21 @@ const v8::FunctionCallbackInfo<v8::Value>& info
v8::Local<v8::Object> holder = info.Holder();
{% endif %}
{# impl #}
+ {% if attribute.is_save_same_object %}
+ v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "sameobject_{{attribute.name}}");
+ {
+ v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::current(info.GetIsolate()), holder, propertyName);
+ if (!v8Value.IsEmpty()) {
+ v8SetReturnValue(info, v8Value);
+ return;
+ }
+ }
+ {% endif %}
+ {% if not attribute.is_static %}
+ {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
+ {% endif %}
{% if attribute.cached_attribute_validation_method %}
v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attribute.name}}");
- {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
if (!impl->{{attribute.cached_attribute_validation_method}}()) {
v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::current(info.GetIsolate()), holder, propertyName);
if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) {
@@ -37,8 +49,6 @@ const v8::FunctionCallbackInfo<v8::Value>& info
return;
}
}
- {% elif not attribute.is_static %}
- {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
{% endif %}
{% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
if (!impl->document())
@@ -123,6 +133,9 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% endif %}
{{attribute.v8_set_return_value}};
{% endif %}
+ {% if attribute.is_save_same_object %}
+ V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holder, propertyName, info.GetReturnValue().Get());
+ {% endif %}
}
{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698