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