OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 {"reflectStringAttribute", TestInterfaceNodeV8Internal::reflectStringAttribu
teAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectStringAttributeAt
tributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), sta
tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 311 {"reflectStringAttribute", TestInterfaceNodeV8Internal::reflectStringAttribu
teAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectStringAttributeAt
tributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), sta
tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
312 {"reflectUrlStringAttribute", TestInterfaceNodeV8Internal::reflectUrlStringA
ttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectUrlStringAt
tributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFA
ULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 312 {"reflectUrlStringAttribute", TestInterfaceNodeV8Internal::reflectUrlStringA
ttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectUrlStringAt
tributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFA
ULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
313 }; | 313 }; |
314 | 314 |
315 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNodeMethods[
] = { | 315 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNodeMethods[
] = { |
316 {"testInterfaceEmptyMethod", TestInterfaceNodeV8Internal::testInterfaceEmpty
MethodMethodCallback, 0, 0}, | 316 {"testInterfaceEmptyMethod", TestInterfaceNodeV8Internal::testInterfaceEmpty
MethodMethodCallback, 0, 0}, |
317 {"perWorldBindingsTestInterfaceEmptyMethod", TestInterfaceNodeV8Internal::pe
rWorldBindingsTestInterfaceEmptyMethodMethodCallback, TestInterfaceNodeV8Interna
l::perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld, 0}, | 317 {"perWorldBindingsTestInterfaceEmptyMethod", TestInterfaceNodeV8Internal::pe
rWorldBindingsTestInterfaceEmptyMethodMethodCallback, TestInterfaceNodeV8Interna
l::perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld, 0}, |
318 {"perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg", TestInterface
NodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod
Callback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodO
ptionalBooleanArgMethodCallbackForMainWorld, 0}, | 318 {"perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg", TestInterface
NodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod
Callback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodO
ptionalBooleanArgMethodCallbackForMainWorld, 0}, |
319 }; | 319 }; |
320 | 320 |
321 static void configureV8TestInterfaceNodeTemplate(v8::Handle<v8::FunctionTemplate
> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 321 static void configureV8TestInterfaceNodeTemplate(v8::Handle<v8::FunctionTemplate
> functionTemplate, v8::Isolate* isolate) |
322 { | 322 { |
323 functionTemplate->ReadOnlyPrototype(); | 323 functionTemplate->ReadOnlyPrototype(); |
324 | 324 |
325 v8::Local<v8::Signature> defaultSignature; | 325 v8::Local<v8::Signature> defaultSignature; |
326 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNode", V8Node::domTemplate(isolate, currentWorldType), V8Test
InterfaceNode::internalFieldCount, | 326 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNode", V8Node::domTemplate(isolate), V8TestInterfaceNode::int
ernalFieldCount, |
327 V8TestInterfaceNodeAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNodeAttri
butes), | 327 V8TestInterfaceNodeAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNodeAttri
butes), |
328 0, 0, | 328 0, 0, |
329 V8TestInterfaceNodeMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNodeMethods)
, | 329 V8TestInterfaceNodeMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNodeMethods)
, |
330 isolate, currentWorldType); | 330 isolate); |
331 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 331 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
332 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 332 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
333 | 333 |
334 // Custom toString template | 334 // Custom toString template |
335 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 335 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
336 } | 336 } |
337 | 337 |
338 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNode::domTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) | 338 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNode::domTemplate(v8::Isolate* i
solate) |
339 { | 339 { |
340 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 340 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
341 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 341 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
342 if (result != data->templateMap(currentWorldType).end()) | 342 if (result != data->templateMap().end()) |
343 return result->value.newLocal(isolate); | 343 return result->value.newLocal(isolate); |
344 | 344 |
345 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 345 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
346 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 346 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
347 configureV8TestInterfaceNodeTemplate(templ, isolate, currentWorldType); | 347 configureV8TestInterfaceNodeTemplate(templ, isolate); |
348 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 348 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
349 return templ; | 349 return templ; |
350 } | 350 } |
351 | 351 |
352 bool V8TestInterfaceNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate) | 352 bool V8TestInterfaceNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate) |
353 { | 353 { |
354 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 354 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
355 } | 355 } |
356 | 356 |
357 v8::Handle<v8::Object> V8TestInterfaceNode::findInstanceInPrototypeChain(v8::Han
dle<v8::Value> jsValue, v8::Isolate* isolate) | 357 v8::Handle<v8::Object> V8TestInterfaceNode::findInstanceInPrototypeChain(v8::Han
dle<v8::Value> jsValue, v8::Isolate* isolate) |
358 { | 358 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 fromInternalPointer(object)->deref(); | 394 fromInternalPointer(object)->deref(); |
395 } | 395 } |
396 | 396 |
397 template<> | 397 template<> |
398 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNode* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) | 398 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNode* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) |
399 { | 399 { |
400 return toV8(impl, creationContext, isolate); | 400 return toV8(impl, creationContext, isolate); |
401 } | 401 } |
402 | 402 |
403 } // namespace WebCore | 403 } // namespace WebCore |
OLD | NEW |