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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2725673002: WIP bindings: Expand usage of NativeValueTraits. (Closed)
Patch Set: Created 3 years, 10 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/methods.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
index 212b495db59cbeded62532ba0ee5dc4ed810f360..8941adc9ead35c67694dddffdb47a4403032a00d 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
@@ -6,19 +6,13 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{% filter format_remove_duplicates([
'ExceptionState exceptionState',
'ScriptState* scriptState = ']) %}
- {% set define_exception_state -%}
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "{{interface_name}}", "{{method.name}}");
- {%- endset %}
{% set function_call = func_call_with_prep_of_args(method, world_suffix) %}
- {% if 'exceptionState' in function_call or
- (method.returns_promise and not method.is_static) %}
- {{define_exception_state}}
{% if method.returns_promise %}
ExceptionToRejectPromiseScope rejectPromiseScope(info, exceptionState);
{% endif %}
- {% endif %}
{% if not method.is_static %}
{% if method.returns_promise %}
@@ -35,13 +29,12 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
// here.
LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(info.Holder()));
{% else %}
- {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
+ {{cpp_class}}* impl = NativeValueTraits<{{cpp_class}}>::nativeValue(info.GetIsolate(), info.Holder(), exceptionState);
{% endif %}{# interface_name == 'Window' and not method.is_cross_origin #}
{% endif %}{# not method.is_static #}
{# Security checks #}
{% if method.is_check_security_for_return_value %}
- {{define_exception_state}}
if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) {
v8SetReturnValueNull(info);
return;

Powered by Google App Engine
This is Rietveld 408576698