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 V8TestTypedefs_h 22 #define V8TestTypedefs_h 23 24 #include "bindings/bindings/tests/idls/TestTypedefs.h" 25 #include "bindings/v8/V8Binding.h" 26 #include "bindings/v8/V8DOMWrapper.h" 27 #include "bindings/v8/WrapperTypeInfo.h" 28 29 namespace WebCore { 30 31 class V8TestTypedefs { 32 public: 33 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldType); 34 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); 35 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType); 36 static TestTypedefs* toNative(v8::Handle<v8::Object> object) 37 { 38 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)); 39 } 40 static void derefObject(void*); 41 static WrapperTypeInfo info; 42 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); 43 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; 44 static inline void* toInternalPointer(TestTypedefs* impl) 45 { 46 return impl; 47 } 48 49 static inline TestTypedefs* fromInternalPointer(void* object) 50 { 51 return static_cast<TestTypedefs*>(object); 52 } 53 static void installPerContextProperties(v8::Handle<v8::Object>, TestTypedefs*, v8::Isolate*) { } 54 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { } 55 private: 56 friend v8::Handle<v8::Object> wrap(TestTypedefs*, v8::Handle<v8::Object> creationContext, v8::Isolate*); 57 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestTypedefs>, v8::Handle<v8::Object> creationContext, v8::Isolate*); 58 }; 59 60 template<> 61 class WrapperTypeTraits<TestTypedefs > { 62 public: 63 static WrapperTypeInfo* info() { return &V8TestTypedefs::info; } 64 }; 65 66 67 inline v8::Handle<v8::Object> wrap(TestTypedefs* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 68 { 69 ASSERT(impl); 70 ASSERT(DOMDataStore::getWrapper<V8TestTypedefs>(impl, isolate).IsEmpty()); 71 return V8TestTypedefs::createWrapper(impl, creationContext, isolate); 72 } 73 74 inline v8::Handle<v8::Value> toV8(TestTypedefs* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 75 { 76 if (UNLIKELY(!impl)) 77 return v8NullWithCheck(isolate); 78 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestTypedefs>(impl, isolate); 79 if (!wrapper.IsEmpty()) 80 return wrapper; 81 return wrap(impl, creationContext, isolate); 82 } 83 84 inline v8::Handle<v8::Value> toV8ForMainWorld(TestTypedefs* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 85 { 86 ASSERT(worldType(isolate) == MainWorld); 87 if (UNLIKELY(!impl)) 88 return v8::Null(isolate); 89 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestTypedefs>(impl); 90 if (!wrapper.IsEmpty()) 91 return wrapper; 92 return wrap(impl, creationContext, isolate); 93 } 94 95 template<class CallbackInfo, class Wrappable> 96 inline v8::Handle<v8::Value> toV8Fast(TestTypedefs* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable) 97 { 98 if (UNLIKELY(!impl)) 99 return v8::Null(callbackInfo.GetIsolate()); 100 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestTypedefs>(impl, callbackInfo, wrappable); 101 if (!wrapper.IsEmpty()) 102 return wrapper; 103 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); 104 } 105 106 inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< TestTypedefs > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 107 { 108 return toV8ForMainWorld(impl.get(), creationContext, isolate); 109 } 110 111 112 template<class CallbackInfo, class Wrappable> 113 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestTypedefs > impl, const CallbackInfo& callbackInfo, Wrappable* wrappable) 114 { 115 return toV8Fast(impl.get(), callbackInfo, wrappable); 116 } 117 118 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestTypedefs > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 119 { 120 return toV8(impl.get(), creationContext, isolate); 121 } 122 123 } 124 125 #endif // V8TestTypedefs_h 126