OLD | NEW |
(Empty) | |
| 1 /* |
| 2 This file is part of the Blink open source project. |
| 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
| 4 |
| 5 This library is free software; you can redistribute it and/or |
| 6 modify it under the terms of the GNU Library General Public |
| 7 License as published by the Free Software Foundation; either |
| 8 version 2 of the License, or (at your option) any later version. |
| 9 |
| 10 This library is distributed in the hope that it will be useful, |
| 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 Library General Public License for more details. |
| 14 |
| 15 You should have received a copy of the GNU Library General Public License |
| 16 along with this library; see the file COPYING.LIB. If not, write to |
| 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 Boston, MA 02111-1307, USA. |
| 19 */ |
| 20 |
| 21 #include "config.h" |
| 22 {% if conditional_string %} |
| 23 #if {{conditional_string}} |
| 24 {% endif %} |
| 25 #include "{{v8_class_name}}.h" |
| 26 |
| 27 {% for filename in includes %} |
| 28 #include "{{filename}}" |
| 29 {% endfor %} |
| 30 namespace WebCore { |
| 31 |
| 32 {{v8_class_name}}::{{v8_class_name}}(v8::Handle<v8::Object> callback, ScriptExec
utionContext* context) |
| 33 : ActiveDOMCallback(context) |
| 34 , m_callback(callback) |
| 35 , m_world(DOMWrapperWorld::current()) |
| 36 { |
| 37 } |
| 38 |
| 39 {{v8_class_name}}::~{{v8_class_name}}() |
| 40 { |
| 41 } |
| 42 |
| 43 // Functions |
| 44 |
| 45 {% for function in functions %} |
| 46 {{function["return_type"]}} {{v8_class_name}}::{{function["name"]}}({{function["
parameter_declaration"]}}) |
| 47 { |
| 48 if (!canInvokeCallback()) |
| 49 return true; |
| 50 |
| 51 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 52 v8::HandleScope handleScope(isolate); |
| 53 |
| 54 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
world.get()); |
| 55 if (v8Context.IsEmpty()) |
| 56 return true; |
| 57 |
| 58 v8::Context::Scope scope(v8Context); |
| 59 |
| 60 {% for parameter in function["parameters"] %} |
| 61 {{parameter["native_to_js_value_statement"] | indent(4)}} |
| 62 if ({{parameter["name"]}}Handle.IsEmpty()) { |
| 63 if (!isScriptControllerTerminating()) |
| 64 CRASH(); |
| 65 return true; |
| 66 } |
| 67 {% endfor %} |
| 68 |
| 69 {% if function["parameters"] | length > 0 %} |
| 70 v8::Handle<v8::Value> argv[] = { |
| 71 {{function["handles"] | indent(8)}} |
| 72 }; |
| 73 {% else %} |
| 74 v8::Handle<v8::Value> *argv = 0; |
| 75 {% endif %} |
| 76 |
| 77 bool callbackReturnValue = false; |
| 78 return !invokeCallback(m_callback.newLocal(isolate), {{function["parameters"
]|length}}, argv, callbackReturnValue, scriptExecutionContext()); |
| 79 } |
| 80 |
| 81 {% endfor %} |
| 82 } // namespace WebCore |
| 83 |
| 84 {% if conditional_string %} |
| 85 #endif // {{conditional_string}} |
| 86 {% endif %} |
| 87 |
OLD | NEW |