| OLD | NEW |
| 1 /* | 1 /* |
| 2 This file is part of the Blink open source project. | 2 This file is part of the Blink open source project. |
| 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! | 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
| 4 | 4 |
| 5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
| 6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
| 7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
| 8 version 2 of the License, or (at your option) any later version. | 8 version 2 of the License, or (at your option) any later version. |
| 9 | 9 |
| 10 This library is distributed in the hope that it will be useful, | 10 This library is distributed in the hope that it will be useful, |
| 11 but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 Library General Public License for more details. | 13 Library General Public License for more details. |
| 14 | 14 |
| 15 You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 Boston, MA 02111-1307, USA. | 18 Boston, MA 02111-1307, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 {% from 'attributes.cpp' import attribute_getter, attribute_getter_callback, cla
ss_attributes with context %} |
| 22 {% from 'constants.cpp' import class_constants, install_constants with context %
} |
| 21 #include "config.h" | 23 #include "config.h" |
| 22 {% if conditional_string %} | 24 {% if conditional_string %} |
| 23 #if {{conditional_string}} | 25 #if {{conditional_string}} |
| 24 {% endif %} | 26 {% endif %} |
| 25 #include "{{v8_class_name}}.h" | 27 #include "{{v8_class_name}}.h" |
| 26 | 28 |
| 27 {% for filename in cpp_includes %} | 29 {% for filename in cpp_includes %} |
| 28 #include "{{ filename }}" | 30 #include "{{filename}}" |
| 29 {% endfor %} | 31 {% endfor %} |
| 30 | 32 |
| 31 namespace WebCore { | 33 namespace WebCore { |
| 32 | 34 |
| 33 static void initializeScriptWrappableForInterface({{cpp_class_name}}* object) | 35 static void initializeScriptWrappableForInterface({{cpp_class_name}}* object) |
| 34 { | 36 { |
| 35 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 37 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 36 ScriptWrappable::setTypeInfoInObject(object, &{{v8_class_name}}::info); | 38 ScriptWrappable::setTypeInfoInObject(object, &{{v8_class_name}}::info); |
| 37 else | 39 else |
| 38 ASSERT_NOT_REACHED(); | 40 ASSERT_NOT_REACHED(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 } | 52 } |
| 51 | 53 |
| 52 namespace WebCore { | 54 namespace WebCore { |
| 53 WrapperTypeInfo {{v8_class_name}}::info = { {{v8_class_name}}::GetTemplate, {{v8
_class_name}}::derefObject, 0, 0, 0, {{v8_class_name}}::installPerContextPrototy
peProperties, 0, WrapperTypeObjectPrototype }; | 55 WrapperTypeInfo {{v8_class_name}}::info = { {{v8_class_name}}::GetTemplate, {{v8
_class_name}}::derefObject, 0, 0, 0, {{v8_class_name}}::installPerContextPrototy
peProperties, 0, WrapperTypeObjectPrototype }; |
| 54 | 56 |
| 55 namespace {{cpp_class_name}}V8Internal { | 57 namespace {{cpp_class_name}}V8Internal { |
| 56 | 58 |
| 57 template <typename T> void V8_USE(T) { } | 59 template <typename T> void V8_USE(T) { } |
| 58 | 60 |
| 59 {% for attribute in attributes %} | 61 {% for attribute in attributes %} |
| 60 static void {{attribute.name}}AttributeGetter(v8::Local<v8::String> name, const
v8::PropertyCallbackInfo<v8::Value>& info) | 62 {{attribute_getter(attribute)}} |
| 61 { | 63 {{attribute_getter_callback(attribute)}} |
| 62 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); | |
| 63 {{attribute.cpp_type}} result = imp->{{attribute.cpp_method_name}}(); | |
| 64 if (result.get() && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_t
ype}}>(info.GetReturnValue(), result.get())) | |
| 65 return; | |
| 66 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); | |
| 67 if (!wrapper.IsEmpty()) { | |
| 68 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribut
e.name}}", wrapper); | |
| 69 v8SetReturnValue(info, wrapper); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 static void {{attribute.name}}AttributeGetterCallback(v8::Local<v8::String> name
, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 74 { | |
| 75 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 76 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter(name, info); | |
| 77 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 78 } | |
| 79 | |
| 80 {% endfor %} | 64 {% endfor %} |
| 81 } // namespace {{cpp_class_name}}V8Internal | 65 } // namespace {{cpp_class_name}}V8Internal |
| 82 | 66 |
| 83 {% if attributes %} | 67 {% if attributes %} |
| 84 static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attribu
tes[] = { | 68 {{class_attributes()}} |
| 85 {% for attribute in attributes %} | 69 {% endif %} |
| 86 {"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}Attri
buteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), sta
tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 70 {# FIXME: Move down and merge with install constants #} |
| 87 {% endfor %} | 71 {% if constants %} |
| 88 }; | 72 {{class_constants()}} |
| 89 | |
| 90 {% endif %} | 73 {% endif %} |
| 91 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current
WorldType) | 74 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current
WorldType) |
| 92 { | 75 { |
| 93 desc->ReadOnlyPrototype(); | 76 desc->ReadOnlyPrototype(); |
| 94 | 77 |
| 95 v8::Local<v8::Signature> defaultSignature; | 78 v8::Local<v8::Signature> defaultSignature; |
| 96 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte
rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie
ldCount, | 79 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte
rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie
ldCount, |
| 97 {{attribute_templates}}, {{number_of_attributes}}, | 80 {{attribute_templates}}, {{number_of_attributes}}, |
| 98 0, 0, isolate, currentWorldType); | 81 0, 0, isolate, currentWorldType); |
| 99 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. | 82 UNUSED_PARAM(defaultSignature); |
| 83 {% if constants %}{# In general more checks than just constants #} |
| 84 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 85 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 86 UNUSED_PARAM(instance); |
| 87 UNUSED_PARAM(proto); |
| 88 {% endif %} |
| 89 {% if constants %} |
| 90 {{install_constants()}} |
| 91 {% endif %} |
| 100 | 92 |
| 101 // Custom toString template | 93 // Custom toString template |
| 102 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 94 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 103 return desc; | 95 return desc; |
| 104 } | 96 } |
| 105 | 97 |
| 106 v8::Handle<v8::FunctionTemplate> {{v8_class_name}}::GetTemplate(v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 98 v8::Handle<v8::FunctionTemplate> {{v8_class_name}}::GetTemplate(v8::Isolate* iso
late, WrapperWorldType currentWorldType) |
| 107 { | 99 { |
| 108 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 100 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 109 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void {{v8_class_name}}::derefObject(void* object) | 145 void {{v8_class_name}}::derefObject(void* object) |
| 154 { | 146 { |
| 155 fromInternalPointer(object)->deref(); | 147 fromInternalPointer(object)->deref(); |
| 156 } | 148 } |
| 157 | 149 |
| 158 } // namespace WebCore | 150 } // namespace WebCore |
| 159 {% if conditional_string %} | 151 {% if conditional_string %} |
| 160 | 152 |
| 161 #endif // {{conditional_string}} | 153 #endif // {{conditional_string}} |
| 162 {% endif %} | 154 {% endif %} |
| OLD | NEW |