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 "V8SVGTestInterface.h" 9 10 #include "bindings/core/v8/ExceptionState.h" 11 #include "bindings/core/v8/V8DOMConfiguration.h" 12 #include "bindings/core/v8/V8HiddenValue.h" 13 #include "bindings/core/v8/V8ObjectConstructor.h" 14 #include "core/SVGNames.h" 15 #include "core/dom/ContextFeatures.h" 16 #include "core/dom/Document.h" 17 #include "core/dom/custom/CustomElementProcessingStack.h" 18 #include "platform/RuntimeEnabledFeatures.h" 19 #include "platform/TraceEvent.h" 20 #include "wtf/GetPtr.h" 21 #include "wtf/RefPtr.h" 22 23 namespace blink { 24 25 const WrapperTypeInfo V8SVGTestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8SVGTestInterface::domTemplate, V8SVGTestInterface::refObject, V8SVGTestInterface::derefObject, V8SVGTestInterface::createPersistentHandle, 0, 0, 0, V8SVGTestInterface::installConditionallyEnabledMethods, V8SVGTestInterface::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject }; 26 27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in SVGTestInterface.h. 28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 29 // bindings/core/v8/ScriptWrappable.h. 30 const WrapperTypeInfo& SVGTestInterface::s_wrapperTypeInfo = V8SVGTestInterface::wrapperTypeInfo; 31 32 namespace SVGTestInterfaceV8Internal { 33 34 template <typename T> void V8_USE(T) { } 35 36 static void typeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 37 { 38 v8::Handle<v8::Object> holder = info.Holder(); 39 SVGTestInterface* impl = V8SVGTestInterface::toImpl(holder); 40 v8SetReturnValueString(info, impl->fastGetAttribute(SVGNames::typeAttr), info.GetIsolate()); 41 } 42 43 static void typeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 44 { 45 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 46 SVGTestInterfaceV8Internal::typeAttributeGetter(info); 47 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 48 } 49 50 static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 51 { 52 v8::Handle<v8::Object> holder = info.Holder(); 53 SVGTestInterface* impl = V8SVGTestInterface::toImpl(holder); 54 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); 55 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 56 impl->setAttribute(SVGNames::typeAttr, cppValue); 57 } 58 59 static void typeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 60 { 61 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); 62 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 63 SVGTestInterfaceV8Internal::typeAttributeSetter(v8Value, info); 64 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 65 } 66 67 } // namespace SVGTestInterfaceV8Internal 68 69 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttributes[] = { 70 {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInterfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, 71 }; 72 73 static void installV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) 74 { 75 functionTemplate->ReadOnlyPrototype(); 76 77 v8::Local<v8::Signature> defaultSignature; 78 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::internalFieldCount, 79 V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttributes), 80 0, 0, 81 0, 0, 82 isolate); 83 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); 84 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); 85 86 // Custom toString template 87 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); 88 } 89 90 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* isolate) 91 { 92 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8SVGTestInterfaceTemplate); 93 } 94 95 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 96 { 97 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); 98 } 99 100 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 101 { 102 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); 103 } 104 105 SVGTestInterface* V8SVGTestInterface::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) 106 { 107 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<SVGTestInterface>() : 0; 108 } 109 110 111 void V8SVGTestInterface::refObject(ScriptWrappableBase* internalPointer) 112 { 113 internalPointer->toImpl<SVGTestInterface>()->ref(); 114 } 115 116 void V8SVGTestInterface::derefObject(ScriptWrappableBase* internalPointer) 117 { 118 internalPointer->toImpl<SVGTestInterface>()->deref(); 119 } 120 121 WrapperPersistentNode* V8SVGTestInterface::createPersistentHandle(ScriptWrappableBase* internalPointer) 122 { 123 ASSERT_NOT_REACHED(); 124 return 0; 125 } 126 127 template<> 128 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 129 { 130 return toV8(impl, creationContext, isolate); 131 } 132 133 } // namespace blink 134