| 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 "V8TestInterfaceEventConstructor.h" | |
| 9 | |
| 10 #include "bindings/core/v8/Dictionary.h" | |
| 11 #include "bindings/core/v8/ExceptionState.h" | |
| 12 #include "bindings/core/v8/ScriptValue.h" | |
| 13 #include "bindings/core/v8/SerializedScriptValue.h" | |
| 14 #include "bindings/core/v8/SerializedScriptValueFactory.h" | |
| 15 #include "bindings/core/v8/V8DOMConfiguration.h" | |
| 16 #include "bindings/core/v8/V8HiddenValue.h" | |
| 17 #include "bindings/core/v8/V8ObjectConstructor.h" | |
| 18 #include "bindings/core/v8/V8TestInterfaceEmpty.h" | |
| 19 #include "bindings/core/v8/V8Uint8Array.h" | |
| 20 #include "core/dom/ContextFeatures.h" | |
| 21 #include "core/dom/Document.h" | |
| 22 #include "core/frame/LocalDOMWindow.h" | |
| 23 #include "core/frame/UseCounter.h" | |
| 24 #include "platform/RuntimeEnabledFeatures.h" | |
| 25 #include "platform/TraceEvent.h" | |
| 26 #include "wtf/GetPtr.h" | |
| 27 #include "wtf/RefPtr.h" | |
| 28 | |
| 29 namespace blink { | |
| 30 | |
| 31 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin::
kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEve
ntConstructor::refObject, V8TestInterfaceEventConstructor::derefObject, V8TestIn
terfaceEventConstructor::trace, 0, 0, V8TestInterfaceEventConstructor::preparePr
ototypeObject, V8TestInterfaceEventConstructor::installConditionallyEnabledPrope
rties, "TestInterfaceEventConstructor", &V8Event::wrapperTypeInfo, WrapperTypeIn
fo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo:
:NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::WillB
eGarbageCollectedObject }; | |
| 32 | |
| 33 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac
eEventConstructor.h. | |
| 34 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 35 // bindings/core/v8/ScriptWrappable.h. | |
| 36 const WrapperTypeInfo& TestInterfaceEventConstructor::s_wrapperTypeInfo = V8Test
InterfaceEventConstructor::wrapperTypeInfo; | |
| 37 | |
| 38 namespace TestInterfaceEventConstructorV8Internal { | |
| 39 | |
| 40 static void readonlyStringAttributeAttributeGetter(const v8::FunctionCallbackInf
o<v8::Value>& info) | |
| 41 { | |
| 42 v8::Local<v8::Object> holder = info.Holder(); | |
| 43 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 44 v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolat
e()); | |
| 45 } | |
| 46 | |
| 47 static void readonlyStringAttributeAttributeGetterCallback(const v8::FunctionCal
lbackInfo<v8::Value>& info) | |
| 48 { | |
| 49 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 50 TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGet
ter(info); | |
| 51 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 52 } | |
| 53 | |
| 54 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetter(
const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 55 { | |
| 56 v8::Local<v8::Object> holder = info.Holder(); | |
| 57 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 58 v8SetReturnValueString(info, impl->initializedByEventConstructorReadonlyStri
ngAttribute(), info.GetIsolate()); | |
| 59 } | |
| 60 | |
| 61 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetterC
allback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 62 { | |
| 63 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 64 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyStringAttributeAttributeGetter(info); | |
| 65 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 66 } | |
| 67 | |
| 68 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(con
st v8::FunctionCallbackInfo<v8::Value>& info) | |
| 69 { | |
| 70 v8::Local<v8::Object> holder = info.Holder(); | |
| 71 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 72 v8SetReturnValue(info, impl->initializedByEventConstructorReadonlyAnyAttribu
te().v8Value()); | |
| 73 } | |
| 74 | |
| 75 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCall
back(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 76 { | |
| 77 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 78 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyAnyAttributeAttributeGetter(info); | |
| 79 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 80 } | |
| 81 | |
| 82 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter
(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 83 { | |
| 84 v8::Local<v8::Object> holder = info.Holder(); | |
| 85 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 86 v8SetReturnValueBool(info, impl->initializedByEventConstructorReadonlyBoolea
nAttribute()); | |
| 87 } | |
| 88 | |
| 89 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter
Callback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 90 { | |
| 91 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 92 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyBooleanAttributeAttributeGetter(info); | |
| 93 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 94 } | |
| 95 | |
| 96 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetter(co
nst v8::FunctionCallbackInfo<v8::Value>& info) | |
| 97 { | |
| 98 v8::Local<v8::Object> holder = info.Holder(); | |
| 99 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 100 v8SetReturnValueInt(info, impl->initializedByEventConstructorReadonlyLongAtt
ribute()); | |
| 101 } | |
| 102 | |
| 103 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetterCal
lback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 104 { | |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 106 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyLongAttributeAttributeGetter(info); | |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 108 } | |
| 109 | |
| 110 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
ter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 111 { | |
| 112 v8::Local<v8::Object> holder = info.Holder(); | |
| 113 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 114 RefPtr<DOMUint8Array> cppValue(impl->initializedByEventConstructorReadonlyUi
nt8ArrayAttribute()); | |
| 115 if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue
.get())) | |
| 116 return; | |
| 117 v8::Local<v8::Value> v8Value(toV8(cppValue.get(), holder, info.GetIsolate())
); | |
| 118 if (!v8Value.IsEmpty()) { | |
| 119 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "initializedByEventConstructorReadonlyUint8ArrayAttribute"),
v8Value); | |
| 120 v8SetReturnValue(info, v8Value); | |
| 121 } | |
| 122 } | |
| 123 | |
| 124 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
terCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 125 { | |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 127 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyUint8ArrayAttributeAttributeGetter(info); | |
| 128 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 129 } | |
| 130 | |
| 131 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 132 { | |
| 133 v8::Local<v8::Object> holder = info.Holder(); | |
| 134 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 135 RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReado
nlyTestInterfaceEmptyAttribute()); | |
| 136 if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue
.get())) | |
| 137 return; | |
| 138 v8::Local<v8::Value> v8Value(toV8(cppValue.get(), holder, info.GetIsolate())
); | |
| 139 if (!v8Value.IsEmpty()) { | |
| 140 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttri
bute"), v8Value); | |
| 141 v8SetReturnValue(info, v8Value); | |
| 142 } | |
| 143 } | |
| 144 | |
| 145 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 146 { | |
| 147 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 148 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyAttributeAttributeGetter(info); | |
| 149 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 150 } | |
| 151 | |
| 152 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribut
eAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 153 { | |
| 154 v8::Local<v8::Object> holder = info.Holder(); | |
| 155 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 156 v8SetReturnValue(info, toV8(impl->initializedByEventConstructorReadonlyTestI
nterfaceEmptyArrayAttribute(), info.Holder(), info.GetIsolate())); | |
| 157 } | |
| 158 | |
| 159 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribut
eAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 160 { | |
| 161 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 162 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyArrayAttributeAttributeGetter(info); | |
| 163 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 164 } | |
| 165 | |
| 166 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 167 { | |
| 168 v8::Local<v8::Object> holder = info.Holder(); | |
| 169 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 170 RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReado
nlyNullableTestInterfaceEmptyAttribute()); | |
| 171 if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue
.get())) | |
| 172 return; | |
| 173 v8::Local<v8::Value> v8Value(toV8(cppValue.get(), holder, info.GetIsolate())
); | |
| 174 if (!v8Value.IsEmpty()) { | |
| 175 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "initializedByEventConstructorReadonlyNullableTestInterfaceEm
ptyAttribute"), v8Value); | |
| 176 v8SetReturnValue(info, v8Value); | |
| 177 } | |
| 178 } | |
| 179 | |
| 180 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 181 { | |
| 182 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 183 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyNullableTestInterfaceEmptyAttributeAttributeGetter(info); | |
| 184 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 185 } | |
| 186 | |
| 187 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttrib
uteGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 188 { | |
| 189 v8::Local<v8::Object> holder = info.Holder(); | |
| 190 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 191 v8SetReturnValueString(info, impl->deprecatedInitializedByEventConstructorRe
adonlyStringAttribute(), info.GetIsolate()); | |
| 192 } | |
| 193 | |
| 194 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttrib
uteGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 195 { | |
| 196 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 197 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReado
nlyStringAttribute); | |
| 198 TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstru
ctorReadonlyStringAttributeAttributeGetter(info); | |
| 199 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 200 } | |
| 201 | |
| 202 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAtt
ributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 203 { | |
| 204 v8::Local<v8::Object> holder = info.Holder(); | |
| 205 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 206 v8SetReturnValueString(info, impl->implementedAsName(), info.GetIsolate()); | |
| 207 } | |
| 208 | |
| 209 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAtt
ributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 210 { | |
| 211 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 212 TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventCons
tructorReadonlyStringAttributeAttributeGetter(info); | |
| 213 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 214 } | |
| 215 | |
| 216 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAt
tributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 217 { | |
| 218 v8::Local<v8::Object> holder = info.Holder(); | |
| 219 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
| 220 v8SetReturnValueString(info, impl->deprecatedImplementedAsName(), info.GetIs
olate()); | |
| 221 } | |
| 222 | |
| 223 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAt
tributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 224 { | |
| 225 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 226 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReado
nlyStringAttribute); | |
| 227 TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedB
yEventConstructorReadonlyStringAttributeAttributeGetter(info); | |
| 228 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 229 } | |
| 230 | |
| 231 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 232 { | |
| 233 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceEventConstructor", info.Holder(), info.GetIsolate()); | |
| 234 if (info.Length() < 1) { | |
| 235 exceptionState.throwTypeError("An event name must be provided."); | |
| 236 exceptionState.throwIfNeeded(); | |
| 237 return; | |
| 238 } | |
| 239 | |
| 240 V8StringResource<> type(info[0]); | |
| 241 if (!type.prepare()) | |
| 242 return; | |
| 243 v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute; | |
| 244 TestInterfaceEventConstructorInit eventInit; | |
| 245 if (info.Length() >= 2) { | |
| 246 Dictionary options(info[1], info.GetIsolate(), exceptionState); | |
| 247 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState, info)) { | |
| 248 exceptionState.throwIfNeeded(); | |
| 249 return; | |
| 250 } | |
| 251 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); | |
| 252 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | |
| 253 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8At
omicString(info.GetIsolate(), "initializedByEventConstructorReadonlyAnyAttribute
"), initializedByEventConstructorReadonlyAnyAttribute); | |
| 254 } | |
| 255 RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEvent
Constructor::create(type, eventInit, exceptionState); | |
| 256 if (exceptionState.throwIfNeeded()) | |
| 257 return; | |
| 258 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) { | |
| 259 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | |
| 260 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValueFactory::instance().createAndSwallowExceptions(info.GetIs
olate(), initializedByEventConstructorReadonlyAnyAttribute)); | |
| 261 } | |
| 262 | |
| 263 v8::Local<v8::Object> wrapper = info.Holder(); | |
| 264 event->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceEventConstruc
tor::wrapperTypeInfo, wrapper); | |
| 265 v8SetReturnValue(info, wrapper); | |
| 266 } | |
| 267 | |
| 268 } // namespace TestInterfaceEventConstructorV8Internal | |
| 269 | |
| 270 static const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceEventConst
ructorAccessors[] = { | |
| 271 {"readonlyStringAttribute", TestInterfaceEventConstructorV8Internal::readonl
yStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContr
ol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati
on::ExposedToAllScripts}, | |
| 272 {"initializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventC
onstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttrib
uteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stat
ic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScript
s}, | |
| 273 {"initializedByEventConstructorReadonlyAnyAttribute", TestInterfaceEventCons
tructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGet
terCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cas
t<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts}, | |
| 274 {"initializedByEventConstructorReadonlyBooleanAttribute", TestInterfaceEvent
ConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttr
ibuteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScri
pts}, | |
| 275 {"initializedByEventConstructorReadonlyLongAttribute", TestInterfaceEventCon
structorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeG
etterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_c
ast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts}, | |
| 276 {"initializedByEventConstructorReadonlyUint8ArrayAttribute", TestInterfaceEv
entConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttribu
teAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAUL
T), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToA
llScripts}, | |
| 277 {"initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", TestInt
erfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInter
faceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessCon
trol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigura
tion::ExposedToAllScripts}, | |
| 278 {"initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", Te
stInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTest
InterfaceEmptyArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8:
:AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DO
MConfiguration::ExposedToAllScripts}, | |
| 279 {"initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute",
TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyN
ullableTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_ca
st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)
, V8DOMConfiguration::ExposedToAllScripts}, | |
| 280 {"deprecatedInitializedByEventConstructorReadonlyStringAttribute", TestInter
faceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyS
tringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl
>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration
::ExposedToAllScripts}, | |
| 281 {"implementedAsInitializedByEventConstructorReadonlyStringAttribute", TestIn
terfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorRea
donlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessC
ontrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigu
ration::ExposedToAllScripts}, | |
| 282 {"deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribut
e", TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedB
yEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, sta
tic_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8:
:None), V8DOMConfiguration::ExposedToAllScripts}, | |
| 283 }; | |
| 284 | |
| 285 CORE_EXPORT bool initializeTestInterfaceEventConstructor(TestInterfaceEventConst
ructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState
, const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 286 { | |
| 287 Dictionary::ConversionContext conversionContext(exceptionState); | |
| 288 if (!initializeEvent(eventInit, options, exceptionState, info)) | |
| 289 return false; | |
| 290 | |
| 291 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"DOMString", false), "initializedByEventConstructorReadonlyStringAttribute", eve
ntInit.initializedByEventConstructorReadonlyStringAttribute)) | |
| 292 return false; | |
| 293 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"boolean", false), "initializedByEventConstructorReadonlyBooleanAttribute", even
tInit.initializedByEventConstructorReadonlyBooleanAttribute)) | |
| 294 return false; | |
| 295 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"long", false), "initializedByEventConstructorReadonlyLongAttribute", eventInit.
initializedByEventConstructorReadonlyLongAttribute)) | |
| 296 return false; | |
| 297 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"Uint8Array", false), "initializedByEventConstructorReadonlyUint8ArrayAttribute"
, eventInit.initializedByEventConstructorReadonlyUint8ArrayAttribute)) | |
| 298 return false; | |
| 299 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"TestInterfaceEmpty", false), "initializedByEventConstructorReadonlyTestInterfac
eEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEm
ptyAttribute)) | |
| 300 return false; | |
| 301 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"TestInterfaceEmpty[]", false), "initializedByEventConstructorReadonlyTestInterf
aceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInte
rfaceEmptyArrayAttribute)) | |
| 302 return false; | |
| 303 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"TestInterfaceEmpty", true), "initializedByEventConstructorReadonlyNullableTestI
nterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullable
TestInterfaceEmptyAttribute)) | |
| 304 return false; | |
| 305 if (DictionaryHelper::convert(options, conversionContext.setConversionType("
DOMString", false), "deprecatedInitializedByEventConstructorReadonlyStringAttrib
ute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute))
{ | |
| 306 if (options.hasProperty("deprecatedInitializedByEventConstructorReadonly
StringAttribute")) | |
| 307 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstruc
torReadonlyStringAttribute); | |
| 308 } else { | |
| 309 return false; | |
| 310 } | |
| 311 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"DOMString", false), "implementedAsInitializedByEventConstructorReadonlyStringAt
tribute", eventInit.implementedAsName)) | |
| 312 return false; | |
| 313 if (DictionaryHelper::convert(options, conversionContext.setConversionType("
DOMString", false), "deprecatedImplementedAsInitializedByEventConstructorReadonl
yStringAttribute", eventInit.deprecatedImplementedAsName)) { | |
| 314 if (options.hasProperty("deprecatedImplementedAsInitializedByEventConstr
uctorReadonlyStringAttribute")) | |
| 315 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), ca
llingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstruc
torReadonlyStringAttribute); | |
| 316 } else { | |
| 317 return false; | |
| 318 } | |
| 319 return true; | |
| 320 } | |
| 321 | |
| 322 void V8TestInterfaceEventConstructor::constructorCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | |
| 323 { | |
| 324 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
| 325 if (!info.IsConstructCall()) { | |
| 326 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::c
onstructorNotCallableAsFunction("TestInterfaceEventConstructor")); | |
| 327 return; | |
| 328 } | |
| 329 | |
| 330 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
| 331 v8SetReturnValue(info, info.Holder()); | |
| 332 return; | |
| 333 } | |
| 334 | |
| 335 TestInterfaceEventConstructorV8Internal::constructor(info); | |
| 336 } | |
| 337 | |
| 338 static void installV8TestInterfaceEventConstructorTemplate(v8::Local<v8::Functio
nTemplate> functionTemplate, v8::Isolate* isolate) | |
| 339 { | |
| 340 functionTemplate->ReadOnlyPrototype(); | |
| 341 | |
| 342 v8::Local<v8::Signature> defaultSignature; | |
| 343 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate), V8
TestInterfaceEventConstructor::internalFieldCount, | |
| 344 0, 0, | |
| 345 V8TestInterfaceEventConstructorAccessors, WTF_ARRAY_LENGTH(V8TestInterfa
ceEventConstructorAccessors), | |
| 346 0, 0); | |
| 347 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); | |
| 348 functionTemplate->SetLength(1); | |
| 349 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | |
| 350 ALLOW_UNUSED_LOCAL(instanceTemplate); | |
| 351 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | |
| 352 ALLOW_UNUSED_LOCAL(prototypeTemplate); | |
| 353 | |
| 354 // Custom toString template | |
| 355 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 356 } | |
| 357 | |
| 358 v8::Local<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8:
:Isolate* isolate) | |
| 359 { | |
| 360 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceEventConstructorTemplate); | |
| 361 } | |
| 362 | |
| 363 bool V8TestInterfaceEventConstructor::hasInstance(v8::Local<v8::Value> v8Value,
v8::Isolate* isolate) | |
| 364 { | |
| 365 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 366 } | |
| 367 | |
| 368 v8::Local<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeCh
ain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) | |
| 369 { | |
| 370 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 371 } | |
| 372 | |
| 373 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toImplWithTypeCh
eck(v8::Isolate* isolate, v8::Local<v8::Value> value) | |
| 374 { | |
| 375 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; | |
| 376 } | |
| 377 | |
| 378 void V8TestInterfaceEventConstructor::refObject(ScriptWrappable* scriptWrappable
) | |
| 379 { | |
| 380 #if !ENABLE(OILPAN) | |
| 381 scriptWrappable->toImpl<TestInterfaceEventConstructor>()->ref(); | |
| 382 #endif | |
| 383 } | |
| 384 | |
| 385 void V8TestInterfaceEventConstructor::derefObject(ScriptWrappable* scriptWrappab
le) | |
| 386 { | |
| 387 #if !ENABLE(OILPAN) | |
| 388 scriptWrappable->toImpl<TestInterfaceEventConstructor>()->deref(); | |
| 389 #endif | |
| 390 } | |
| 391 | |
| 392 } // namespace blink | |
| OLD | NEW |