| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 0, 0, | 500 0, 0, |
| 501 V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods), | 501 V8TestTypedefsMethods, WTF_ARRAY_LENGTH(V8TestTypedefsMethods), |
| 502 isolate, currentWorldType); | 502 isolate, currentWorldType); |
| 503 UNUSED_PARAM(defaultSignature); | 503 UNUSED_PARAM(defaultSignature); |
| 504 functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback); | 504 functionTemplate->SetCallHandler(V8TestTypedefs::constructorCallback); |
| 505 functionTemplate->SetLength(2); | 505 functionTemplate->SetLength(2); |
| 506 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 506 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 507 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 507 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 508 UNUSED_PARAM(instanceTemplate); | 508 UNUSED_PARAM(instanceTemplate); |
| 509 UNUSED_PARAM(prototypeTemplate); | 509 UNUSED_PARAM(prototypeTemplate); |
| 510 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("TestSubObj"),
TestTypedefsV8Internal::TestTypedefsConstructorGetter, 0, v8::External::New(iso
late, const_cast<WrapperTypeInfo*>(&V8TestSubObj::wrapperTypeInfo)), static_cast
<v8::PropertyAttribute>(v8::DontEnum), v8::Handle<v8::AccessorSignature>(), stat
ic_cast<v8::AccessControl>(v8::DEFAULT)); | 510 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "Te
stSubObj", v8::String::kInternalizedString), TestTypedefsV8Internal::TestTypedef
sConstructorGetter, 0, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&
V8TestSubObj::wrapperTypeInfo)), static_cast<v8::PropertyAttribute>(v8::DontEnum
), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAU
LT)); |
| 511 | 511 |
| 512 // Custom toString template | 512 // Custom toString template |
| 513 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 513 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 514 return functionTemplate; | 514 return functionTemplate; |
| 515 } | 515 } |
| 516 | 516 |
| 517 v8::Handle<v8::FunctionTemplate> V8TestTypedefs::GetTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | 517 v8::Handle<v8::FunctionTemplate> V8TestTypedefs::GetTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) |
| 518 { | 518 { |
| 519 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 519 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 520 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 520 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 521 if (result != data->templateMap(currentWorldType).end()) | 521 if (result != data->templateMap(currentWorldType).end()) |
| 522 return result->value.newLocal(isolate); | 522 return result->value.newLocal(isolate); |
| 523 | 523 |
| 524 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 524 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 525 v8::HandleScope handleScope(isolate); | 525 v8::EscapableHandleScope handleScope(isolate); |
| 526 v8::Handle<v8::FunctionTemplate> templ = | 526 v8::Local<v8::FunctionTemplate> templ = |
| 527 ConfigureV8TestTypedefsTemplate(data->rawTemplate(&wrapperTypeInfo, curr
entWorldType), isolate, currentWorldType); | 527 ConfigureV8TestTypedefsTemplate(data->rawTemplate(&wrapperTypeInfo, curr
entWorldType), isolate, currentWorldType); |
| 528 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 528 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 529 return handleScope.Close(templ); | 529 return handleScope.Escape(templ); |
| 530 } | 530 } |
| 531 | 531 |
| 532 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 532 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) |
| 533 { | 533 { |
| 534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool V8TestTypedefs::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Is
olate* isolate) | 537 bool V8TestTypedefs::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Is
olate* isolate) |
| 538 { | 538 { |
| 539 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 539 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 566 fromInternalPointer(object)->deref(); | 566 fromInternalPointer(object)->deref(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 template<> | 569 template<> |
| 570 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 570 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 571 { | 571 { |
| 572 return toV8(impl, creationContext, isolate); | 572 return toV8(impl, creationContext, isolate); |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace WebCore | 575 } // namespace WebCore |
| OLD | NEW |