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 #include "config.h" 22 #include "V8TestInterface.h" 23 24 #if ENABLE(Condition1) || ENABLE(Condition2) 25 26 #include "RuntimeEnabledFeatures.h" 27 #include "V8Binding.h" 28 #include "V8BindingState.h" 29 #include "V8DOMWrapper.h" 30 #include "V8IsolatedContext.h" 31 #include "V8Proxy.h" 32 #include <wtf/UnusedParam.h> 33 34 namespace WebCore { 35 36 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, 0, 0 }; 37 38 namespace TestInterfaceInternal { 39 40 template <typename T> void V8_USE(T) { } 41 42 } // namespace TestInterfaceInternal 43 44 v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) 45 { 46 INC_STATS("DOM.TestInterface.Contructor"); 47 return V8Proxy::constructDOMObjectWithScriptExecutionContext<TestInterface>(args, &info); 48 } 49 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc) 50 { 51 v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 52 0, 0, 53 0, 0); 54 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 55 desc->SetCallHandler(V8TestInterface::constructorCallback); 56 57 58 // Custom toString template 59 desc->Set(getToStringName(), getToStringTemplate()); 60 return desc; 61 } 62 63 v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetRawTemplate() 64 { 65 static v8::Persistent<v8::FunctionTemplate> V8TestInterfaceRawCache = createRawTemplate(); 66 return V8TestInterfaceRawCache; 67 } 68 69 v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate() 70 { 71 static v8::Persistent<v8::FunctionTemplate> V8TestInterfaceCache = ConfigureV8TestInterfaceTemplate(GetRawTemplate()); 72 return V8TestInterfaceCache; 73 } 74 75 bool V8TestInterface::HasInstance(v8::Handle<v8::Value> value) 76 { 77 return GetRawTemplate()->HasInstance(value); 78 } 79 80 81 v8::Handle<v8::Object> V8TestInterface::wrapSlow(TestInterface* impl) 82 { 83 v8::Handle<v8::Object> wrapper; 84 V8Proxy* proxy = 0; 85 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); 86 if (wrapper.IsEmpty()) 87 return wrapper; 88 89 impl->ref(); 90 v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); 91 getDOMObjectMap().set(impl, wrapperHandle); 92 return wrapper; 93 } 94 95 void V8TestInterface::derefObject(void* object) 96 { 97 static_cast<TestInterface*>(object)->deref(); 98 } 99 100 } // namespace WebCore 101 102 #endif // ENABLE(Condition1) || ENABLE(Condition2) 103