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 "V8TestInterfaceEmpty.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/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"
23 static void initializeScriptWrappableForInterface(TestInterfaceEmpty* object)
25 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
26 ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceEmpty::wrapperTypeInfo);
33 void webCoreInitializeScriptWrappableForInterface(blink::TestInterfaceEmpty* object)
35 blink::initializeScriptWrappableForInterface(object);
39 const WrapperTypeInfo V8TestInterfaceEmpty::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEmpty::domTemplate, V8TestInterfaceEmpty::derefObject, 0, 0, 0, V8TestInterfaceEmpty::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
41 namespace TestInterfaceEmptyV8Internal {
43 template <typename T> void V8_USE(T) { }
45 } // namespace TestInterfaceEmptyV8Internal
47 static void installV8TestInterfaceEmptyTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
49 functionTemplate->ReadOnlyPrototype();
51 v8::Local<v8::Signature> defaultSignature;
52 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceEmpty", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceEmpty::internalFieldCount,
57 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
58 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
60 // Custom toString template
61 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
64 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEmpty::domTemplate(v8::Isolate* isolate)
66 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceEmptyTemplate);
69 bool V8TestInterfaceEmpty::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
71 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
74 v8::Handle<v8::Object> V8TestInterfaceEmpty::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
76 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
79 TestInterfaceEmpty* V8TestInterfaceEmpty::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
81 return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
84 v8::Handle<v8::Object> wrap(TestInterfaceEmpty* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
87 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl, isolate));
88 return V8TestInterfaceEmpty::createWrapper(impl, creationContext, isolate);
91 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterfaceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
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);
102 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
103 if (UNLIKELY(wrapper.IsEmpty()))
106 installConditionallyEnabledProperties(wrapper, isolate);
107 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEmpty>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
111 void V8TestInterfaceEmpty::derefObject(ScriptWrappableBase* internalPointer)
113 fromInternalPointer(internalPointer)->deref();
117 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEmpty* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
119 return toV8(impl, creationContext, isolate);