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 V8TestObj_h 22 #define V8TestObj_h 23 24 #include "TestObj.h" 25 #include "V8DOMWrapper.h" 26 #include "WrapperTypeInfo.h" 27 #include <wtf/text/StringHash.h> 28 #include <v8.h> 29 #include <wtf/HashMap.h> 30 31 namespace WebCore { 32 33 class V8TestObj { 34 35 public: 36 static bool HasInstance(v8::Handle<v8::Value> value); 37 static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); 38 static v8::Persistent<v8::FunctionTemplate> GetTemplate(); 39 static TestObj* toNative(v8::Handle<v8::Object> object) 40 { 41 return reinterpret_cast<TestObj*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); 42 } 43 inline static v8::Handle<v8::Object> wrap(TestObj*); 44 static void derefObject(void*); 45 static WrapperTypeInfo info; 46 static v8::Handle<v8::Value> customMethodCallback(const v8::Arguments&); 47 static v8::Handle<v8::Value> customMethodWithArgsCallback(const v8::Arguments&); 48 static v8::Handle<v8::Value> customAttrAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info); 49 static void customAttrAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info); 50 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; 51 private: 52 static v8::Handle<v8::Object> wrapSlow(TestObj*); 53 }; 54 55 56 v8::Handle<v8::Object> V8TestObj::wrap(TestObj* impl) 57 { 58 v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); 59 if (!wrapper.IsEmpty()) 60 return wrapper; 61 return V8TestObj::wrapSlow(impl); 62 } 63 64 inline v8::Handle<v8::Value> toV8(TestObj* impl) 65 { 66 if (!impl) 67 return v8::Null(); 68 return V8TestObj::wrap(impl); 69 } 70 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestObj > impl) 71 { 72 return toV8(impl.get()); 73 } 74 } 75 76 #endif // V8TestObj_h 77