| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 This file is part of the WebKit open source project. | |
| 3 This file has been generated by generate-bindings.pl. 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 V8TestInterface_h | |
| 22 #define V8TestInterface_h | |
| 23 | |
| 24 #if ENABLE(Condition1) || ENABLE(Condition2) | |
| 25 #include "TestInterface.h" | |
| 26 #include "V8Binding.h" | |
| 27 #include "V8DOMWrapper.h" | |
| 28 #include "WrapperTypeInfo.h" | |
| 29 #include <v8.h> | |
| 30 #include <wtf/HashMap.h> | |
| 31 #include <wtf/text/StringHash.h> | |
| 32 | |
| 33 namespace WebCore { | |
| 34 | |
| 35 class V8TestInterface { | |
| 36 public: | |
| 37 static const bool hasDependentLifetime = true; | |
| 38 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp
e); | |
| 39 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); | |
| 40 static v8::Persistent<v8::FunctionTemplate> GetTemplate(v8::Isolate*, Wrappe
rWorldType); | |
| 41 static TestInterface* toNative(v8::Handle<v8::Object> object) | |
| 42 { | |
| 43 return reinterpret_cast<TestInterface*>(object->GetAlignedPointerFromInt
ernalField(v8DOMWrapperObjectIndex)); | |
| 44 } | |
| 45 static void derefObject(void*); | |
| 46 static WrapperTypeInfo info; | |
| 47 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); | |
| 48 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); | |
| 49 static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::
Local<v8::Value>, const v8::AccessorInfo&); | |
| 50 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | |
| 51 static void installPerContextProperties(v8::Handle<v8::Object>, TestInterfac
e*, v8::Isolate*) { } | |
| 52 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8:
:Isolate*) { } | |
| 53 private: | |
| 54 friend v8::Handle<v8::Object> wrap(TestInterface*, v8::Handle<v8::Object> cr
eationContext, v8::Isolate*); | |
| 55 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterface>, v8::H
andle<v8::Object> creationContext, v8::Isolate*); | |
| 56 }; | |
| 57 | |
| 58 template<> | |
| 59 class WrapperTypeTraits<TestInterface > { | |
| 60 public: | |
| 61 static WrapperTypeInfo* info() { return &V8TestInterface::info; } | |
| 62 }; | |
| 63 | |
| 64 | |
| 65 inline v8::Handle<v8::Object> wrap(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | |
| 66 { | |
| 67 ASSERT(impl); | |
| 68 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); | |
| 69 return V8TestInterface::createWrapper(impl, creationContext, isolate); | |
| 70 } | |
| 71 | |
| 72 inline v8::Handle<v8::Value> toV8(TestInterface* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | |
| 73 { | |
| 74 if (UNLIKELY(!impl)) | |
| 75 return v8NullWithCheck(isolate); | |
| 76 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | |
| 77 if (!wrapper.IsEmpty()) | |
| 78 return wrapper; | |
| 79 return wrap(impl, creationContext, isolate); | |
| 80 } | |
| 81 | |
| 82 inline v8::Handle<v8::Value> toV8ForMainWorld(TestInterface* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | |
| 83 { | |
| 84 ASSERT(worldType(isolate) == MainWorld); | |
| 85 if (UNLIKELY(!impl)) | |
| 86 return v8NullWithCheck(isolate); | |
| 87 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | |
| 88 if (!wrapper.IsEmpty()) | |
| 89 return wrapper; | |
| 90 return wrap(impl, creationContext, isolate); | |
| 91 } | |
| 92 | |
| 93 template<class HolderContainer, class Wrappable> | |
| 94 inline v8::Handle<v8::Value> toV8Fast(TestInterface* impl, const HolderContainer
& container, Wrappable* wrappable) | |
| 95 { | |
| 96 if (UNLIKELY(!impl)) | |
| 97 return v8Null(container.GetIsolate()); | |
| 98 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe
r, wrappable); | |
| 99 if (!wrapper.IsEmpty()) | |
| 100 return wrapper; | |
| 101 return wrap(impl, container.Holder(), container.GetIsolate()); | |
| 102 } | |
| 103 | |
| 104 template<class HolderContainer, class Wrappable> | |
| 105 inline v8::Handle<v8::Value> toV8FastForMainWorld(TestInterface* impl, const Hol
derContainer& container, Wrappable* wrappable) | |
| 106 { | |
| 107 ASSERT(worldType(container.GetIsolate()) == MainWorld); | |
| 108 if (UNLIKELY(!impl)) | |
| 109 return v8Null(container.GetIsolate()); | |
| 110 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); | |
| 111 if (!wrapper.IsEmpty()) | |
| 112 return wrapper; | |
| 113 return wrap(impl, container.Holder(), container.GetIsolate()); | |
| 114 } | |
| 115 | |
| 116 template<class HolderContainer, class Wrappable> | |
| 117 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestInterface > im
pl, const HolderContainer& container, Wrappable* wrappable) | |
| 118 { | |
| 119 return toV8FastForMainWorld(impl.get(), container, wrappable); | |
| 120 } | |
| 121 | |
| 122 | |
| 123 template<class HolderContainer, class Wrappable> | |
| 124 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestInterface > impl, const Ho
lderContainer& container, Wrappable* wrappable) | |
| 125 { | |
| 126 return toV8Fast(impl.get(), container, wrappable); | |
| 127 } | |
| 128 | |
| 129 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestInterface > impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) | |
| 130 { | |
| 131 return toV8(impl.get(), creationContext, isolate); | |
| 132 } | |
| 133 | |
| 134 } | |
| 135 | |
| 136 #endif // V8TestInterface_h | |
| 137 #endif // ENABLE(Condition1) || ENABLE(Condition2) | |
| 138 | |
| OLD | NEW |