Index: Source/bindings/templates/callback.cpp |
diff --git a/Source/bindings/templates/callback.cpp b/Source/bindings/templates/callback.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..24c10f40b54aead0e1f2215aa57e24cdaa4cb095 |
--- /dev/null |
+++ b/Source/bindings/templates/callback.cpp |
@@ -0,0 +1,87 @@ |
+/* |
+ This file is part of the Blink open source project. |
+ This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
+ |
+ This library is free software; you can redistribute it and/or |
+ modify it under the terms of the GNU Library General Public |
+ License as published by the Free Software Foundation; either |
+ version 2 of the License, or (at your option) any later version. |
+ |
+ This library is distributed in the hope that it will be useful, |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+ Library General Public License for more details. |
+ |
+ You should have received a copy of the GNU Library General Public License |
+ along with this library; see the file COPYING.LIB. If not, write to |
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
+ Boston, MA 02111-1307, USA. |
+*/ |
+ |
+#include "config.h" |
+{% if conditional_string %} |
+#if {{conditional_string}} |
+{% endif %} |
+#include "{{v8_class_name}}.h" |
+ |
+{% for filename in includes %} |
+#include "{{filename}}" |
+{% endfor %} |
+namespace WebCore { |
+ |
+{{v8_class_name}}::{{v8_class_name}}(v8::Handle<v8::Object> callback, ScriptExecutionContext* context) |
+ : ActiveDOMCallback(context) |
+ , m_callback(callback) |
+ , m_world(DOMWrapperWorld::current()) |
+{ |
+} |
+ |
+{{v8_class_name}}::~{{v8_class_name}}() |
+{ |
+} |
+ |
+// Functions |
+ |
+{% for function in functions %} |
+{{function["return_type"]}} {{v8_class_name}}::{{function["name"]}}({{function["parameter_declaration"]}}) |
+{ |
+ if (!canInvokeCallback()) |
+ return true; |
+ |
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
+ v8::HandleScope handleScope(isolate); |
+ |
+ v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_world.get()); |
+ if (v8Context.IsEmpty()) |
+ return true; |
+ |
+ v8::Context::Scope scope(v8Context); |
+ |
+{% for parameter in function["parameters"] %} |
+ {{parameter["native_to_js_value_statement"] | indent(4)}} |
+ if ({{parameter["name"]}}Handle.IsEmpty()) { |
+ if (!isScriptControllerTerminating()) |
+ CRASH(); |
+ return true; |
+ } |
+{% endfor %} |
+ |
+{% if function["parameters"] | length > 0 %} |
+ v8::Handle<v8::Value> argv[] = { |
+ {{function["handles"] | indent(8)}} |
+ }; |
+{% else %} |
+ v8::Handle<v8::Value> *argv = 0; |
+{% endif %} |
+ |
+ bool callbackReturnValue = false; |
+ return !invokeCallback(m_callback.newLocal(isolate), {{function["parameters"]|length}}, argv, callbackReturnValue, scriptExecutionContext()); |
+} |
+ |
+{% endfor %} |
+} // namespace WebCore |
+ |
+{% if conditional_string %} |
+#endif // {{conditional_string}} |
+{% endif %} |
+ |