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 #ifndef {{v8_class_name}}_h | 21 #ifndef {{v8_class_name}}_h |
22 #define {{v8_class_name}}_h | 22 #define {{v8_class_name}}_h |
23 | 23 |
24 {% if conditional_string %} | 24 {% if conditional_string %} |
25 #if {{conditional_string}} | 25 #if {{conditional_string}} |
26 {% endif %} | 26 {% endif %} |
27 {% for filename in header_includes %} | 27 {% for filename in header_includes %} |
28 #include "{{filename}}" | 28 #include "{{filename}}" |
29 {% endfor %} | 29 {% endfor %} |
| 30 |
30 namespace WebCore { | 31 namespace WebCore { |
31 | 32 |
32 class {{v8_class_name}} { | 33 class {{v8_class_name}} { |
33 public: | 34 public: |
34 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); | 35 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); |
35 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); | 36 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); |
36 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor
ldType); | 37 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor
ldType); |
37 static {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object) | 38 static {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object) |
38 { | 39 { |
39 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); | 40 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
40 } | 41 } |
41 static void derefObject(void*); | 42 static void derefObject(void*); |
42 static WrapperTypeInfo info; | 43 static WrapperTypeInfo info; |
43 | |
44 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | 44 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; |
45 | |
46 static inline void* toInternalPointer({{cpp_class_name}}* impl) | 45 static inline void* toInternalPointer({{cpp_class_name}}* impl) |
47 { | 46 { |
48 return impl; | 47 return impl; |
49 } | 48 } |
50 | 49 |
51 static inline {{cpp_class_name}}* fromInternalPointer(void* object) | 50 static inline {{cpp_class_name}}* fromInternalPointer(void* object) |
52 { | 51 { |
53 return static_cast<{{cpp_class_name}}*>(object); | 52 return static_cast<{{cpp_class_name}}*>(object); |
54 } | 53 } |
55 | |
56 static void installPerContextProperties(v8::Handle<v8::Object>, {{cpp_class_
name}}*, v8::Isolate*) { } | 54 static void installPerContextProperties(v8::Handle<v8::Object>, {{cpp_class_
name}}*, v8::Isolate*) { } |
57 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } | 55 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } |
58 | |
59 private: | 56 private: |
60 friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Objec
t> creationContext, v8::Isolate*); | 57 friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Objec
t> creationContext, v8::Isolate*); |
61 static v8::Handle<v8::Object> createWrapper(PassRefPtr<{{cpp_class_name}}>,
v8::Handle<v8::Object> creationContext, v8::Isolate*); | 58 static v8::Handle<v8::Object> createWrapper(PassRefPtr<{{cpp_class_name}}>,
v8::Handle<v8::Object> creationContext, v8::Isolate*); |
62 | |
63 }; | 59 }; |
64 | 60 |
65 template<> | 61 template<> |
66 class WrapperTypeTraits<{{cpp_class_name}} > { | 62 class WrapperTypeTraits<{{cpp_class_name}} > { |
67 public: | 63 public: |
68 static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; } | 64 static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; } |
69 }; | 65 }; |
70 | 66 |
| 67 |
71 inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Obje
ct> creationContext, v8::Isolate* isolate) | 68 inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Obje
ct> creationContext, v8::Isolate* isolate) |
72 { | 69 { |
73 ASSERT(impl); | 70 ASSERT(impl); |
74 ASSERT(DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate).IsEmpty())
; | 71 ASSERT(DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate).IsEmpty())
; |
75 return {{v8_class_name}}::createWrapper(impl, creationContext, isolate); | 72 return {{v8_class_name}}::{{ custom_wrap and "wrap" or "createWrapper" }}(im
pl, creationContext, isolate); |
76 } | 73 } |
77 | 74 |
78 inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) | 75 inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) |
79 { | 76 { |
80 if (UNLIKELY(!impl)) | 77 if (UNLIKELY(!impl)) |
81 return v8NullWithCheck(isolate); | 78 return v8NullWithCheck(isolate); |
82 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>(
impl, isolate); | 79 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>(
impl, isolate); |
83 if (!wrapper.IsEmpty()) | 80 if (!wrapper.IsEmpty()) |
84 return wrapper; | 81 return wrapper; |
85 return wrap(impl, creationContext, isolate); | 82 return wrap(impl, creationContext, isolate); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{cpp_class_name}} > impl, con
st CallbackInfo& callbackInfo, Wrappable* wrappable) | 114 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{cpp_class_name}} > impl, con
st CallbackInfo& callbackInfo, Wrappable* wrappable) |
118 { | 115 { |
119 return toV8Fast(impl.get(), callbackInfo, wrappable); | 116 return toV8Fast(impl.get(), callbackInfo, wrappable); |
120 } | 117 } |
121 | 118 |
122 inline v8::Handle<v8::Value> toV8(PassRefPtr< {{cpp_class_name}} > impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 119 inline v8::Handle<v8::Value> toV8(PassRefPtr< {{cpp_class_name}} > impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
123 { | 120 { |
124 return toV8(impl.get(), creationContext, isolate); | 121 return toV8(impl.get(), creationContext, isolate); |
125 } | 122 } |
126 | 123 |
| 124 } |
| 125 {% if conditional_string %} |
127 | 126 |
128 } | |
129 | |
130 {% if conditional_string %} | |
131 #endif // {{conditional_string}} | 127 #endif // {{conditional_string}} |
132 {% endif %} | 128 {% endif %} |
133 | 129 |
134 #endif // {{v8_class_name}}_h | 130 #endif // {{v8_class_name}}_h |
135 | 131 |
OLD | NEW |