1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 6 7 #include "config.h" 8 #include "V8TestInterfaceEmpty.h" 9 10 #include "bindings/v8/ExceptionState.h" 11 #include "bindings/v8/V8DOMConfiguration.h" 12 #include "bindings/v8/V8HiddenValue.h" 13 #include "bindings/v8/V8ObjectConstructor.h" 14 #include "core/dom/ContextFeatures.h" 15 #include "core/dom/Document.h" 16 #include "platform/RuntimeEnabledFeatures.h" 17 #include "platform/TraceEvent.h" 18 #include "wtf/GetPtr.h" 19 #include "wtf/RefPtr.h" 20 21 namespace WebCore { 22 23 static void initializeScriptWrappableForInterface(TestInterfaceEmpty* object) 24 { 25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 26 ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceEmpty::wrapperTypeInfo); 27 else 28 ASSERT_NOT_REACHED(); 29 } 30 31 } // namespace WebCore 32 33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceEmpty* object) 34 { 35 WebCore::initializeScriptWrappableForInterface(object); 36 } 37 38 namespace WebCore { 39 const WrapperTypeInfo V8TestInterfaceEmpty::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEmpty::domTemplate, V8TestInterfaceEmpty::derefObject, 0, 0, 0, V8TestInterfaceEmpty::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject }; 40 41 namespace TestInterfaceEmptyV8Internal { 42 43 template <typename T> void V8_USE(T) { } 44 45 } // namespace TestInterfaceEmptyV8Internal 46 47 static void configureV8TestInterfaceEmptyTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) 48 { 49 functionTemplate->ReadOnlyPrototype(); 50 51 v8::Local<v8::Signature> defaultSignature; 52 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceEmpty", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceEmpty::internalFieldCount, 53 0, 0, 54 0, 0, 55 0, 0, 56 isolate); 57 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); 58 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); 59 60 // Custom toString template 61 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); 62 } 63 64 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEmpty::domTemplate(v8::Isolate* isolate) 65 { 66 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterfaceEmptyTemplate); 67 } 68 69 bool V8TestInterfaceEmpty::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 70 { 71 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); 72 } 73 74 v8::Handle<v8::Object> V8TestInterfaceEmpty::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 75 { 76 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); 77 } 78 79 TestInterfaceEmpty* V8TestInterfaceEmpty::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) 80 { 81 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; 82 } 83 84 v8::Handle<v8::Object> wrap(TestInterfaceEmpty* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 85 { 86 ASSERT(impl); 87 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl, isolate)); 88 return V8TestInterfaceEmpty::createWrapper(impl, creationContext, isolate); 89 } 90 91 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterfaceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 92 { 93 ASSERT(impl); 94 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isolate)); 95 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 96 const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo(); 97 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have 98 // the same object de-ref functions, though, so use that as the basis of the check. 99 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 100 } 101 102 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 103 if (UNLIKELY(wrapper.IsEmpty())) 104 return wrapper; 105 106 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 107 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEmpty>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); 108 return wrapper; 109 } 110 111 void V8TestInterfaceEmpty::derefObject(void* object) 112 { 113 fromInternalPointer(object)->deref(); 114 } 115 116 template<> 117 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEmpty* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 118 { 119 return toV8(impl, creationContext, isolate); 120 } 121 122 } // namespace WebCore 123