| 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 "V8TestTypedefs.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 "bindings/tests/v8/V8TestCallbackInterface.h" | |
| 15 #include "bindings/tests/v8/V8TestInterface.h" | |
| 16 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" | |
| 17 #include "core/dom/ContextFeatures.h" | |
| 18 #include "core/dom/Document.h" | |
| 19 #include "core/frame/LocalDOMWindow.h" | |
| 20 #include "platform/RuntimeEnabledFeatures.h" | |
| 21 #include "platform/TraceEvent.h" | |
| 22 #include "wtf/GetPtr.h" | |
| 23 #include "wtf/RefPtr.h" | |
| 24 | |
| 25 namespace blink { | |
| 26 | |
| 27 const WrapperTypeInfo V8TestTypedefs::wrapperTypeInfo = { gin::kEmbedderBlink, V
8TestTypedefs::domTemplate, V8TestTypedefs::refObject, V8TestTypedefs::derefObje
ct, V8TestTypedefs::createPersistentHandle, 0, 0, 0, V8TestTypedefs::installCond
itionallyEnabledMethods, V8TestTypedefs::installConditionallyEnabledProperties,
0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId,
WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; | |
| 28 | |
| 29 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestTypedefs
.h. | |
| 30 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 31 // bindings/core/v8/ScriptWrappable.h. | |
| 32 const WrapperTypeInfo& TestTypedefs::s_wrapperTypeInfo = V8TestTypedefs::wrapper
TypeInfo; | |
| 33 | |
| 34 namespace TestTypedefsV8Internal { | |
| 35 | |
| 36 template <typename T> void V8_USE(T) { } | |
| 37 | |
| 38 static void uLongLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8:
:Value>& info) | |
| 39 { | |
| 40 v8::Handle<v8::Object> holder = info.Holder(); | |
| 41 TestTypedefs* impl = V8TestTypedefs::toImpl(holder); | |
| 42 v8SetReturnValue(info, static_cast<double>(impl->uLongLongAttribute())); | |
| 43 } | |
| 44 | |
| 45 static void uLongLongAttributeAttributeGetterCallback(v8::Local<v8::String>, con
st v8::PropertyCallbackInfo<v8::Value>& info) | |
| 46 { | |
| 47 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 48 TestTypedefsV8Internal::uLongLongAttributeAttributeGetter(info); | |
| 49 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 50 } | |
| 51 | |
| 52 static void uLongLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, cons
t v8::PropertyCallbackInfo<void>& info) | |
| 53 { | |
| 54 v8::Handle<v8::Object> holder = info.Holder(); | |
| 55 ExceptionState exceptionState(ExceptionState::SetterContext, "uLongLongAttri
bute", "TestTypedefs", holder, info.GetIsolate()); | |
| 56 TestTypedefs* impl = V8TestTypedefs::toImpl(holder); | |
| 57 TONATIVE_VOID_EXCEPTIONSTATE(unsigned long long, cppValue, toUInt64(v8Value,
exceptionState), exceptionState); | |
| 58 impl->setULongLongAttribute(cppValue); | |
| 59 } | |
| 60 | |
| 61 static void uLongLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8:
:Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 62 { | |
| 63 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 64 TestTypedefsV8Internal::uLongLongAttributeAttributeSetter(v8Value, info); | |
| 65 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 66 } | |
| 67 | |
| 68 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope
rtyCallbackInfo<v8::Value>& info) | |
| 69 { | |
| 70 v8::Handle<v8::Value> data = info.Data(); | |
| 71 ASSERT(data->IsExternal()); | |
| 72 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | |
| 73 if (!perContextData) | |
| 74 return; | |
| 75 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | |
| 76 } | |
| 77 | |
| 78 static void TestTypedefsForceSetAttributeOnThis(v8::Local<v8::String> name, v8::
Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 79 { | |
| 80 if (info.This()->IsObject()) | |
| 81 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | |
| 82 } | |
| 83 | |
| 84 static void TestTypedefsForceSetAttributeOnThisCallback(v8::Local<v8::String> na
me, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 85 { | |
| 86 TestTypedefsV8Internal::TestTypedefsForceSetAttributeOnThis(name, v8Value, i
nfo); | |
| 87 } | |
| 88 | |
| 89 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V
alue>& info) | |
| 90 { | |
| 91 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 92 Vector<int> arrayOfLongsArg; | |
| 93 { | |
| 94 v8::TryCatch block; | |
| 95 V8RethrowTryCatchScope rethrow(block); | |
| 96 if (UNLIKELY(info.Length() <= 0)) { | |
| 97 impl->voidMethodArrayOfLongsArg(); | |
| 98 return; | |
| 99 } | |
| 100 TONATIVE_VOID_INTERNAL(arrayOfLongsArg, toImplArray<int>(info[0], 1, inf
o.GetIsolate())); | |
| 101 } | |
| 102 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg); | |
| 103 } | |
| 104 | |
| 105 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn
fo<v8::Value>& info) | |
| 106 { | |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 108 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info); | |
| 109 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 110 } | |
| 111 | |
| 112 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8:
:Value>& info) | |
| 113 { | |
| 114 if (UNLIKELY(info.Length() < 2)) { | |
| 115 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v
oidMethodFloatArgStringArg", "TestTypedefs", 2, info.Length(), info.GetIsolate()
), info.GetIsolate()); | |
| 116 return; | |
| 117 } | |
| 118 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 119 float floatArg; | |
| 120 V8StringResource<> stringArg; | |
| 121 { | |
| 122 v8::TryCatch block; | |
| 123 V8RethrowTryCatchScope rethrow(block); | |
| 124 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[0]->NumberValue
())); | |
| 125 TOSTRING_VOID_INTERNAL(stringArg, info[1]); | |
| 126 } | |
| 127 impl->voidMethodFloatArgStringArg(floatArg, stringArg); | |
| 128 } | |
| 129 | |
| 130 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback
Info<v8::Value>& info) | |
| 131 { | |
| 132 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 133 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info); | |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 135 } | |
| 136 | |
| 137 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb
ackInfo<v8::Value>& info) | |
| 138 { | |
| 139 if (UNLIKELY(info.Length() < 1)) { | |
| 140 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v
oidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", 1, info.Length(), info.G
etIsolate()), info.GetIsolate()); | |
| 141 return; | |
| 142 } | |
| 143 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 144 OwnPtrWillBeRawPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = nul
lptr;; | |
| 145 { | |
| 146 if (info.Length() <= 0 || !info[0]->IsFunction()) { | |
| 147 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute(
"voidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", "The callback provided
as parameter 1 is not a function."), info.GetIsolate()); | |
| 148 return; | |
| 149 } | |
| 150 testCallbackInterfaceTypeArg = V8TestCallbackInterface::create(v8::Handl
e<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate())); | |
| 151 } | |
| 152 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re
lease()); | |
| 153 } | |
| 154 | |
| 155 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct
ionCallbackInfo<v8::Value>& info) | |
| 156 { | |
| 157 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 158 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info); | |
| 159 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 160 } | |
| 161 | |
| 162 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun
ctionCallbackInfo<v8::Value>& info) | |
| 163 { | |
| 164 if (UNLIKELY(info.Length() < 1)) { | |
| 165 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("u
LongLongMethodTestInterfaceEmptyTypeSequenceArg", "TestTypedefs", 1, info.Length
(), info.GetIsolate()), info.GetIsolate()); | |
| 166 return; | |
| 167 } | |
| 168 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 169 Vector<RefPtr<TestInterfaceEmpty> > testInterfaceEmptyTypeSequenceArg; | |
| 170 { | |
| 171 v8::TryCatch block; | |
| 172 V8RethrowTryCatchScope rethrow(block); | |
| 173 TONATIVE_VOID_INTERNAL(testInterfaceEmptyTypeSequenceArg, (toRefPtrNativ
eArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate()))
); | |
| 174 } | |
| 175 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac
eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); | |
| 176 } | |
| 177 | |
| 178 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const
v8::FunctionCallbackInfo<v8::Value>& info) | |
| 179 { | |
| 180 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 181 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth
od(info); | |
| 182 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 183 } | |
| 184 | |
| 185 static void testInterfaceOrTestInterfaceEmptyMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | |
| 186 { | |
| 187 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 188 RefPtr<TestInterfaceImplementation> result0 = nullptr; | |
| 189 RefPtr<TestInterfaceEmpty> result1 = nullptr; | |
| 190 impl->testInterfaceOrTestInterfaceEmptyMethod(result0, result1); | |
| 191 if (result0) { | |
| 192 v8SetReturnValue(info, result0.release()); | |
| 193 return; | |
| 194 } | |
| 195 if (result1) { | |
| 196 v8SetReturnValue(info, result1.release()); | |
| 197 return; | |
| 198 } | |
| 199 v8SetReturnValueNull(info); | |
| 200 } | |
| 201 | |
| 202 static void testInterfaceOrTestInterfaceEmptyMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | |
| 203 { | |
| 204 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 205 TestTypedefsV8Internal::testInterfaceOrTestInterfaceEmptyMethodMethod(info); | |
| 206 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 207 } | |
| 208 | |
| 209 static void domStringOrDoubleMethodMethod(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | |
| 210 { | |
| 211 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 212 String result0; | |
| 213 Nullable<double> result1; | |
| 214 impl->domStringOrDoubleMethod(result0, result1); | |
| 215 if (!result0.isNull()) { | |
| 216 v8SetReturnValueString(info, result0, info.GetIsolate()); | |
| 217 return; | |
| 218 } | |
| 219 if (result1) { | |
| 220 v8SetReturnValue(info, result1.get()); | |
| 221 return; | |
| 222 } | |
| 223 v8SetReturnValueNull(info); | |
| 224 } | |
| 225 | |
| 226 static void domStringOrDoubleMethodMethodCallback(const v8::FunctionCallbackInfo
<v8::Value>& info) | |
| 227 { | |
| 228 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 229 TestTypedefsV8Internal::domStringOrDoubleMethodMethod(info); | |
| 230 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 231 } | |
| 232 | |
| 233 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba
ckInfo<v8::Value>& info) | |
| 234 { | |
| 235 if (UNLIKELY(info.Length() < 1)) { | |
| 236 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("a
rrayOfStringsMethodArrayOfStringsArg", "TestTypedefs", 1, info.Length(), info.Ge
tIsolate()), info.GetIsolate()); | |
| 237 return; | |
| 238 } | |
| 239 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 240 Vector<String> arrayOfStringsArg; | |
| 241 { | |
| 242 v8::TryCatch block; | |
| 243 V8RethrowTryCatchScope rethrow(block); | |
| 244 TONATIVE_VOID_INTERNAL(arrayOfStringsArg, toImplArray<String>(info[0], 1
, info.GetIsolate())); | |
| 245 } | |
| 246 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a
rrayOfStringsArg), info.Holder(), info.GetIsolate())); | |
| 247 } | |
| 248 | |
| 249 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi
onCallbackInfo<v8::Value>& info) | |
| 250 { | |
| 251 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 252 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); | |
| 253 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 254 } | |
| 255 | |
| 256 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) | |
| 257 { | |
| 258 if (UNLIKELY(info.Length() < 1)) { | |
| 259 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("s
tringArrayMethodStringArrayArg", "TestTypedefs", 1, info.Length(), info.GetIsola
te()), info.GetIsolate()); | |
| 260 return; | |
| 261 } | |
| 262 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); | |
| 263 Vector<String> stringArrayArg; | |
| 264 { | |
| 265 v8::TryCatch block; | |
| 266 V8RethrowTryCatchScope rethrow(block); | |
| 267 TONATIVE_VOID_INTERNAL(stringArrayArg, toImplArray<String>(info[0], 1, i
nfo.GetIsolate())); | |
| 268 } | |
| 269 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA
rrayArg), info.Holder(), info.GetIsolate())); | |
| 270 } | |
| 271 | |
| 272 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | |
| 273 { | |
| 274 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 275 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); | |
| 276 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 277 } | |
| 278 | |
| 279 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 280 { | |
| 281 if (UNLIKELY(info.Length() < 1)) { | |
| 282 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct
or("TestTypedefs", 1, info.Length(), info.GetIsolate()), info.GetIsolate()); | |
| 283 return; | |
| 284 } | |
| 285 V8StringResource<> stringArg; | |
| 286 { | |
| 287 TOSTRING_VOID_INTERNAL(stringArg, info[0]); | |
| 288 } | |
| 289 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); | |
| 290 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 291 impl->associateWithWrapper(&V8TestTypedefs::wrapperTypeInfo, wrapper, info.G
etIsolate()); | |
| 292 v8SetReturnValue(info, wrapper); | |
| 293 } | |
| 294 | |
| 295 } // namespace TestTypedefsV8Internal | |
| 296 | |
| 297 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes
[] = { | |
| 298 {"uLongLongAttribute", TestTypedefsV8Internal::uLongLongAttributeAttributeGe
tterCallback, TestTypedefsV8Internal::uLongLongAttributeAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA
ttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration
::OnInstance}, | |
| 299 {"tAttribute", TestTypedefsV8Internal::TestTypedefsConstructorGetter, TestTy
pedefsV8Internal::TestTypedefsForceSetAttributeOnThisCallback, 0, 0, const_cast<
WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cast<v8::AccessCont
rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfig
uration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 300 }; | |
| 301 | |
| 302 static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = { | |
| 303 {"voidMethodArrayOfLongsArg", TestTypedefsV8Internal::voidMethodArrayOfLongs
ArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, | |
| 304 {"voidMethodFloatArgStringArg", TestTypedefsV8Internal::voidMethodFloatArgSt
ringArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, | |
| 305 {"voidMethodTestCallbackInterfaceTypeArg", TestTypedefsV8Internal::voidMetho
dTestCallbackInterfaceTypeArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedTo
AllScripts}, | |
| 306 {"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", TestTypedefsV8Internal:
:uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, 0, 1, V8DOMConf
iguration::ExposedToAllScripts}, | |
| 307 {"testInterfaceOrTestInterfaceEmptyMethod", TestTypedefsV8Internal::testInte
rfaceOrTestInterfaceEmptyMethodMethodCallback, 0, 0, V8DOMConfiguration::Exposed
ToAllScripts}, | |
| 308 {"domStringOrDoubleMethod", TestTypedefsV8Internal::domStringOrDoubleMethodM
ethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, | |
| 309 {"arrayOfStringsMethodArrayOfStringsArg", TestTypedefsV8Internal::arrayOfStr
ingsMethodArrayOfStringsArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAl
lScripts}, | |
| 310 {"stringArrayMethodStringArrayArg", TestTypedefsV8Internal::stringArrayMetho
dStringArrayArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, | |
| 311 }; | |
| 312 | |
| 313 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | |
| 314 { | |
| 315 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
| 316 if (!info.IsConstructCall()) { | |
| 317 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("TestTypedefs"), info.GetIsolate()); | |
| 318 return; | |
| 319 } | |
| 320 | |
| 321 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
| 322 v8SetReturnValue(info, info.Holder()); | |
| 323 return; | |
| 324 } | |
| 325 | |
| 326 TestTypedefsV8Internal::constructor(info); | |
| 327 } | |
| 328 | |
| 329 static void installV8TestTypedefsTemplate(v8::Handle<v8::FunctionTemplate> funct
ionTemplate, v8::Isolate* isolate) | |
| 330 { | |
| 331 functionTemplate->ReadOnlyPrototype(); | |
| 332 | |
| 333 v8::Local<v8::Signature> defaultSignature; | |
| 334 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestTypedefs", v8::Local<v8::FunctionTemplate>(), V8TestTypedefs::internal
FieldCount, | |
| 335 V8TestTypedefsAttributes, WTF_ARRAY_LENGTH(V8TestTypedefsAttributes), | |
| 336 0, 0, | |
| 337 V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods), | |
| 338 isolate); | |
| 339 functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback); | |
| 340 functionTemplate->SetLength(1); | |
| 341 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 342 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 343 | |
| 344 // Custom toString template | |
| 345 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 346 } | |
| 347 | |
| 348 v8::Handle<v8::FunctionTemplate> V8TestTypedefs::domTemplate(v8::Isolate* isolat
e) | |
| 349 { | |
| 350 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestTypedefsTemplate); | |
| 351 } | |
| 352 | |
| 353 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* iso
late) | |
| 354 { | |
| 355 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 356 } | |
| 357 | |
| 358 v8::Handle<v8::Object> V8TestTypedefs::findInstanceInPrototypeChain(v8::Handle<v
8::Value> v8Value, v8::Isolate* isolate) | |
| 359 { | |
| 360 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 361 } | |
| 362 | |
| 363 TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Hand
le<v8::Value> value) | |
| 364 { | |
| 365 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestTypedefs>() : 0; | |
| 366 } | |
| 367 | |
| 368 | |
| 369 void V8TestTypedefs::refObject(ScriptWrappableBase* internalPointer) | |
| 370 { | |
| 371 internalPointer->toImpl<TestTypedefs>()->ref(); | |
| 372 } | |
| 373 | |
| 374 void V8TestTypedefs::derefObject(ScriptWrappableBase* internalPointer) | |
| 375 { | |
| 376 internalPointer->toImpl<TestTypedefs>()->deref(); | |
| 377 } | |
| 378 | |
| 379 WrapperPersistentNode* V8TestTypedefs::createPersistentHandle(ScriptWrappableBas
e* internalPointer) | |
| 380 { | |
| 381 ASSERT_NOT_REACHED(); | |
| 382 return 0; | |
| 383 } | |
| 384 | |
| 385 template<> | |
| 386 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | |
| 387 { | |
| 388 return toV8(impl, creationContext, isolate); | |
| 389 } | |
| 390 | |
| 391 } // namespace blink | |
| OLD | NEW |