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 "V8TestException.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 const WrapperTypeInfo V8TestException::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestException::domTemplate, V8TestException::refObject, V8TestException::derefObject, V8TestException::createPersistentHandle, 0, 0, 0, V8TestException::installConditionallyEnabledMethods, V8TestException::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeExceptionPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
25 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestException.h.
26 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
27 // bindings/core/v8/ScriptWrappable.h.
28 const WrapperTypeInfo& TestException::s_wrapperTypeInfo = V8TestException::wrapperTypeInfo;
30 namespace TestExceptionV8Internal {
32 template <typename T> void V8_USE(T) { }
34 static void readonlyUnsignedShortAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
36 v8::Handle<v8::Object> holder = info.Holder();
37 TestException* impl = V8TestException::toImpl(holder);
38 v8SetReturnValueUnsigned(info, impl->readonlyUnsignedShortAttribute());
41 static void readonlyUnsignedShortAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
43 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
44 TestExceptionV8Internal::readonlyUnsignedShortAttributeAttributeGetter(info);
45 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
48 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
50 v8::Handle<v8::Object> holder = info.Holder();
51 TestException* impl = V8TestException::toImpl(holder);
52 v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolate());
55 static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
57 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
58 TestExceptionV8Internal::readonlyStringAttributeAttributeGetter(info);
59 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
62 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
64 TestException* impl = V8TestException::toImpl(info.Holder());
65 v8SetReturnValueString(info, impl->toString(), info.GetIsolate());
68 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
70 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
71 TestExceptionV8Internal::toStringMethod(info);
72 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
75 } // namespace TestExceptionV8Internal
77 static const V8DOMConfiguration::AttributeConfiguration V8TestExceptionAttributes[] = {
78 {"readonlyUnsignedShortAttribute", TestExceptionV8Internal::readonlyUnsignedShortAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
79 {"readonlyStringAttribute", TestExceptionV8Internal::readonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
82 static void installV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
84 functionTemplate->ReadOnlyPrototype();
86 v8::Local<v8::Signature> defaultSignature;
87 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::internalFieldCount,
88 V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes),
92 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
93 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
94 static const V8DOMConfiguration::ConstantConfiguration V8TestExceptionConstants[] = {
95 {"UNSIGNED_SHORT_CONSTANT", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
97 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestExceptionConstants, WTF_ARRAY_LENGTH(V8TestExceptionConstants), isolate);
98 static const V8DOMConfiguration::MethodConfiguration toStringMethodConfiguration = {
99 "toString", TestExceptionV8Internal::toStringMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
101 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConfiguration, isolate);
103 // Custom toString template
104 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
107 v8::Handle<v8::FunctionTemplate> V8TestException::domTemplate(v8::Isolate* isolate)
109 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestExceptionTemplate);
112 bool V8TestException::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
117 v8::Handle<v8::Object> V8TestException::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
119 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
122 TestException* V8TestException::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
124 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestException>() : 0;
128 void V8TestException::refObject(ScriptWrappableBase* internalPointer)
130 internalPointer->toImpl<TestException>()->ref();
133 void V8TestException::derefObject(ScriptWrappableBase* internalPointer)
135 internalPointer->toImpl<TestException>()->deref();
138 WrapperPersistentNode* V8TestException::createPersistentHandle(ScriptWrappableBase* internalPointer)
140 ASSERT_NOT_REACHED();
145 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
147 return toV8(impl, creationContext, isolate);