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 namespace WebCore { | |
31 | |
32 class {{v8_class_name}} { | |
33 public: | |
34 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); | |
35 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); | |
36 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor
ldType); | |
37 static {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object) | |
38 { | |
39 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); | |
40 } | |
41 static void derefObject(void*); | |
42 static WrapperTypeInfo info; | |
43 | |
44 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | |
45 | |
46 static inline void* toInternalPointer({{cpp_class_name}}* impl) | |
47 { | |
48 return impl; | |
49 } | |
50 | |
51 static inline {{cpp_class_name}}* fromInternalPointer(void* object) | |
52 { | |
53 return static_cast<{{cpp_class_name}}*>(object); | |
54 } | |
55 | |
56 static void installPerContextProperties(v8::Handle<v8::Object>, {{cpp_class_
name}}*, v8::Isolate*) { } | |
57 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } | |
58 | |
59 private: | |
60 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*); | |
62 | |
63 }; | |
64 | |
65 template<> | |
66 class WrapperTypeTraits<{{cpp_class_name}} > { | |
67 public: | |
68 static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; } | |
69 }; | |
70 | |
71 inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Obje
ct> creationContext, v8::Isolate* isolate) | |
72 { | |
73 ASSERT(impl); | |
74 ASSERT(DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate).IsEmpty())
; | |
75 return {{v8_class_name}}::createWrapper(impl, creationContext, isolate); | |
76 } | |
77 | |
78 inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) | |
79 { | |
80 if (UNLIKELY(!impl)) | |
81 return v8NullWithCheck(isolate); | |
82 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>(
impl, isolate); | |
83 if (!wrapper.IsEmpty()) | |
84 return wrapper; | |
85 return wrap(impl, creationContext, isolate); | |
86 } | |
87 | |
88 inline v8::Handle<v8::Value> toV8ForMainWorld({{cpp_class_name}}* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | |
89 { | |
90 ASSERT(worldType(isolate) == MainWorld); | |
91 if (UNLIKELY(!impl)) | |
92 return v8::Null(isolate); | |
93 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<{{v8_cl
ass_name}}>(impl); | |
94 if (!wrapper.IsEmpty()) | |
95 return wrapper; | |
96 return wrap(impl, creationContext, isolate); | |
97 } | |
98 | |
99 template<class CallbackInfo, class Wrappable> | |
100 inline v8::Handle<v8::Value> toV8Fast({{cpp_class_name}}* impl, const CallbackIn
fo& callbackInfo, Wrappable* wrappable) | |
101 { | |
102 if (UNLIKELY(!impl)) | |
103 return v8::Null(callbackInfo.GetIsolate()); | |
104 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<{{v8_class_nam
e}}>(impl, callbackInfo, wrappable); | |
105 if (!wrapper.IsEmpty()) | |
106 return wrapper; | |
107 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); | |
108 } | |
109 | |
110 inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< {{cpp_class_name}} > i
mpl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | |
111 { | |
112 return toV8ForMainWorld(impl.get(), creationContext, isolate); | |
113 } | |
114 | |
115 | |
116 template<class CallbackInfo, class Wrappable> | |
117 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{cpp_class_name}} > impl, con
st CallbackInfo& callbackInfo, Wrappable* wrappable) | |
118 { | |
119 return toV8Fast(impl.get(), callbackInfo, wrappable); | |
120 } | |
121 | |
122 inline v8::Handle<v8::Value> toV8(PassRefPtr< {{cpp_class_name}} > impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | |
123 { | |
124 return toV8(impl.get(), creationContext, isolate); | |
125 } | |
126 | |
127 | |
128 } | |
129 | |
130 {% if conditional_string %} | |
131 #endif // {{conditional_string}} | |
132 {% endif %} | |
133 | |
134 #endif // {{v8_class_name}}_h | |
135 | |
OLD | NEW |