| OLD | NEW |
| (Empty) |
| 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 "V8TestException.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/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" | |
| 20 | |
| 21 namespace blink { | |
| 22 | |
| 23 const WrapperTypeInfo V8TestException::wrapperTypeInfo = { gin::kEmbedderBlink,
V8TestException::domTemplate, V8TestException::refObject, V8TestException::deref
Object, V8TestException::createPersistentHandle, 0, 0, 0, V8TestException::insta
llConditionallyEnabledMethods, V8TestException::installConditionallyEnabledPrope
rties, 0, WrapperTypeInfo::WrapperTypeExceptionPrototype, WrapperTypeInfo::Objec
tClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; | |
| 24 | |
| 25 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestExceptio
n.h. | |
| 26 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 27 // bindings/core/v8/ScriptWrappable.h. | |
| 28 const WrapperTypeInfo& TestException::s_wrapperTypeInfo = V8TestException::wrapp
erTypeInfo; | |
| 29 | |
| 30 namespace TestExceptionV8Internal { | |
| 31 | |
| 32 template <typename T> void V8_USE(T) { } | |
| 33 | |
| 34 static void readonlyUnsignedShortAttributeAttributeGetter(const v8::PropertyCall
backInfo<v8::Value>& info) | |
| 35 { | |
| 36 v8::Handle<v8::Object> holder = info.Holder(); | |
| 37 TestException* impl = V8TestException::toImpl(holder); | |
| 38 v8SetReturnValueUnsigned(info, impl->readonlyUnsignedShortAttribute()); | |
| 39 } | |
| 40 | |
| 41 static void readonlyUnsignedShortAttributeAttributeGetterCallback(v8::Local<v8::
String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 42 { | |
| 43 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 44 TestExceptionV8Internal::readonlyUnsignedShortAttributeAttributeGetter(info)
; | |
| 45 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 46 } | |
| 47 | |
| 48 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | |
| 49 { | |
| 50 v8::Handle<v8::Object> holder = info.Holder(); | |
| 51 TestException* impl = V8TestException::toImpl(holder); | |
| 52 v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolat
e()); | |
| 53 } | |
| 54 | |
| 55 static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 56 { | |
| 57 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 58 TestExceptionV8Internal::readonlyStringAttributeAttributeGetter(info); | |
| 59 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 60 } | |
| 61 | |
| 62 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 63 { | |
| 64 TestException* impl = V8TestException::toImpl(info.Holder()); | |
| 65 v8SetReturnValueString(info, impl->toString(), info.GetIsolate()); | |
| 66 } | |
| 67 | |
| 68 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | |
| 69 { | |
| 70 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 71 TestExceptionV8Internal::toStringMethod(info); | |
| 72 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 73 } | |
| 74 | |
| 75 } // namespace TestExceptionV8Internal | |
| 76 | |
| 77 static const V8DOMConfiguration::AttributeConfiguration V8TestExceptionAttribute
s[] = { | |
| 78 {"readonlyUnsignedShortAttribute", TestExceptionV8Internal::readonlyUnsigned
ShortAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl
>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration
::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 79 {"readonlyStringAttribute", TestExceptionV8Internal::readonlyStringAttribute
AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT)
, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAll
Scripts, V8DOMConfiguration::OnInstance}, | |
| 80 }; | |
| 81 | |
| 82 static void installV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> func
tionTemplate, v8::Isolate* isolate) | |
| 83 { | |
| 84 functionTemplate->ReadOnlyPrototype(); | |
| 85 | |
| 86 v8::Local<v8::Signature> defaultSignature; | |
| 87 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::intern
alFieldCount, | |
| 88 V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes), | |
| 89 0, 0, | |
| 90 0, 0, | |
| 91 isolate); | |
| 92 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 93 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 94 static const V8DOMConfiguration::ConstantConfiguration V8TestExceptionConsta
nts[] = { | |
| 95 {"UNSIGNED_SHORT_CONSTANT", 1, 0, 0, V8DOMConfiguration::ConstantTypeUns
ignedShort}, | |
| 96 }; | |
| 97 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestExceptionConstants, WTF_ARRAY_LENGTH(V8TestExceptionConstants), isolate); | |
| 98 static const V8DOMConfiguration::MethodConfiguration toStringMethodConfigura
tion = { | |
| 99 "toString", TestExceptionV8Internal::toStringMethodCallback, 0, 0, V8DOM
Configuration::ExposedToAllScripts, | |
| 100 }; | |
| 101 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, stati
c_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConf
iguration, isolate); | |
| 102 | |
| 103 // Custom toString template | |
| 104 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 105 } | |
| 106 | |
| 107 v8::Handle<v8::FunctionTemplate> V8TestException::domTemplate(v8::Isolate* isola
te) | |
| 108 { | |
| 109 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestExceptionTemplate); | |
| 110 } | |
| 111 | |
| 112 bool V8TestException::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* is
olate) | |
| 113 { | |
| 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 115 } | |
| 116 | |
| 117 v8::Handle<v8::Object> V8TestException::findInstanceInPrototypeChain(v8::Handle<
v8::Value> v8Value, v8::Isolate* isolate) | |
| 118 { | |
| 119 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 120 } | |
| 121 | |
| 122 TestException* V8TestException::toImplWithTypeCheck(v8::Isolate* isolate, v8::Ha
ndle<v8::Value> value) | |
| 123 { | |
| 124 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestException>() : 0; | |
| 125 } | |
| 126 | |
| 127 | |
| 128 void V8TestException::refObject(ScriptWrappableBase* internalPointer) | |
| 129 { | |
| 130 internalPointer->toImpl<TestException>()->ref(); | |
| 131 } | |
| 132 | |
| 133 void V8TestException::derefObject(ScriptWrappableBase* internalPointer) | |
| 134 { | |
| 135 internalPointer->toImpl<TestException>()->deref(); | |
| 136 } | |
| 137 | |
| 138 WrapperPersistentNode* V8TestException::createPersistentHandle(ScriptWrappableBa
se* internalPointer) | |
| 139 { | |
| 140 ASSERT_NOT_REACHED(); | |
| 141 return 0; | |
| 142 } | |
| 143 | |
| 144 template<> | |
| 145 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | |
| 146 { | |
| 147 return toV8(impl, creationContext, isolate); | |
| 148 } | |
| 149 | |
| 150 } // namespace blink | |
| OLD | NEW |