Skip to content

Commit

Permalink
Revert of Revert of convert generated bindings to handle symbols (pat…
Browse files Browse the repository at this point in the history
…chset #1 id:1 of https://codereview.chromium.org/799013002/)

Reason for revert:
this patch is very unlikely to have caused that fallure, trying again

Original issue's description:
> Revert of convert generated bindings to handle symbols (patchset #2 id:20001 of https://codereview.chromium.org/797243002/)
> 
> Reason for revert:
> This patchset likely introduced a build failure:
> 
> http://build.chromium.org/p/chromium.webkit/builders/Mac%20Builder%20%28dbg%29/builds/70380
> 
> Original issue's description:
> > convert generated bindings to handle symbols
> > 
> > callbacks taking v8::String will be deprecated soon.  additionally the new api will support removal of the Get/HasRealNamed.... checks.
> > 
> > BUG=
> > 
> > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=187028
> 
> TBR=dcarney@chromium.org
> NOTREECHECKS=true
> NOTRY=true
> BUG=
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=187030

TBR=ellyjones@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/800973002

git-svn-id: svn://svn.chromium.org/blink/trunk@187046 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
dcarney@chromium.org committed Dec 12, 2014
1 parent 1aa4620 commit 9749714
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 130 deletions.
20 changes: 13 additions & 7 deletions Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,28 @@ void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCall
v8SetReturnValue(info, properties);
}

void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::String> v8Name, const v8::PropertyCallbackInfo<v8::Integer>& info)
void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
if (!v8Name->IsString())
return;
// NOTE: cssPropertyInfo lookups incur several mallocs.
// Successful lookups have the same cost the first time, but are cached.
if (cssPropertyInfo(v8Name, info.GetIsolate())) {
if (cssPropertyInfo(v8Name.As<v8::String>(), info.GetIsolate())) {
v8SetReturnValueInt(info, 0);
return;
}
}

void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
// First look for API defined attributes on the style declaration object.
if (info.Holder()->HasRealNamedCallbackProperty(name))
if (info.Holder()->HasRealNamedCallbackProperty(name.As<v8::String>()))
return;

// Search the style declaration.
CSSPropertyInfo* propInfo = cssPropertyInfo(name, info.GetIsolate());
CSSPropertyInfo* propInfo = cssPropertyInfo(name.As<v8::String>(), info.GetIsolate());

// Do not handle non-property names.
if (!propInfo)
Expand All @@ -217,10 +221,12 @@ void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::String> name
v8SetReturnValueString(info, result, info.GetIsolate());
}

void V8CSSStyleDeclaration::namedPropertySetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8CSSStyleDeclaration::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
CSSPropertyInfo* propInfo = cssPropertyInfo(name, info.GetIsolate());
CSSPropertyInfo* propInfo = cssPropertyInfo(name.As<v8::String>(), info.GetIsolate());
if (!propInfo)
return;

Expand Down
36 changes: 24 additions & 12 deletions Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,46 @@ void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> val
}
} // namespace

void V8HTMLAppletElement::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLAppletElement::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
getScriptableObjectProperty<V8HTMLAppletElement>(name, info);
if (!name->IsString())
return;
getScriptableObjectProperty<V8HTMLAppletElement>(name.As<v8::String>(), info);
}

void V8HTMLEmbedElement::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLEmbedElement::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
getScriptableObjectProperty<V8HTMLEmbedElement>(name, info);
if (!name->IsString())
return;
getScriptableObjectProperty<V8HTMLEmbedElement>(name.As<v8::String>(), info);
}

void V8HTMLObjectElement::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLObjectElement::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
getScriptableObjectProperty<V8HTMLObjectElement>(name, info);
if (!name->IsString())
return;
getScriptableObjectProperty<V8HTMLObjectElement>(name.As<v8::String>(), info);
}

void V8HTMLAppletElement::namedPropertySetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLAppletElement::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
setScriptableObjectProperty<V8HTMLAppletElement>(name, value, info);
if (!name->IsString())
return;
setScriptableObjectProperty<V8HTMLAppletElement>(name.As<v8::String>(), value, info);
}

void V8HTMLEmbedElement::namedPropertySetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLEmbedElement::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
setScriptableObjectProperty<V8HTMLEmbedElement>(name, value, info);
if (!name->IsString())
return;
setScriptableObjectProperty<V8HTMLEmbedElement>(name.As<v8::String>(), value, info);
}

void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
setScriptableObjectProperty<V8HTMLObjectElement>(name, value, info);
if (!name->IsString())
return;
setScriptableObjectProperty<V8HTMLObjectElement>(name.As<v8::String>(), value, info);
}

void V8HTMLAppletElement::indexedPropertyGetterCustom(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
Expand Down
10 changes: 7 additions & 3 deletions Source/bindings/core/v8/custom/V8WindowCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,12 @@ void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
v8SetReturnValueFast(info, openedWindow.release(), impl);
}

void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;

auto nameString = name.As<v8::String>();
LocalDOMWindow* window = toLocalDOMWindow(V8Window::toImpl(info.Holder()));
if (!window)
return;
Expand All @@ -328,15 +332,15 @@ void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
return;

// Search sub-frames.
AtomicString propName = toCoreAtomicString(name);
AtomicString propName = toCoreAtomicString(nameString);
Frame* child = frame->tree().scopedChild(propName);
if (child) {
v8SetReturnValueFast(info, child->domWindow(), window);
return;
}

// Search IDL functions defined in the prototype
if (!info.Holder()->GetRealNamedProperty(name).IsEmpty())
if (!info.Holder()->GetRealNamedProperty(nameString).IsEmpty())
return;

// Search named items in the document.
Expand Down
48 changes: 29 additions & 19 deletions Source/bindings/templates/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,22 @@ static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
{% block named_property_getter %}
{% if named_property_getter and not named_property_getter.is_custom %}
{% set getter = named_property_getter %}
static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
auto nameString = name.As<v8::String>();
{% if not is_override_builtins %}
if (info.Holder()->HasRealNamedProperty(name))
if (info.Holder()->HasRealNamedProperty(nameString))
return;
if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty())
return;

{% endif %}
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name);
AtomicString propertyName = toCoreAtomicString(nameString);
{% if getter.is_raises_exception %}
v8::String::Utf8Value namedProperty(name);
v8::String::Utf8Value namedProperty(nameString);
ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
{% endif %}
{% if getter.use_output_parameter_for_result %}
Expand All @@ -190,7 +193,7 @@ static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
{% block named_property_getter_callback %}
{% if named_property_getter %}
{% set getter = named_property_getter %}
static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
{% if getter.is_custom %}
Expand All @@ -209,22 +212,25 @@ static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
{% block named_property_setter %}
{% if named_property_setter and not named_property_setter.is_custom %}
{% set setter = named_property_setter %}
static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
auto nameString = name.As<v8::String>();
{% if not is_override_builtins %}
if (info.Holder()->HasRealNamedProperty(name))
if (info.Holder()->HasRealNamedProperty(nameString))
return;
if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty())
return;

{% endif %}
{% if setter.has_exception_state %}
v8::String::Utf8Value namedProperty(name);
v8::String::Utf8Value namedProperty(nameString);
ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
{% endif %}
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
{# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #}
TOSTRING_VOID(V8StringResource<>, propertyName, name);
{# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #}
TOSTRING_VOID(V8StringResource<>, propertyName, nameString);
{{setter.v8_value_to_local_cpp_value}};
{% set setter_name = setter.name or 'anonymousNamedSetter' %}
{% set setter_arguments =
Expand All @@ -249,7 +255,7 @@ static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
{% block named_property_setter_callback %}
{% if named_property_setter %}
{% set setter = named_property_setter %}
static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
{% if setter.is_custom %}
Expand All @@ -270,10 +276,12 @@ static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
not named_property_getter.is_custom_property_query %}
{# If there is an enumerator, there MUST be a query method to properly
communicate property attributes. #}
static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
if (!name->IsString())
return;
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name);
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
v8::String::Utf8Value namedProperty(name);
ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
bool result = impl->namedPropertyQuery(propertyName, exceptionState);
Expand All @@ -292,7 +300,7 @@ static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
{% block named_property_query_callback %}
{% if named_property_getter and named_property_getter.is_enumerable %}
{% set getter = named_property_getter %}
static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
{% if getter.is_custom_property_query %}
Expand All @@ -311,10 +319,12 @@ static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
{% block named_property_deleter %}
{% if named_property_deleter and not named_property_deleter.is_custom %}
{% set deleter = named_property_deleter %}
static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
if (!name->IsString())
return;
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name);
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
{% if deleter.is_raises_exception %}
v8::String::Utf8Value namedProperty(name);
ExceptionState exceptionState(ExceptionState::DeletionContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
Expand All @@ -339,7 +349,7 @@ static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
{% block named_property_deleter_callback %}
{% if named_property_deleter %}
{% set deleter = named_property_deleter %}
static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
{% if deleter.is_custom %}
Expand Down
8 changes: 4 additions & 4 deletions Source/bindings/templates/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ class {{v8_class}} {
static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&);
{% endif %}
{% if named_property_getter and named_property_getter.is_custom %}
static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&);
static void namedPropertyGetterCustom(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&);
{% endif %}
{% if named_property_setter and named_property_setter.is_custom %}
static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
static void namedPropertySetterCustom(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
{% endif %}
{% if named_property_getter and
named_property_getter.is_custom_property_query %}
static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);
static void namedPropertyQueryCustom(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer>&);
{% endif %}
{% if named_property_deleter and named_property_deleter.is_custom %}
static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&);
static void namedPropertyDeleterCustom(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean>&);
{% endif %}
{% if named_property_getter and
named_property_getter.is_custom_property_enumerator %}
Expand Down
4 changes: 2 additions & 2 deletions Source/bindings/templates/interface_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
{% set indexed_property_enumerator_callback =
'indexedPropertyEnumerator<%s>' % cpp_class
if indexed_property_getter.is_enumerable else '0' %}
functionTemplate->{{set_on_template}}()->SetIndexedPropertyHandler({{indexed_property_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_property_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_enumerator_callback}});
functionTemplate->{{set_on_template}}()->SetHandler(v8::IndexedPropertyHandlerConfiguration({{indexed_property_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_property_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_enumerator_callback}}));
{% endif %}
{% if named_property_getter %}
{# if have named properties, MUST have a named property getter #}
Expand All @@ -376,7 +376,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
{% set named_property_enumerator_callback =
'%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class
if named_property_getter.is_enumerable else '0' %}
functionTemplate->{{set_on_template}}()->SetNamedPropertyHandler({{named_property_getter_callback}}, {{named_property_setter_callback}}, {{named_property_query_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_callback}});
functionTemplate->{{set_on_template}}()->SetHandler(v8::NamedPropertyHandlerConfiguration({{named_property_getter_callback}}, {{named_property_setter_callback}}, {{named_property_query_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_callback}}));
{% endif %}
{% if iterator_method %}
static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
Expand Down
Loading

0 comments on commit 9749714

Please sign in to comment.