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

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

Issue 2022013002: binding: Makes [SaveSameObject] use V8PrivateProperty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 e253d3276a0c63195123c774152b14157c3b361f..d98e229f172c99ecdf23eed954bc0a9575804d1a 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp
@@ -28,9 +28,15 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{% endif %}
{# impl #}
{% if attribute.is_save_same_object %}
- v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "sameobject_{{attribute.name}}");
+ {% set same_object_private_symbol = 'SameObject' + interface_name + attribute.name[0]|capitalize + attribute.name[1:] %}
+ // If you see a compile error that
+ // V8PrivateProperty::get{{same_object_private_symbol}}
+ // is not defined, then you need to register your attribute at
+ // V8_PRIVATE_PROPERTY_FOR_EACH defined in V8PrivateProperty.h as
+ // X(SameObject, {{interface_name}}{{attribute.name[0]|capitalize}}{{attribute.name[1:]}})
+ auto privateSameObject = V8PrivateProperty::getSameObject{{interface_name}}{{attribute.name[0]|capitalize}}{{attribute.name[1:]}}(info.GetIsolate());
{
- v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::current(info.GetIsolate()), holder, propertyName);
+ v8::Local<v8::Value> v8Value = privateSameObject.get(info.GetIsolate()->GetCurrentContext(), holder);
if (!v8Value.IsEmpty()) {
v8SetReturnValue(info, v8Value);
return;
@@ -134,7 +140,7 @@ const v8::FunctionCallbackInfo<v8::Value>& info
{{attribute.v8_set_return_value}};
{% endif %}
{% if attribute.is_save_same_object %}
- V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holder, propertyName, info.GetReturnValue().Get());
+ privateSameObject.set(info.GetIsolate()->GetCurrentContext(), holder, info.GetReturnValue().Get());
{% endif %}
}
{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698