| 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 V8TestNode_h | 21 #ifndef V8TestInterfaceImplementedAs_h |
| 22 #define V8TestNode_h | 22 #define V8TestInterfaceImplementedAs_h |
| 23 | 23 |
| 24 #include "bindings/bindings/tests/idls/TestNode.h" | 24 #include "bindings/bindings/tests/idls/RealClass.h" |
| 25 #include "bindings/v8/V8Binding.h" | 25 #include "bindings/v8/V8Binding.h" |
| 26 #include "bindings/v8/V8DOMWrapper.h" | 26 #include "bindings/v8/V8DOMWrapper.h" |
| 27 #include "bindings/v8/WrapperTypeInfo.h" | 27 #include "bindings/v8/WrapperTypeInfo.h" |
| 28 #include "wtf/HashMap.h" | 28 #include "wtf/HashMap.h" |
| 29 #include "wtf/text/StringHash.h" | 29 #include "wtf/text/StringHash.h" |
| 30 #include <v8.h> | 30 #include <v8.h> |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class V8TestNode { | 34 class V8TestInterfaceImplementedAs { |
| 35 public: | 35 public: |
| 36 static const bool hasDependentLifetime = true; | 36 static const bool hasDependentLifetime = false; |
| 37 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); | 37 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); |
| 38 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); | 38 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); |
| 39 static v8::Persistent<v8::FunctionTemplate> GetTemplate(v8::Isolate*, Wrappe
rWorldType); | 39 static v8::Persistent<v8::FunctionTemplate> GetTemplate(v8::Isolate*, Wrappe
rWorldType); |
| 40 static TestNode* toNative(v8::Handle<v8::Object> object) | 40 static RealClass* toNative(v8::Handle<v8::Object> object) |
| 41 { | 41 { |
| 42 return reinterpret_cast<TestNode*>(object->GetAlignedPointerFromInternal
Field(v8DOMWrapperObjectIndex)); | 42 return reinterpret_cast<RealClass*>(object->GetAlignedPointerFromInterna
lField(v8DOMWrapperObjectIndex)); |
| 43 } | 43 } |
| 44 static void derefObject(void*); | 44 static void derefObject(void*); |
| 45 static WrapperTypeInfo info; | 45 static WrapperTypeInfo info; |
| 46 static EventTarget* toEventTarget(v8::Handle<v8::Object>); | |
| 47 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); | |
| 48 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | 46 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; |
| 49 static void installPerContextProperties(v8::Handle<v8::Object>, TestNode*, v
8::Isolate*) { } | 47 static void installPerContextProperties(v8::Handle<v8::Object>, RealClass*,
v8::Isolate*) { } |
| 50 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } | 48 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } |
| 51 private: | 49 private: |
| 52 friend v8::Handle<v8::Object> wrap(TestNode*, v8::Handle<v8::Object> creatio
nContext, v8::Isolate*); | 50 friend v8::Handle<v8::Object> wrap(RealClass*, v8::Handle<v8::Object> creati
onContext, v8::Isolate*); |
| 53 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestNode>, v8::Handle
<v8::Object> creationContext, v8::Isolate*); | 51 static v8::Handle<v8::Object> createWrapper(PassRefPtr<RealClass>, v8::Handl
e<v8::Object> creationContext, v8::Isolate*); |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 template<> | 54 template<> |
| 57 class WrapperTypeTraits<TestNode > { | 55 class WrapperTypeTraits<RealClass > { |
| 58 public: | 56 public: |
| 59 static WrapperTypeInfo* info() { return &V8TestNode::info; } | 57 static WrapperTypeInfo* info() { return &V8TestInterfaceImplementedAs::info;
} |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 | 60 |
| 63 inline v8::Handle<v8::Object> wrap(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) | 61 inline v8::Handle<v8::Object> wrap(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) |
| 64 { | 62 { |
| 65 ASSERT(impl); | 63 ASSERT(impl); |
| 66 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); | 64 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); |
| 67 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { | 65 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { |
| 68 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl); | 66 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl); |
| 69 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 67 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have |
| 70 // the same object de-ref functions, though, so use that as the basis of
the check. | 68 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 71 RELEASE_ASSERT(actualInfo->derefObjectFunction == V8TestNode::info.deref
ObjectFunction); | 69 RELEASE_ASSERT(actualInfo->derefObjectFunction == V8TestInterfaceImpleme
ntedAs::info.derefObjectFunction); |
| 72 } | 70 } |
| 73 return V8TestNode::createWrapper(impl, creationContext, isolate); | 71 return V8TestInterfaceImplementedAs::createWrapper(impl, creationContext, is
olate); |
| 74 } | 72 } |
| 75 | 73 |
| 76 inline v8::Handle<v8::Value> toV8(TestNode* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 74 inline v8::Handle<v8::Value> toV8(RealClass* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) |
| 77 { | 75 { |
| 78 if (UNLIKELY(!impl)) | 76 if (UNLIKELY(!impl)) |
| 79 return v8NullWithCheck(isolate); | 77 return v8NullWithCheck(isolate); |
| 80 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | 78 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); |
| 81 if (!wrapper.IsEmpty()) | 79 if (!wrapper.IsEmpty()) |
| 82 return wrapper; | 80 return wrapper; |
| 83 return wrap(impl, creationContext, isolate); | 81 return wrap(impl, creationContext, isolate); |
| 84 } | 82 } |
| 85 | 83 |
| 86 inline v8::Handle<v8::Value> toV8ForMainWorld(TestNode* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) | 84 inline v8::Handle<v8::Value> toV8ForMainWorld(RealClass* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 87 { | 85 { |
| 88 ASSERT(worldType(isolate) == MainWorld); | 86 ASSERT(worldType(isolate) == MainWorld); |
| 89 if (UNLIKELY(!impl)) | 87 if (UNLIKELY(!impl)) |
| 90 return v8NullWithCheck(isolate); | 88 return v8NullWithCheck(isolate); |
| 91 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 89 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); |
| 92 if (!wrapper.IsEmpty()) | 90 if (!wrapper.IsEmpty()) |
| 93 return wrapper; | 91 return wrapper; |
| 94 return wrap(impl, creationContext, isolate); | 92 return wrap(impl, creationContext, isolate); |
| 95 } | 93 } |
| 96 | 94 |
| 97 template<class HolderContainer, class Wrappable> | 95 template<class HolderContainer, class Wrappable> |
| 98 inline v8::Handle<v8::Value> toV8Fast(TestNode* impl, const HolderContainer& con
tainer, Wrappable* wrappable) | 96 inline v8::Handle<v8::Value> toV8Fast(RealClass* impl, const HolderContainer& co
ntainer, Wrappable* wrappable) |
| 99 { | 97 { |
| 100 if (UNLIKELY(!impl)) | 98 if (UNLIKELY(!impl)) |
| 101 return v8Null(container.GetIsolate()); | 99 return v8Null(container.GetIsolate()); |
| 102 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe
r, wrappable); | 100 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe
r, wrappable); |
| 103 if (!wrapper.IsEmpty()) | 101 if (!wrapper.IsEmpty()) |
| 104 return wrapper; | 102 return wrapper; |
| 105 return wrap(impl, container.Holder(), container.GetIsolate()); | 103 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 106 } | 104 } |
| 107 | 105 |
| 108 template<class HolderContainer, class Wrappable> | 106 template<class HolderContainer, class Wrappable> |
| 109 inline v8::Handle<v8::Value> toV8FastForMainWorld(TestNode* impl, const HolderCo
ntainer& container, Wrappable* wrappable) | 107 inline v8::Handle<v8::Value> toV8FastForMainWorld(RealClass* impl, const HolderC
ontainer& container, Wrappable* wrappable) |
| 110 { | 108 { |
| 111 ASSERT(worldType(container.GetIsolate()) == MainWorld); | 109 ASSERT(worldType(container.GetIsolate()) == MainWorld); |
| 112 if (UNLIKELY(!impl)) | 110 if (UNLIKELY(!impl)) |
| 113 return v8Null(container.GetIsolate()); | 111 return v8Null(container.GetIsolate()); |
| 114 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | 112 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); |
| 115 if (!wrapper.IsEmpty()) | 113 if (!wrapper.IsEmpty()) |
| 116 return wrapper; | 114 return wrapper; |
| 117 return wrap(impl, container.Holder(), container.GetIsolate()); | 115 return wrap(impl, container.Holder(), container.GetIsolate()); |
| 118 } | 116 } |
| 119 | 117 |
| 120 template<class HolderContainer, class Wrappable> | 118 template<class HolderContainer, class Wrappable> |
| 121 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestNode > impl, c
onst HolderContainer& container, Wrappable* wrappable) | 119 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< RealClass > impl,
const HolderContainer& container, Wrappable* wrappable) |
| 122 { | 120 { |
| 123 return toV8FastForMainWorld(impl.get(), container, wrappable); | 121 return toV8FastForMainWorld(impl.get(), container, wrappable); |
| 124 } | 122 } |
| 125 | 123 |
| 126 | 124 |
| 127 template<class HolderContainer, class Wrappable> | 125 template<class HolderContainer, class Wrappable> |
| 128 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestNode > impl, const HolderC
ontainer& container, Wrappable* wrappable) | 126 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< RealClass > impl, const Holder
Container& container, Wrappable* wrappable) |
| 129 { | 127 { |
| 130 return toV8Fast(impl.get(), container, wrappable); | 128 return toV8Fast(impl.get(), container, wrappable); |
| 131 } | 129 } |
| 132 | 130 |
| 133 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestNode > impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 131 inline v8::Handle<v8::Value> toV8(PassRefPtr< RealClass > impl, v8::Handle<v8::O
bject> creationContext, v8::Isolate* isolate) |
| 134 { | 132 { |
| 135 return toV8(impl.get(), creationContext, isolate); | 133 return toV8(impl.get(), creationContext, isolate); |
| 136 } | 134 } |
| 137 | 135 |
| 138 } | 136 } |
| 139 | 137 |
| 140 #endif // V8TestNode_h | 138 #endif // V8TestInterfaceImplementedAs_h |
| OLD | NEW |