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

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

Issue 2758463002: [Refactoring] Clean up binding template files for callback interfaces (Closed)
Patch Set: . Created 3 years, 9 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 a101ddaba03b4e9cbdb6929da443c09cbb0386da..420c27645fe38231c5e339a861343e7a179be15c 100644
--- a/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
@@ -30,10 +30,12 @@ DEFINE_TRACE({{v8_class}}) {
{{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 %}
@@ -44,15 +46,27 @@ DEFINE_TRACE({{v8_class}}) {
v8::Local<v8::Value> *argv = 0;
{% endif %}
- {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'v8::Undefined(m_scriptState->isolate()), ' %}
+ v8::Isolate* isolate = m_scriptState->isolate();
+ {% set this_handle_parameter = 'thisHandle'
+ if method.call_with_this_handle else 'v8::Undefined(isolate)' %}
{% if method.idl_type == 'boolean' %}
- v8::TryCatch exceptionCatcher(m_scriptState->isolate());
+ v8::TryCatch exceptionCatcher(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());
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ executionContext,
+ {{this_handle_parameter}},
+ {{method.arguments | length}},
+ argv,
+ 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 %}
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ {{this_handle_parameter}},
+ {{method.arguments | length}},
+ argv,
+ isolate);
+ {% endif %}
}
{% endfor %}
« 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