| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 {"SUPPLEMENTALCONSTANT2", 2}, | 425 {"SUPPLEMENTALCONSTANT2", 2}, |
| 426 }; | 426 }; |
| 427 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
SupportTestInterfaceConstants, WTF_ARRAY_LENGTH(V8SupportTestInterfaceConstants)
, isolate); | 427 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
SupportTestInterfaceConstants, WTF_ARRAY_LENGTH(V8SupportTestInterfaceConstants)
, isolate); |
| 428 COMPILE_ASSERT(1 == SupportTestPartialInterface::SUPPLEMENTALCONSTANT1, TheV
alueOfSupportTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation); | 428 COMPILE_ASSERT(1 == SupportTestPartialInterface::SUPPLEMENTALCONSTANT1, TheV
alueOfSupportTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation); |
| 429 COMPILE_ASSERT(2 == SupportTestPartialInterface::CONST_IMPL, TheValueOfSuppo
rtTestInterface_CONST_IMPLDoesntMatchWithImplementation); | 429 COMPILE_ASSERT(2 == SupportTestPartialInterface::CONST_IMPL, TheValueOfSuppo
rtTestInterface_CONST_IMPLDoesntMatchWithImplementation); |
| 430 #if ENABLE(Condition11) || ENABLE(Condition12) | 430 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 431 | 431 |
| 432 // Custom Signature 'supplementalMethod2' | 432 // Custom Signature 'supplementalMethod2' |
| 433 const int supplementalMethod2Argc = 2; | 433 const int supplementalMethod2Argc = 2; |
| 434 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2
Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r
awTemplate(&V8TestObject::wrapperTypeInfo, currentWorldType) }; | 434 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2
Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r
awTemplate(&V8TestObject::wrapperTypeInfo, currentWorldType) }; |
| 435 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(
functionTemplate, supplementalMethod2Argc, supplementalMethod2Argv); | 435 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(
isolate, functionTemplate, supplementalMethod2Argc, supplementalMethod2Argv); |
| 436 prototypeTemplate->Set(v8::String::NewSymbol("supplementalMethod2"), v8::Fun
ctionTemplate::New(SupportTestInterfaceV8Internal::supplementalMethod2MethodCall
back, v8Undefined(), supplementalMethod2Signature, 2)); | 436 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "supplementalMethod2
", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, SupportT
estInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined(), supple
mentalMethod2Signature, 2)); |
| 437 #endif // ENABLE(Condition11) || ENABLE(Condition12) | 437 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 438 #if ENABLE(Condition11) || ENABLE(Condition12) | 438 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 439 functionTemplate->Set(v8::String::NewSymbol("supplementalMethod4"), v8::Func
tionTemplate::New(SupportTestInterfaceV8Internal::supplementalMethod4MethodCallb
ack, v8Undefined(), v8::Local<v8::Signature>(), 0)); | 439 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "supplementalMethod4"
, v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, SupportTe
stInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Loc
al<v8::Signature>(), 0)); |
| 440 #endif // ENABLE(Condition11) || ENABLE(Condition12) | 440 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 441 #if ENABLE(Condition11) || ENABLE(Condition12) | 441 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 442 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("supplementalS
taticReadOnlyAttr"), SupportTestInterfaceV8Internal::supplementalStaticReadOnlyA
ttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::Pr
opertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8:
:AccessControl>(v8::DEFAULT)); | 442 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su
pplementalStaticReadOnlyAttr", v8::String::kInternalizedString), SupportTestInte
rfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::E
xternal::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Hand
le<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 443 #endif // ENABLE(Condition11) || ENABLE(Condition12) | 443 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 444 #if ENABLE(Condition11) || ENABLE(Condition12) | 444 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 445 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("supplementalS
taticAttr"), SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeGett
erCallback, SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeSette
rCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8:
:None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::
DEFAULT)); | 445 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su
pplementalStaticAttr", v8::String::kInternalizedString), SupportTestInterfaceV8I
nternal::supplementalStaticAttrAttributeGetterCallback, SupportTestInterfaceV8In
ternal::supplementalStaticAttrAttributeSetterCallback, v8::External::New(isolate
, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSigna
ture>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 446 #endif // ENABLE(Condition11) || ENABLE(Condition12) | 446 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 447 | 447 |
| 448 // Custom toString template | 448 // Custom toString template |
| 449 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 449 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 450 return functionTemplate; | 450 return functionTemplate; |
| 451 } | 451 } |
| 452 | 452 |
| 453 v8::Handle<v8::FunctionTemplate> V8SupportTestInterface::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 453 v8::Handle<v8::FunctionTemplate> V8SupportTestInterface::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 454 { | 454 { |
| 455 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 455 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 456 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 456 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 457 if (result != data->templateMap(currentWorldType).end()) | 457 if (result != data->templateMap(currentWorldType).end()) |
| 458 return result->value.newLocal(isolate); | 458 return result->value.newLocal(isolate); |
| 459 | 459 |
| 460 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 460 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 461 v8::HandleScope handleScope(isolate); | 461 v8::EscapableHandleScope handleScope(isolate); |
| 462 v8::Handle<v8::FunctionTemplate> templ = | 462 v8::Local<v8::FunctionTemplate> templ = |
| 463 ConfigureV8SupportTestInterfaceTemplate(data->rawTemplate(&wrapperTypeIn
fo, currentWorldType), isolate, currentWorldType); | 463 ConfigureV8SupportTestInterfaceTemplate(data->rawTemplate(&wrapperTypeIn
fo, currentWorldType), isolate, currentWorldType); |
| 464 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 464 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 465 return handleScope.Close(templ); | 465 return handleScope.Escape(templ); |
| 466 } | 466 } |
| 467 | 467 |
| 468 bool V8SupportTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) | 468 bool V8SupportTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) |
| 469 { | 469 { |
| 470 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 470 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 471 } | 471 } |
| 472 | 472 |
| 473 bool V8SupportTestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 473 bool V8SupportTestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 474 { | 474 { |
| 475 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 475 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 fromInternalPointer(object)->deref(); | 512 fromInternalPointer(object)->deref(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 template<> | 515 template<> |
| 516 v8::Handle<v8::Value> toV8NoInline(SupportTestInterface* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 516 v8::Handle<v8::Value> toV8NoInline(SupportTestInterface* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 517 { | 517 { |
| 518 return toV8(impl, creationContext, isolate); | 518 return toV8(impl, creationContext, isolate); |
| 519 } | 519 } |
| 520 | 520 |
| 521 } // namespace WebCore | 521 } // namespace WebCore |
| OLD | NEW |