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

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

Issue 2454133002: [Bindings] Reformat template files for Interface (1/4) (Closed)
Patch Set: Rebase Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
index 484be8b8f3e199ec4bd7dba5f73ba84a4575b0b8..f2c6416de79f6eeb72935d70e732b61436434285 100644
--- a/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
@@ -11,58 +11,53 @@ namespace blink {
{{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* scriptState)
: ActiveDOMCallback(scriptState->getExecutionContext())
- , m_scriptState(scriptState)
-{
- m_callback.set(scriptState->isolate(), callback);
+ , m_scriptState(scriptState) {
+ m_callback.set(scriptState->isolate(), callback);
}
-{{v8_class}}::~{{v8_class}}()
-{
-}
+{{v8_class}}::~{{v8_class}}() {}
-DEFINE_TRACE({{v8_class}})
-{
- {{cpp_class}}::trace(visitor);
- ActiveDOMCallback::trace(visitor);
+DEFINE_TRACE({{v8_class}}) {
+ {{cpp_class}}::trace(visitor);
+ ActiveDOMCallback::trace(visitor);
}
{% for method in methods if not method.is_custom %}
-{{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}})
-{
- {% set return_default = 'return true'
- if method.idl_type == 'boolean' else 'return' %}{# void #}
- if (!canInvokeCallback())
- {{return_default}};
-
- if (!m_scriptState->contextIsValid())
- {{return_default}};
-
- ScriptState::Scope scope(m_scriptState.get());
- {% if method.call_with_this_handle %}
- v8::Local<v8::Value> thisHandle = thisValue.v8Value();
- {% endif %}
- {% for argument in method.arguments %}
- v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}};
- {% endfor %}
- {% if method.arguments %}
- v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
- {% else %}
- {# Empty array initializers are illegal, and don\'t compile in MSVC. #}
- v8::Local<v8::Value> *argv = 0;
- {% endif %}
-
- {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'v8::Undefined(m_scriptState->isolate()), ' %}
- {% if method.idl_type == 'boolean' %}
- v8::TryCatch exceptionCatcher(m_scriptState->isolate());
- exceptionCatcher.SetVerbose(true);
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
- return !exceptionCatcher.HasCaught();
- {% else %}{# void #}
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
+{{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) {
+ {% set return_default = 'return true'
+ if method.idl_type == 'boolean' else 'return' %}{# void #}
+ if (!canInvokeCallback())
+ {{return_default}};
+
+ if (!m_scriptState->contextIsValid())
+ {{return_default}};
+
+ ScriptState::Scope scope(m_scriptState.get());
+ {% if method.call_with_this_handle %}
+ v8::Local<v8::Value> thisHandle = thisValue.v8Value();
+ {% endif %}
+ {% for argument in method.arguments %}
+ v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}};
+ {% endfor %}
+ {% if method.arguments %}
+ v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
+ {% else %}
+ {# Empty array initializers are illegal, and don\'t compile in MSVC. #}
+ v8::Local<v8::Value> *argv = 0;
+ {% endif %}
+
+ {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'v8::Undefined(m_scriptState->isolate()), ' %}
+ {% if method.idl_type == 'boolean' %}
+ v8::TryCatch exceptionCatcher(m_scriptState->isolate());
+ exceptionCatcher.SetVerbose(true);
+ V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
+ return !exceptionCatcher.HasCaught();
+ {% else %}{# void #}
+ V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
{% endif %}
}
{% endfor %}
-} // namespace blink
+} // namespace blink
{% endfilter %}{# format_blink_cpp_source_code #}
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698