OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 #include "V8TestInterface2.h" | 8 #include "V8TestInterface2.h" |
9 | 9 |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 465 |
466 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 466 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
467 { | 467 { |
468 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | 468 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
469 TestInterface2V8Internal::indexedPropertyDeleter(index, info); | 469 TestInterface2V8Internal::indexedPropertyDeleter(index, info); |
470 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 470 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
471 } | 471 } |
472 | 472 |
473 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) | 473 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) |
474 { | 474 { |
475 if (!name->IsString()) | |
476 return; | |
477 auto nameString = name.As<v8::String>(); | 475 auto nameString = name.As<v8::String>(); |
478 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); | |
479 if (v8CallBoolean(info.Holder()->HasRealNamedProperty(context, nameString))) | |
480 return; | |
481 v8::Local<v8::Value> namedPropertyValue; | |
482 if (info.Holder()->GetRealNamedPropertyInPrototypeChain(context, nameString)
.ToLocal(&namedPropertyValue)) | |
483 return; | |
484 | |
485 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); | 476 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
486 AtomicString propertyName = toCoreAtomicString(nameString); | 477 AtomicString propertyName = toCoreAtomicString(nameString); |
487 v8::String::Utf8Value namedProperty(nameString); | 478 v8::String::Utf8Value namedProperty(nameString); |
488 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 479 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
489 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); | 480 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); |
490 if (exceptionState.throwIfNeeded()) | 481 if (exceptionState.throwIfNeeded()) |
491 return; | 482 return; |
492 if (!result) | 483 if (!result) |
493 return; | 484 return; |
494 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); | 485 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
495 } | 486 } |
496 | 487 |
497 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) | 488 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
498 { | 489 { |
499 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 490 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
500 TestInterface2V8Internal::namedPropertyGetter(name, info); | 491 TestInterface2V8Internal::namedPropertyGetter(name, info); |
501 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 492 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
502 } | 493 } |
503 | 494 |
504 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 495 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
505 { | 496 { |
506 if (!name->IsString()) | |
507 return; | |
508 auto nameString = name.As<v8::String>(); | 497 auto nameString = name.As<v8::String>(); |
509 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); | |
510 if (v8CallBoolean(info.Holder()->HasRealNamedProperty(context, nameString))) | |
511 return; | |
512 v8::Local<v8::Value> namedPropertyValue; | |
513 if (info.Holder()->GetRealNamedPropertyInPrototypeChain(context, nameString)
.ToLocal(&namedPropertyValue)) | |
514 return; | |
515 | |
516 v8::String::Utf8Value namedProperty(nameString); | 498 v8::String::Utf8Value namedProperty(nameString); |
517 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 499 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
518 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); | 500 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
519 V8StringResource<> propertyName(nameString); | 501 V8StringResource<> propertyName(nameString); |
520 if (!propertyName.prepare()) | 502 if (!propertyName.prepare()) |
521 return; | 503 return; |
522 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec
k(info.GetIsolate(), v8Value); | 504 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec
k(info.GetIsolate(), v8Value); |
523 if (!propertyValue && !isUndefinedOrNull(v8Value)) { | 505 if (!propertyValue && !isUndefinedOrNull(v8Value)) { |
524 exceptionState.throwTypeError("The provided value is not of type 'TestIn
terfaceEmpty'."); | 506 exceptionState.throwTypeError("The provided value is not of type 'TestIn
terfaceEmpty'."); |
525 exceptionState.throwIfNeeded(); | 507 exceptionState.throwIfNeeded(); |
526 return; | 508 return; |
527 } | 509 } |
528 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); | 510 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); |
529 if (exceptionState.throwIfNeeded()) | 511 if (exceptionState.throwIfNeeded()) |
530 return; | 512 return; |
531 if (!result) | 513 if (!result) |
532 return; | 514 return; |
533 v8SetReturnValue(info, v8Value); | 515 v8SetReturnValue(info, v8Value); |
534 } | 516 } |
535 | 517 |
536 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 518 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
537 { | 519 { |
538 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 520 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
539 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info); | 521 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info); |
540 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 522 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
541 } | 523 } |
542 | 524 |
543 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) | 525 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) |
544 { | 526 { |
545 if (!name->IsString()) | |
546 return; | |
547 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); | 527 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
548 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 528 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
549 v8::String::Utf8Value namedProperty(name); | 529 v8::String::Utf8Value namedProperty(name); |
550 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 530 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
551 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | 531 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
552 if (exceptionState.throwIfNeeded()) | 532 if (exceptionState.throwIfNeeded()) |
553 return; | 533 return; |
554 if (!result) | 534 if (!result) |
555 return; | 535 return; |
556 v8SetReturnValueInt(info, v8::None); | 536 v8SetReturnValueInt(info, v8::None); |
557 } | 537 } |
558 | 538 |
559 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
rtyCallbackInfo<v8::Integer>& info) | 539 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
rtyCallbackInfo<v8::Integer>& info) |
560 { | 540 { |
561 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 541 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
562 TestInterface2V8Internal::namedPropertyQuery(name, info); | 542 TestInterface2V8Internal::namedPropertyQuery(name, info); |
563 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 543 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
564 } | 544 } |
565 | 545 |
566 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 546 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
567 { | 547 { |
568 if (!name->IsString()) | |
569 return; | |
570 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); | 548 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
571 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 549 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
572 v8::String::Utf8Value namedProperty(name); | 550 v8::String::Utf8Value namedProperty(name); |
573 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestInterface2", info.Holder(), info.GetIsolate()); | 551 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestInterface2", info.Holder(), info.GetIsolate()); |
574 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); | 552 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); |
575 if (exceptionState.throwIfNeeded()) | 553 if (exceptionState.throwIfNeeded()) |
576 return; | 554 return; |
577 if (result != DeleteUnknownProperty) | 555 if (result != DeleteUnknownProperty) |
578 return v8SetReturnValueBool(info, result == DeleteSuccess); | 556 return v8SetReturnValueBool(info, result == DeleteSuccess); |
579 } | 557 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 static const V8DOMConfiguration::ConstantConfiguration constantConfigura
tion = {"CONST_VALUE_1", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}
; | 649 static const V8DOMConfiguration::ConstantConfiguration constantConfigura
tion = {"CONST_VALUE_1", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}
; |
672 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototype
Template, constantConfiguration); | 650 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototype
Template, constantConfiguration); |
673 } | 651 } |
674 static_assert(1 == TestInterface2::CONST_VALUE_1, "the value of TestInterfac
e2_CONST_VALUE_1 does not match with implementation"); | 652 static_assert(1 == TestInterface2::CONST_VALUE_1, "the value of TestInterfac
e2_CONST_VALUE_1 does not match with implementation"); |
675 { | 653 { |
676 v8::IndexedPropertyHandlerConfiguration config(TestInterface2V8Internal:
:indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPropertySetterC
allback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallback, indexedPro
pertyEnumerator<TestInterface2>); | 654 v8::IndexedPropertyHandlerConfiguration config(TestInterface2V8Internal:
:indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPropertySetterC
allback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallback, indexedPro
pertyEnumerator<TestInterface2>); |
677 functionTemplate->InstanceTemplate()->SetHandler(config); | 655 functionTemplate->InstanceTemplate()->SetHandler(config); |
678 } | 656 } |
679 { | 657 { |
680 v8::NamedPropertyHandlerConfiguration config(TestInterface2V8Internal::n
amedPropertyGetterCallback, TestInterface2V8Internal::namedPropertySetterCallbac
k, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterface2V8Interna
l::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPropertyEnumerat
orCallback); | 658 v8::NamedPropertyHandlerConfiguration config(TestInterface2V8Internal::n
amedPropertyGetterCallback, TestInterface2V8Internal::namedPropertySetterCallbac
k, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterface2V8Interna
l::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPropertyEnumerat
orCallback); |
| 659 config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(co
nfig.flags) | static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings))
; |
| 660 config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(co
nfig.flags) | static_cast<int>(v8::PropertyHandlerFlags::kNonMasking)); |
681 functionTemplate->InstanceTemplate()->SetHandler(config); | 661 functionTemplate->InstanceTemplate()->SetHandler(config); |
682 } | 662 } |
683 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI
teratorConfiguration = { v8::Symbol::GetIterator, TestInterface2V8Internal::iter
atorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; | 663 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI
teratorConfiguration = { v8::Symbol::GetIterator, TestInterface2V8Internal::iter
atorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; |
684 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu
re, v8::DontDelete, symbolKeyedIteratorConfiguration); | 664 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu
re, v8::DontDelete, symbolKeyedIteratorConfiguration); |
685 | 665 |
686 // Custom toString template | 666 // Custom toString template |
687 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | 667 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); |
688 } | 668 } |
689 | 669 |
690 v8::Local<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isola
te) | 670 v8::Local<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isola
te) |
(...skipping 20 matching lines...) Expand all Loading... |
711 { | 691 { |
712 scriptWrappable->toImpl<TestInterface2>()->ref(); | 692 scriptWrappable->toImpl<TestInterface2>()->ref(); |
713 } | 693 } |
714 | 694 |
715 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable) | 695 void V8TestInterface2::derefObject(ScriptWrappable* scriptWrappable) |
716 { | 696 { |
717 scriptWrappable->toImpl<TestInterface2>()->deref(); | 697 scriptWrappable->toImpl<TestInterface2>()->deref(); |
718 } | 698 } |
719 | 699 |
720 } // namespace blink | 700 } // namespace blink |
OLD | NEW |