| OLD | NEW |
| 1 /* | 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 {# FIXME: Update license header |
| 21 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 22 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 23 * |
| 4 * Redistribution and use in source and binary forms, with or without | 24 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 25 * modification, are permitted provided that the following conditions are |
| 6 * met: | 26 * met: |
| 7 * | 27 * |
| 8 * * Redistributions of source code must retain the above copyright | 28 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 29 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 30 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 31 * copyright notice, this list of conditions and the following disclaimer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 42 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 45 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 46 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 47 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 49 */ |
| 30 | 50 |
| 31 // This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! | 51 // This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
| 52 #} |
| 32 | 53 |
| 33 #include "config.h" | 54 #include "config.h" |
| 34 {% if conditional_string %} | 55 {% if conditional_string %} |
| 35 #if {{conditional_string}} | 56 #if {{conditional_string}} |
| 36 {% endif %} | 57 {% endif %} |
| 37 #include "{{v8_class_name}}.h" | 58 #include "{{v8_class_name}}.h" |
| 38 | 59 |
| 39 {% for filename in cpp_includes %} | 60 {% for filename in cpp_includes %} |
| 40 #include "{{filename}}" | 61 #include "{{filename}}" |
| 41 {% endfor %} | 62 {% endfor %} |
| 42 namespace WebCore { | 63 namespace WebCore { |
| 43 | 64 |
| 44 {{v8_class_name}}::{{v8_class_name}}(v8::Handle<v8::Object> callback, ScriptExec
utionContext* context) | 65 {{v8_class_name}}::{{v8_class_name}}(v8::Handle<v8::Object> callback, ScriptExec
utionContext* context) |
| 45 : ActiveDOMCallback(context) | 66 : ActiveDOMCallback(context) |
| 46 , m_callback(callback) | 67 , m_callback(callback) |
| 47 , m_world(DOMWrapperWorld::current()) | 68 , m_world(DOMWrapperWorld::current()) |
| 48 { | 69 { |
| 49 } | 70 } |
| 50 | 71 |
| 51 {{v8_class_name}}::~{{v8_class_name}}() | 72 {{v8_class_name}}::~{{v8_class_name}}() |
| 52 { | 73 { |
| 53 } | 74 } |
| 54 | 75 |
| 76 // Functions |
| 77 |
| 55 {% for method in methods %} | 78 {% for method in methods %} |
| 56 {% if not method.custom %} | 79 {% if not method.custom %} |
| 57 {{method.return_cpp_type}} {{v8_class_name}}::{{method.name}}({{method.argument_
declaration}}) | 80 {{method.return_cpp_type}} {{v8_class_name}}::{{method.name}}({{method.argument_
declaration}}) |
| 58 { | 81 { |
| 59 if (!canInvokeCallback()) | 82 if (!canInvokeCallback()) |
| 60 return true; | 83 return true; |
| 61 | 84 |
| 62 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 85 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 63 v8::HandleScope handleScope(isolate); | 86 v8::HandleScope handleScope(isolate); |
| 64 | 87 |
| 65 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
world.get()); | 88 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
world.get()); |
| 66 if (v8Context.IsEmpty()) | 89 if (v8Context.IsEmpty()) |
| 67 return true; | 90 return true; |
| 68 | 91 |
| 69 v8::Context::Scope scope(v8Context); | 92 v8::Context::Scope scope(v8Context); |
| 70 | 93 |
| 71 {% for argument in method.arguments %} | 94 {% for argument in method.arguments %} |
| 72 {{argument.cpp_to_js_conversion | indent(4)}} | 95 {{argument.cpp_to_js_conversion | indent}} |
| 73 if ({{argument.name}}Handle.IsEmpty()) { | 96 if ({{argument.name}}Handle.IsEmpty()) { |
| 74 if (!isScriptControllerTerminating()) | 97 if (!isScriptControllerTerminating()) |
| 75 CRASH(); | 98 CRASH(); |
| 76 return true; | 99 return true; |
| 77 } | 100 } |
| 78 {% endfor %} | 101 {% endfor %} |
| 79 {% if method.arguments | length > 0 %} | 102 |
| 80 v8::Handle<v8::Value> argv[] = { {{method.handles}} }; | 103 {% if method.arguments %} |
| 104 v8::Handle<v8::Value> argv[] = { |
| 105 {{method.handles | indent(8)}} |
| 106 }; |
| 81 {% else %} | 107 {% else %} |
| 82 v8::Handle<v8::Value> *argv = 0; | 108 v8::Handle<v8::Value> *argv = 0; |
| 83 {% endif %} | 109 {% endif %} |
| 84 | 110 |
| 85 bool callbackReturnValue = false; | 111 bool callbackReturnValue = false; |
| 86 return !invokeCallback(m_callback.newLocal(isolate), {{method.arguments | le
ngth}}, argv, callbackReturnValue, scriptExecutionContext()); | 112 return !invokeCallback(m_callback.newLocal(isolate), {{method.arguments | le
ngth}}, argv, callbackReturnValue, scriptExecutionContext()); |
| 87 } | 113 } |
| 88 | 114 |
| 89 {% endif %} | 115 {% endif %} |
| 90 {% endfor %}{# for method in methods #} | 116 {% endfor %} |
| 91 } // namespace WebCore | 117 } // namespace WebCore |
| 92 | 118 |
| 93 {% if conditional_string %} | 119 {% if conditional_string %} |
| 94 #endif // {{conditional_string}} | 120 #endif // {{conditional_string}} |
| 95 {% endif %} | 121 {% endif %} |
| 122 |
| OLD | NEW |