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 "V8TestIntegerIndexed.h" |
| 9 |
| 10 #include "bindings/core/v8/ExceptionState.h" |
| 11 #include "bindings/core/v8/V8DOMConfiguration.h" |
| 12 #include "bindings/core/v8/V8Document.h" |
| 13 #include "bindings/core/v8/V8Node.h" |
| 14 #include "bindings/core/v8/V8ObjectConstructor.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" |
| 21 |
| 22 namespace blink { |
| 23 |
| 24 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
| 25 // and does not depend on another global objects. |
| 26 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 27 #pragma clang diagnostic push |
| 28 #pragma clang diagnostic ignored "-Wglobal-constructors" |
| 29 #endif |
| 30 const WrapperTypeInfo V8TestIntegerIndexed::wrapperTypeInfo = { gin::kEmbedderBl
ink, V8TestIntegerIndexed::domTemplate, V8TestIntegerIndexed::refObject, V8TestI
ntegerIndexed::derefObject, V8TestIntegerIndexed::trace, 0, 0, V8TestIntegerInde
xed::preparePrototypeAndInterfaceObject, V8TestIntegerIndexed::installConditiona
llyEnabledProperties, "TestIntegerIndexed", 0, WrapperTypeInfo::WrapperTypeObjec
tPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEvent
Target, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; |
| 31 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 32 #pragma clang diagnostic pop |
| 33 #endif |
| 34 |
| 35 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestIntegerI
ndexed.h. |
| 36 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| 37 // bindings/core/v8/ScriptWrappable.h. |
| 38 const WrapperTypeInfo& TestIntegerIndexed::s_wrapperTypeInfo = V8TestIntegerInde
xed::wrapperTypeInfo; |
| 39 |
| 40 namespace TestIntegerIndexedV8Internal { |
| 41 |
| 42 static void lengthAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 43 { |
| 44 v8::Local<v8::Object> holder = info.Holder(); |
| 45 TestIntegerIndexed* impl = V8TestIntegerIndexed::toImpl(holder); |
| 46 v8SetReturnValueInt(info, impl->length()); |
| 47 } |
| 48 |
| 49 static void lengthAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 50 { |
| 51 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 52 TestIntegerIndexedV8Internal::lengthAttributeGetter(info); |
| 53 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 54 } |
| 55 |
| 56 static void lengthAttributeSetter(v8::Local<v8::Value> v8Value, const v8::Functi
onCallbackInfo<v8::Value>& info) |
| 57 { |
| 58 v8::Local<v8::Object> holder = info.Holder(); |
| 59 ExceptionState exceptionState(ExceptionState::SetterContext, "length", "Test
IntegerIndexed", holder, info.GetIsolate()); |
| 60 TestIntegerIndexed* impl = V8TestIntegerIndexed::toImpl(holder); |
| 61 int cppValue = toInt16(info.GetIsolate(), v8Value, NormalConversion, excepti
onState); |
| 62 if (exceptionState.throwIfNeeded()) |
| 63 return; |
| 64 impl->setLength(cppValue); |
| 65 } |
| 66 |
| 67 static void lengthAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 68 { |
| 69 v8::Local<v8::Value> v8Value = info[0]; |
| 70 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| 71 TestIntegerIndexedV8Internal::lengthAttributeSetter(v8Value, info); |
| 72 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 73 } |
| 74 |
| 75 static void voidMethodDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 76 { |
| 77 if (UNLIKELY(info.Length() < 1)) { |
| 78 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(in
fo.GetIsolate(), "voidMethodDocument", "TestIntegerIndexed", 1, info.Length()),
info.GetIsolate()); |
| 79 return; |
| 80 } |
| 81 TestIntegerIndexed* impl = V8TestIntegerIndexed::toImpl(info.Holder()); |
| 82 Document* document; |
| 83 { |
| 84 document = V8Document::toImplWithTypeCheck(info.GetIsolate(), info[0]); |
| 85 } |
| 86 impl->voidMethodDocument(document); |
| 87 } |
| 88 |
| 89 static void voidMethodDocumentMethodCallback(const v8::FunctionCallbackInfo<v8::
Value>& info) |
| 90 { |
| 91 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 92 TestIntegerIndexedV8Internal::voidMethodDocumentMethod(info); |
| 93 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 94 } |
| 95 |
| 96 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 97 { |
| 98 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 99 V8TestIntegerIndexed::indexedPropertyGetterCustom(index, info); |
| 100 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 101 } |
| 102 |
| 103 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 104 { |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 106 V8TestIntegerIndexed::indexedPropertySetterCustom(index, v8Value, info); |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 108 } |
| 109 |
| 110 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
| 111 { |
| 112 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 113 V8TestIntegerIndexed::indexedPropertyDeleterCustom(index, info); |
| 114 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 115 } |
| 116 |
| 117 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
| 118 { |
| 119 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 120 V8TestIntegerIndexed::namedPropertyGetterCustom(name, info); |
| 121 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 122 } |
| 123 |
| 124 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 125 { |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 127 V8TestIntegerIndexed::namedPropertySetterCustom(name, v8Value, info); |
| 128 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 129 } |
| 130 |
| 131 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
rtyCallbackInfo<v8::Integer>& info) |
| 132 { |
| 133 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 134 V8TestIntegerIndexed::namedPropertyQueryCustom(name, info); |
| 135 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 136 } |
| 137 |
| 138 static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info) |
| 139 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 141 V8TestIntegerIndexed::namedPropertyDeleterCustom(name, info); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 143 } |
| 144 |
| 145 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 146 { |
| 147 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 148 V8TestIntegerIndexed::namedPropertyEnumeratorCustom(info); |
| 149 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 150 } |
| 151 |
| 152 } // namespace TestIntegerIndexedV8Internal |
| 153 |
| 154 const V8DOMConfiguration::AccessorConfiguration V8TestIntegerIndexedAccessors[]
= { |
| 155 {"length", TestIntegerIndexedV8Internal::lengthAttributeGetterCallback, Test
IntegerIndexedV8Internal::lengthAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, s
tatic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScr
ipts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
| 156 }; |
| 157 |
| 158 const V8DOMConfiguration::MethodConfiguration V8TestIntegerIndexedMethods[] = { |
| 159 {"voidMethodDocument", TestIntegerIndexedV8Internal::voidMethodDocumentMetho
dCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfigu
ration::OnPrototype}, |
| 160 }; |
| 161 |
| 162 static void installV8TestIntegerIndexedTemplate(v8::Local<v8::FunctionTemplate>
functionTemplate, v8::Isolate* isolate) |
| 163 { |
| 164 functionTemplate->ReadOnlyPrototype(); |
| 165 |
| 166 v8::Local<v8::Signature> defaultSignature; |
| 167 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "TestIntegerIndexed", v8::Local<v8::FunctionTemplate>(), V8TestInt
egerIndexed::internalFieldCount, |
| 168 0, 0, |
| 169 V8TestIntegerIndexedAccessors, WTF_ARRAY_LENGTH(V8TestIntegerIndexedAcce
ssors), |
| 170 V8TestIntegerIndexedMethods, WTF_ARRAY_LENGTH(V8TestIntegerIndexedMethod
s)); |
| 171 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 172 ALLOW_UNUSED_LOCAL(instanceTemplate); |
| 173 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 174 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| 175 if (RuntimeEnabledFeatures::iterableCollectionsEnabled()) { |
| 176 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isol
ate), v8::kArrayProto_values, v8::DontEnum); |
| 177 } |
| 178 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInt
egerIndexedV8Internal::indexedPropertyGetterCallback, TestIntegerIndexedV8Intern
al::indexedPropertySetterCallback, 0, TestIntegerIndexedV8Internal::indexedPrope
rtyDeleterCallback, indexedPropertyEnumerator<TestIntegerIndexed>, v8::Local<v8:
:Value>(), v8::PropertyHandlerFlags::kNone); |
| 179 instanceTemplate->SetHandler(indexedPropertyHandlerConfig); |
| 180 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInteger
IndexedV8Internal::namedPropertyGetterCallback, TestIntegerIndexedV8Internal::na
medPropertySetterCallback, TestIntegerIndexedV8Internal::namedPropertyQueryCallb
ack, TestIntegerIndexedV8Internal::namedPropertyDeleterCallback, TestIntegerInde
xedV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_c
ast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptString
s) | int(v8::PropertyHandlerFlags::kNonMasking))); |
| 181 instanceTemplate->SetHandler(namedPropertyHandlerConfig); |
| 182 |
| 183 // Custom toString template |
| 184 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); |
| 185 } |
| 186 |
| 187 v8::Local<v8::FunctionTemplate> V8TestIntegerIndexed::domTemplate(v8::Isolate* i
solate) |
| 188 { |
| 189 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestIntegerIndexedTemplate); |
| 190 } |
| 191 |
| 192 bool V8TestIntegerIndexed::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate
* isolate) |
| 193 { |
| 194 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
| 195 } |
| 196 |
| 197 v8::Local<v8::Object> V8TestIntegerIndexed::findInstanceInPrototypeChain(v8::Loc
al<v8::Value> v8Value, v8::Isolate* isolate) |
| 198 { |
| 199 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
| 200 } |
| 201 |
| 202 TestIntegerIndexed* V8TestIntegerIndexed::toImplWithTypeCheck(v8::Isolate* isola
te, v8::Local<v8::Value> value) |
| 203 { |
| 204 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
| 205 } |
| 206 |
| 207 void V8TestIntegerIndexed::refObject(ScriptWrappable* scriptWrappable) |
| 208 { |
| 209 scriptWrappable->toImpl<TestIntegerIndexed>()->ref(); |
| 210 } |
| 211 |
| 212 void V8TestIntegerIndexed::derefObject(ScriptWrappable* scriptWrappable) |
| 213 { |
| 214 scriptWrappable->toImpl<TestIntegerIndexed>()->deref(); |
| 215 } |
| 216 |
| 217 } // namespace blink |
OLD | NEW |