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

Unified Diff: Source/bindings/templates/methods.cpp

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed http/tests/serviceworker/fetch\* regression Created 6 years, 2 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: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index 94b70730869b707916dfc76315938738c13565d4..2a2e8dcf200092fdf4becc35683bc5a420612a08 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -378,6 +378,7 @@ static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
case {{length}}:
{# Then resolve by testing argument #}
{% for test, method in tests_methods %}
+ {% if method.visible %}
{% filter runtime_enabled(not overloads.runtime_enabled_function_all and
method.runtime_enabled_function) %}
if ({{test}}) {
@@ -391,10 +392,18 @@ static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
return;
}
{% endfilter %}
+ {% endif %}
{% endfor %}
break;
{% endfor %}
default:
+ {# #}
haraken 2014/10/09 04:24:01 Add a comment.
tasak 2014/10/10 07:52:23 Done.
+ {% if not is_partial and overloads.partial_overloads %}
+ if ({{overloads.name}}MethodForPartialInterface) {
+ ({{overloads.name}}MethodForPartialInterface)(info);
+ return;
+ }
+ {% endif %}
{# Invalid arity, throw error #}
{# Report full list of valid arities if gaps and above minimum #}
{% if overloads.valid_arities %}
@@ -409,6 +418,12 @@ static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
exceptionState.throwIfNeeded();
return;
}
+ {% if not is_partial and overloads.partial_overloads %}
+ if ({{overloads.name}}MethodForPartialInterface) {
+ ({{overloads.name}}MethodForPartialInterface)(info);
+ return;
+ }
+ {% endif %}
{# No match, throw error #}
exceptionState.throwTypeError("No function was found that matched the signature provided.");
exceptionState.throwIfNeeded();
@@ -446,8 +461,12 @@ static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
{% if method.is_custom %}
{{v8_class}}::{{method.name}}MethodCustom(info);
{% else %}
+ {% if is_partial %}
+ {{cpp_class}}PartialV8Internal::{{method.name}}Method{{world_suffix}}(info);
+ {% else %}
{{cpp_class}}V8Internal::{{method.name}}Method{{world_suffix}}(info);
{% endif %}
+ {% endif %}
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
{% endfilter %}
@@ -600,9 +619,9 @@ v8SetReturnValue(info, wrapper);
{##############################################################################}
{% macro method_configuration(method) %}
{% set method_callback =
- '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %}
+ '%s%sV8Internal::%sMethodCallback' % (cpp_class, 'Partial' if is_partial else '', method.name) %}
haraken 2014/10/09 04:24:01 We're creating the namespace name repeatedly in te
tasak 2014/10/10 07:52:23 Done. Added actual_cpp_class and actual_v8_class f
{% set method_callback_for_main_world =
- '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name)
+ '%s%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, 'Partial' if is_parital else '', method.name)
if method.is_per_world_bindings else '0' %}
{% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}}
@@ -611,7 +630,7 @@ v8SetReturnValue(info, wrapper);
{######################################}
{% macro install_custom_signature(method) %}
-{% set method_callback = '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %}
+{% set method_callback = '%s%sV8Internal::%sMethodCallback' % (cpp_class, 'Partial' if is_partial else '', method.name) %}
{% set method_callback_for_main_world = '%sForMainWorld' % method_callback
if method.is_per_world_bindings else '0' %}
{% set property_attribute =

Powered by Google App Engine
This is Rietveld 408576698