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.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
8 #include "V8SVGTestInterface.h"
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/CustomElementCallbackDispatcher.h"
18 #include "platform/RuntimeEnabledFeatures.h"
19 #include "platform/TraceEvent.h"
20 #include "wtf/GetPtr.h"
21 #include "wtf/RefPtr.h"
25 static void initializeScriptWrappableForInterface(SVGTestInterface* object)
27 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
28 ScriptWrappable::fromObject(object)->setTypeInfo(&V8SVGTestInterface::wrapperTypeInfo);
35 void webCoreInitializeScriptWrappableForInterface(blink::SVGTestInterface* object)
37 blink::initializeScriptWrappableForInterface(object);
41 const WrapperTypeInfo V8SVGTestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8SVGTestInterface::domTemplate, V8SVGTestInterface::derefObject, 0, 0, 0, V8SVGTestInterface::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
43 namespace SVGTestInterfaceV8Internal {
45 template <typename T> void V8_USE(T) { }
47 static void typeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
49 v8::Handle<v8::Object> holder = info.Holder();
50 SVGTestInterface* impl = V8SVGTestInterface::toNative(holder);
51 v8SetReturnValueString(info, impl->fastGetAttribute(SVGNames::typeAttr), info.GetIsolate());
54 static void typeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
56 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
57 SVGTestInterfaceV8Internal::typeAttributeGetter(info);
58 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
61 static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
63 v8::Handle<v8::Object> holder = info.Holder();
64 SVGTestInterface* impl = V8SVGTestInterface::toNative(holder);
65 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
67 impl->setAttribute(SVGNames::typeAttr, cppValue);
70 static void typeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
72 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
73 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
74 SVGTestInterfaceV8Internal::typeAttributeSetter(v8Value, info);
75 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
78 } // namespace SVGTestInterfaceV8Internal
80 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttributes[] = {
81 {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInterfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
84 static void installV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
86 functionTemplate->ReadOnlyPrototype();
88 v8::Local<v8::Signature> defaultSignature;
89 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::internalFieldCount,
90 V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttributes),
94 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
95 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
97 // Custom toString template
98 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
101 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* isolate)
103 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8SVGTestInterfaceTemplate);
106 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
108 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
111 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
113 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
116 SVGTestInterface* V8SVGTestInterface::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
118 return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
121 v8::Handle<v8::Object> wrap(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
124 ASSERT(!DOMDataStore::containsWrapper<V8SVGTestInterface>(impl, isolate));
125 return V8SVGTestInterface::createWrapper(impl, creationContext, isolate);
128 v8::Handle<v8::Object> V8SVGTestInterface::createWrapper(PassRefPtr<SVGTestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
131 ASSERT(!DOMDataStore::containsWrapper<V8SVGTestInterface>(impl.get(), isolate));
132 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
133 const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
134 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
135 // the same object de-ref functions, though, so use that as the basis of the check.
136 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
139 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
140 if (UNLIKELY(wrapper.IsEmpty()))
143 installConditionallyEnabledProperties(wrapper, isolate);
144 V8DOMWrapper::associateObjectWithWrapper<V8SVGTestInterface>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
148 void V8SVGTestInterface::derefObject(ScriptWrappableBase* internalPointer)
150 fromInternalPointer(internalPointer)->deref();
154 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
156 return toV8(impl, creationContext, isolate);