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

Unified Diff: Source/bindings/templates/callback.cpp.tmpl

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test fixes and rebased onto Python IDL generator Created 7 years, 4 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/callback.cpp.tmpl
diff --git a/Source/bindings/templates/callback.cpp b/Source/bindings/templates/callback.cpp.tmpl
similarity index 82%
rename from Source/bindings/templates/callback.cpp
rename to Source/bindings/templates/callback.cpp.tmpl
index d1e923f57f05def7083783e7f12319a06fed60be..2d5c8e761ed35b5fe7012837188d985bd92e2e1f 100644
--- a/Source/bindings/templates/callback.cpp
+++ b/Source/bindings/templates/callback.cpp.tmpl
@@ -68,6 +68,15 @@ namespace WebCore {
v8::Context::Scope scope(v8Context);
+{% if method.call_with_this_value %}
+ {{method.this_value_argument.cpp_to_js_conversion | indent(4)}}
haraken 2013/08/05 10:52:41 Can you hard-code the code? v8::Handle<v8::Valu
alancutter (OOO until 2018) 2013/08/06 04:47:13 Done.
+ if ({{method.this_value_argument.name}}Handle.IsEmpty()) {
haraken 2013/08/05 10:52:41 Ditto. if (thisHandle.IsEmpty()) {
+ if (!isScriptControllerTerminating())
+ CRASH();
+ return true;
+ }
+ ASSERT({{method.this_value_argument.name}}Handle->IsObject());
haraken 2013/08/05 10:52:41 ASSERT(thisHandle->IsObject());
+{% endif %}
{% for argument in method.arguments %}
{{argument.cpp_to_js_conversion | indent(4)}}
if ({{argument.name}}Handle.IsEmpty()) {
@@ -83,7 +92,8 @@ namespace WebCore {
{% endif %}
bool callbackReturnValue = false;
- return !invokeCallback(m_callback.newLocal(isolate), {{method.arguments | length}}, argv, callbackReturnValue, scriptExecutionContext());
+{% set this_value_param = 'v8::Handle<v8::Object>::Cast(' + method.this_value_argument.name + 'Handle), ' if method.call_with_this_value else '' %}
haraken 2013/08/05 10:52:41 How about setting call_with_this_value to "v8::Han
alancutter (OOO until 2018) 2013/08/06 04:47:13 I think call_with_this_value is more appropriate a
+ return !invokeCallback(m_callback.newLocal(isolate), {{ this_value_param }}{{method.arguments | length}}, argv, callbackReturnValue, scriptExecutionContext());
}
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698