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 "V8TestInterface3.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 "bindings/tests/v8/V8Node.h"
15 #include "core/dom/ContextFeatures.h"
16 #include "core/dom/Document.h"
17 #include "platform/RuntimeEnabledFeatures.h"
18 #include "platform/TraceEvent.h"
19 #include "wtf/GetPtr.h"
20 #include "wtf/RefPtr.h"
24 static void initializeScriptWrappableForInterface(TestInterface3* object)
26 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
27 ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterface3::wrapperTypeInfo);
34 void webCoreInitializeScriptWrappableForInterface(blink::TestInterface3* object)
36 blink::initializeScriptWrappableForInterface(object);
40 const WrapperTypeInfo V8TestInterface3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface3::domTemplate, V8TestInterface3::derefObject, 0, 0, V8TestInterface3::visitDOMWrapper, V8TestInterface3::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
42 namespace TestInterface3V8Internal {
44 template <typename T> void V8_USE(T) { }
46 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
48 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
49 V8TestInterface3::indexedPropertyGetterCustom(index, info);
50 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
53 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
55 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
56 V8TestInterface3::indexedPropertySetterCustom(index, v8Value, info);
57 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
60 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
62 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
63 V8TestInterface3::indexedPropertyDeleterCustom(index, info);
64 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
67 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
69 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
70 V8TestInterface3::namedPropertyGetterCustom(name, info);
71 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
74 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
76 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
77 V8TestInterface3::namedPropertySetterCustom(name, v8Value, info);
78 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
81 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
83 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
84 V8TestInterface3::namedPropertyQueryCustom(name, info);
85 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
88 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
90 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
91 V8TestInterface3::namedPropertyDeleterCustom(name, info);
92 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
95 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
97 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
98 V8TestInterface3::namedPropertyEnumeratorCustom(info);
99 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
102 } // namespace TestInterface3V8Internal
104 static void installV8TestInterface3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
106 functionTemplate->ReadOnlyPrototype();
108 v8::Local<v8::Signature> defaultSignature;
109 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface3", v8::Local<v8::FunctionTemplate>(), V8TestInterface3::internalFieldCount,
114 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
115 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
116 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterface3V8Internal::indexedPropertyGetterCallback, TestInterface3V8Internal::indexedPropertySetterCallback, 0, TestInterface3V8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface3>);
117 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface3V8Internal::namedPropertyGetterCallback, TestInterface3V8Internal::namedPropertySetterCallback, TestInterface3V8Internal::namedPropertyQueryCallback, TestInterface3V8Internal::namedPropertyDeleterCallback, TestInterface3V8Internal::namedPropertyEnumeratorCallback);
119 // Custom toString template
120 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
123 v8::Handle<v8::FunctionTemplate> V8TestInterface3::domTemplate(v8::Isolate* isolate)
125 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface3Template);
128 bool V8TestInterface3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
130 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
133 v8::Handle<v8::Object> V8TestInterface3::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
135 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
138 TestInterface3* V8TestInterface3::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
140 return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
143 v8::Handle<v8::Object> wrap(TestInterface3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
146 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface3>(impl, isolate));
147 return V8TestInterface3::createWrapper(impl, creationContext, isolate);
150 v8::Handle<v8::Object> V8TestInterface3::createWrapper(PassRefPtr<TestInterface3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
153 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface3>(impl.get(), isolate));
154 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
155 const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
156 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
157 // the same object de-ref functions, though, so use that as the basis of the check.
158 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
161 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
162 if (UNLIKELY(wrapper.IsEmpty()))
165 installConditionallyEnabledProperties(wrapper, isolate);
166 V8DOMWrapper::associateObjectWithWrapper<V8TestInterface3>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
170 void V8TestInterface3::derefObject(ScriptWrappableBase* internalPointer)
172 fromInternalPointer(internalPointer)->deref();
176 v8::Handle<v8::Value> toV8NoInline(TestInterface3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
178 return toV8(impl, creationContext, isolate);