| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 438 } |
| 439 | 439 |
| 440 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 440 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 441 v8SetReturnValue(info, info.Holder()); | 441 v8SetReturnValue(info, info.Holder()); |
| 442 return; | 442 return; |
| 443 } | 443 } |
| 444 | 444 |
| 445 TestTypedefsV8Internal::constructor(info); | 445 TestTypedefsV8Internal::constructor(info); |
| 446 } | 446 } |
| 447 | 447 |
| 448 static void configureV8TestTypedefsTemplate(v8::Handle<v8::FunctionTemplate> fun
ctionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 448 static void configureV8TestTypedefsTemplate(v8::Handle<v8::FunctionTemplate> fun
ctionTemplate, v8::Isolate* isolate) |
| 449 { | 449 { |
| 450 functionTemplate->ReadOnlyPrototype(); | 450 functionTemplate->ReadOnlyPrototype(); |
| 451 | 451 |
| 452 v8::Local<v8::Signature> defaultSignature; | 452 v8::Local<v8::Signature> defaultSignature; |
| 453 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestTypedefs", v8::Local<v8::FunctionTemplate>(), V8TestTypedefs::internal
FieldCount, | 453 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestTypedefs", v8::Local<v8::FunctionTemplate>(), V8TestTypedefs::internal
FieldCount, |
| 454 V8TestTypedefsAttributes, WTF_ARRAY_LENGTH(V8TestTypedefsAttributes), | 454 V8TestTypedefsAttributes, WTF_ARRAY_LENGTH(V8TestTypedefsAttributes), |
| 455 0, 0, | 455 0, 0, |
| 456 V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods), | 456 V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods), |
| 457 isolate, currentWorldType); | 457 isolate); |
| 458 functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback); | 458 functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback); |
| 459 functionTemplate->SetLength(1); | 459 functionTemplate->SetLength(1); |
| 460 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 460 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 461 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 461 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 462 | 462 |
| 463 // Custom toString template | 463 // Custom toString template |
| 464 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 464 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 v8::Handle<v8::FunctionTemplate> V8TestTypedefs::domTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | 467 v8::Handle<v8::FunctionTemplate> V8TestTypedefs::domTemplate(v8::Isolate* isolat
e) |
| 468 { | 468 { |
| 469 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 469 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 470 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 470 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 471 if (result != data->templateMap(currentWorldType).end()) | 471 if (result != data->templateMap().end()) |
| 472 return result->value.newLocal(isolate); | 472 return result->value.newLocal(isolate); |
| 473 | 473 |
| 474 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 474 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 475 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 475 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 476 configureV8TestTypedefsTemplate(templ, isolate, currentWorldType); | 476 configureV8TestTypedefsTemplate(templ, isolate); |
| 477 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 477 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 478 return templ; | 478 return templ; |
| 479 } | 479 } |
| 480 | 480 |
| 481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late) | 481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late) |
| 482 { | 482 { |
| 483 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 483 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 484 } | 484 } |
| 485 | 485 |
| 486 v8::Handle<v8::Object> V8TestTypedefs::findInstanceInPrototypeChain(v8::Handle<v
8::Value> jsValue, v8::Isolate* isolate) | 486 v8::Handle<v8::Object> V8TestTypedefs::findInstanceInPrototypeChain(v8::Handle<v
8::Value> jsValue, v8::Isolate* isolate) |
| 487 { | 487 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 518 fromInternalPointer(object)->deref(); | 518 fromInternalPointer(object)->deref(); |
| 519 } | 519 } |
| 520 | 520 |
| 521 template<> | 521 template<> |
| 522 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 522 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 523 { | 523 { |
| 524 return toV8(impl, creationContext, isolate); | 524 return toV8(impl, creationContext, isolate); |
| 525 } | 525 } |
| 526 | 526 |
| 527 } // namespace WebCore | 527 } // namespace WebCore |
| OLD | NEW |