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 #ifndef {{v8_class_name}}_h |
| 22 #define {{v8_class_name}}_h |
| 23 |
| 24 {% if conditional_string %} |
| 25 #if {{conditional_string}} |
| 26 {% endif %} |
| 27 {% for filename in header_includes %} |
| 28 #include "{{filename}}" |
| 29 {% endfor %} |
| 30 |
| 31 namespace WebCore { |
| 32 |
| 33 {% if svg_property_type %} |
| 34 template<typename PropertyType> class SVGPropertyTearOff; |
| 35 |
| 36 {% endif %} |
| 37 {% if svg_native_type %} |
| 38 {% if svg_native_type_contains_svg_static_list_property_tear_off %} |
| 39 template<typename PropertyType> class SVGStaticListPropertyTearOff; |
| 40 |
| 41 {% else %} |
| 42 template<typename PropertyType> class SVGListPropertyTearOff; |
| 43 |
| 44 {% endif %} |
| 45 {% endif %} |
| 46 {%- if is_constructor_template_of_event %} |
| 47 class Dictionary; |
| 48 {% endif %} |
| 49 {% for definition in namespace_WebCore_definitions %} |
| 50 {{definition | indent}} |
| 51 {% endfor %} |
| 52 {% if has_named_constructor %} |
| 53 class {{v8_class_name}}Constructor { |
| 54 public: |
| 55 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor
ldType); |
| 56 static WrapperTypeInfo info; |
| 57 }; |
| 58 |
| 59 {% endif %} |
| 60 class {{v8_class_name}} { |
| 61 public: |
| 62 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); |
| 63 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); |
| 64 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor
ldType); |
| 65 static {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object) |
| 66 { |
| 67 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
| 68 } |
| 69 static void derefObject(void*); |
| 70 static WrapperTypeInfo info; |
| 71 {% if needs_opaque_root_for_gc %} |
| 72 static void* opaqueRootForGC(void*, v8::Isolate*); |
| 73 {% endif %} |
| 74 {% if inherits_extended_attribute_active_dom_object %} |
| 75 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); |
| 76 {% endif %} |
| 77 {% if inherits_event_target %} |
| 78 static EventTarget* toEventTarget(v8::Handle<v8::Object>); |
| 79 {% endif %} |
| 80 {% if interface_name == "Window" %} |
| 81 static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); |
| 82 {% endif %} |
| 83 {% for definition in operation_definitions %} |
| 84 {{definition | indent}} |
| 85 {% endfor %} |
| 86 {% if is_constructable %} |
| 87 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 88 {% endif %} |
| 89 {% if has_custom_constructor %} |
| 90 static void constructorCustom(const v8::FunctionCallbackInfo<v8::Value>&); |
| 91 {% endif %} |
| 92 {% for definition in attribute_definitions %} |
| 93 {{definition | indent}} |
| 94 {% endfor %} |
| 95 {# indexed/named accessors #} |
| 96 {% if has_custom_indexed_getter %} |
| 97 static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallback
Info<v8::Value>&); |
| 98 {% endif %} |
| 99 {% if has_custom_indexed_setter %} |
| 100 static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, cons
t v8::PropertyCallbackInfo<v8::Value>&); |
| 101 {% endif %} |
| 102 {% if has_custom_indexed_deleter %} |
| 103 static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbac
kInfo<v8::Boolean>&); |
| 104 {% endif %} |
| 105 {% if has_custom_named_getter %} |
| 106 static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::Prope
rtyCallbackInfo<v8::Value>&); |
| 107 {% endif %} |
| 108 {% if has_custom_named_setter %} |
| 109 static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::V
alue>, const v8::PropertyCallbackInfo<v8::Value>&); |
| 110 {% endif %} |
| 111 {% if has_custom_named_deleter %} |
| 112 static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::Prop
ertyCallbackInfo<v8::Boolean>&); |
| 113 {% endif %} |
| 114 {% if has_custom_named_enumerator %} |
| 115 static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8:
:Array>&); |
| 116 static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Integer>&); |
| 117 {% endif %} |
| 118 {% if custom_legacy_call %} |
| 119 static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&); |
| 120 {% endif %} |
| 121 {% for definition in custom_internal_field_indices %} |
| 122 {{definition | indent}} |
| 123 {% endfor %} |
| 124 {%- for internal_field in internal_fields %} |
| 125 static const int {{internal_field}} = v8DefaultWrapperInternalFieldCount + {
{loop.index0}}; |
| 126 {% endfor %} |
| 127 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + {
{internal_fields|length}}; |
| 128 static inline void* toInternalPointer({{cpp_class_name}}* impl) |
| 129 { |
| 130 return {{to_wrapped_type}}; |
| 131 } |
| 132 |
| 133 static inline {{cpp_class_name}}* fromInternalPointer(void* object) |
| 134 { |
| 135 return {{from_wrapped_type}}; |
| 136 } |
| 137 {% if interface_name == "Window" %} |
| 138 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v
8::Value> key, v8::AccessType, v8::Local<v8::Value> data); |
| 139 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t
index, v8::AccessType, v8::Local<v8::Value> data); |
| 140 {% endif %} |
| 141 static void installPerContextProperties(v8::Handle<v8::Object>, {{cpp_class_
name}}*, v8::Isolate*){{install_per_context_properties_body}} |
| 142 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*){{install_per_context_prototype_properties_body}} |
| 143 {# FIXME: Remove special hacks #} |
| 144 {% if interface_name == "HTMLElement" %} |
| 145 friend v8::Handle<v8::Object> createV8HTMLWrapper(HTMLElement*, v8::Handle<v
8::Object> creationContext, v8::Isolate*); |
| 146 friend v8::Handle<v8::Object> createV8HTMLDirectWrapper(HTMLElement*, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate*); |
| 147 {% elif interface_name == "SVGElement" %} |
| 148 friend v8::Handle<v8::Object> createV8SVGWrapper(SVGElement*, v8::Handle<v8:
:Object> creationContext, v8::Isolate*); |
| 149 friend v8::Handle<v8::Object> createV8SVGDirectWrapper(SVGElement*, v8::Hand
le<v8::Object> creationContext, v8::Isolate*); |
| 150 friend v8::Handle<v8::Object> createV8SVGFallbackWrapper(SVGElement*, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate*); |
| 151 {% elif interface_name == "HTMLUnknownElement" %} |
| 152 friend v8::Handle<v8::Object> createV8HTMLFallbackWrapper(HTMLUnknownElement
*, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| 153 {% elif interface_name == "Element" %} |
| 154 // This is a performance optimization hack. See V8Element::wrap. |
| 155 friend v8::Handle<v8::Object> wrap(Node*, v8::Handle<v8::Object> creationCon
text, v8::Isolate*); |
| 156 {% endif %} |
| 157 private: |
| 158 {% if wrap %} |
| 159 friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Objec
t> creationContext, v8::Isolate*); |
| 160 static v8::Handle<v8::Object> createWrapper({{cpp_class_name_as_parameter}},
v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| 161 {% endif %} |
| 162 }; |
| 163 |
| 164 template<> |
| 165 class WrapperTypeTraits<{{cpp_class_name}} > { |
| 166 public: |
| 167 static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; } |
| 168 }; |
| 169 |
| 170 {% if generate_to_v8 %} |
| 171 class {{cpp_class_name}}; |
| 172 v8::Handle<v8::Value> toV8({{cpp_class_name}}*, v8::Handle<v8::Object> creationC
ontext, v8::Isolate*); |
| 173 v8::Handle<v8::Value> toV8ForMainWorld({{cpp_class_name}}*, v8::Handle<v8::Objec
t> creationContext, v8::Isolate*); |
| 174 |
| 175 template<class CallbackInfo, class Wrappable> |
| 176 inline v8::Handle<v8::Value> toV8Fast({{cpp_class_name}}* impl, const CallbackIn
fo& callbackInfo, Wrappable*) |
| 177 { |
| 178 return toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); |
| 179 } |
| 180 |
| 181 {% endif %} |
| 182 {% if wrap %} |
| 183 |
| 184 {% if custom_wrap %} |
| 185 v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate*); |
| 186 {% else %} |
| 187 inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Obje
ct> creationContext, v8::Isolate* isolate) |
| 188 { |
| 189 ASSERT(impl); |
| 190 ASSERT(DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate).IsEmpty())
; |
| 191 return {{v8_class_name}}::{{ custom_wrap and "wrap" or "createWrapper" }}(im
pl, creationContext, isolate); |
| 192 } |
| 193 {% endif %} |
| 194 |
| 195 {% endif %} |
| 196 {% if wrap %} |
| 197 inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) |
| 198 { |
| 199 if (UNLIKELY(!impl)) |
| 200 return v8NullWithCheck(isolate); |
| 201 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>(
impl, isolate); |
| 202 if (!wrapper.IsEmpty()) |
| 203 return wrapper; |
| 204 return wrap(impl, creationContext, isolate); |
| 205 } |
| 206 |
| 207 inline v8::Handle<v8::Value> toV8ForMainWorld({{cpp_class_name}}* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 208 { |
| 209 ASSERT(worldType(isolate) == MainWorld); |
| 210 if (UNLIKELY(!impl)) |
| 211 return v8::Null(isolate); |
| 212 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<{{v8_cl
ass_name}}>(impl); |
| 213 if (!wrapper.IsEmpty()) |
| 214 return wrapper; |
| 215 return wrap(impl, creationContext, isolate); |
| 216 } |
| 217 |
| 218 template<class CallbackInfo, class Wrappable> |
| 219 inline v8::Handle<v8::Value> toV8Fast({{cpp_class_name}}* impl, const CallbackIn
fo& callbackInfo, Wrappable* wrappable) |
| 220 { |
| 221 if (UNLIKELY(!impl)) |
| 222 return v8::Null(callbackInfo.GetIsolate()); |
| 223 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<{{v8_class_nam
e}}>(impl, callbackInfo, wrappable); |
| 224 if (!wrapper.IsEmpty()) |
| 225 return wrapper; |
| 226 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); |
| 227 } |
| 228 |
| 229 inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< {{cpp_class_name}} > i
mpl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 230 { |
| 231 return toV8ForMainWorld(impl.get(), creationContext, isolate); |
| 232 } |
| 233 |
| 234 {% endif %} |
| 235 |
| 236 template<class CallbackInfo, class Wrappable> |
| 237 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{cpp_class_name}} > impl, con
st CallbackInfo& callbackInfo, Wrappable* wrappable) |
| 238 { |
| 239 return toV8Fast(impl.get(), callbackInfo, wrappable); |
| 240 } |
| 241 |
| 242 inline v8::Handle<v8::Value> toV8(PassRefPtr< {{cpp_class_name}} > impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 243 { |
| 244 return toV8(impl.get(), creationContext, isolate); |
| 245 } |
| 246 |
| 247 {% if is_constructor_template_of_event %} |
| 248 bool fill{{cpp_class_name}}Init({{cpp_class_name}}Init&, const Dictionary&); |
| 249 |
| 250 {% endif %} |
| 251 } |
| 252 {% if conditional_string %} |
| 253 |
| 254 #endif // {{conditional_string}} |
| 255 {% endif %} |
| 256 |
| 257 #endif // {{v8_class_name}}_h |
| 258 |
OLD | NEW |