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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | 448 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
449 bool result0Enabled = false; | 449 bool result0Enabled = false; |
450 RefPtr<Node> result0; | 450 RefPtr<Node> result0; |
451 bool result1Enabled = false; | 451 bool result1Enabled = false; |
452 RefPtr<NodeList> result1; | 452 RefPtr<NodeList> result1; |
453 imp->getItem(name, result0Enabled, result0, result1Enabled, result1); | 453 imp->getItem(name, result0Enabled, result0, result1Enabled, result1); |
454 if (result0Enabled) { | 454 if (result0Enabled) { |
455 v8SetReturnValue(info, result0.release()); | 455 v8SetReturnValue(info, result0.release()); |
456 return; | 456 return; |
457 } | 457 } |
458 | |
459 if (result1Enabled) { | 458 if (result1Enabled) { |
460 v8SetReturnValue(info, result1.release()); | 459 v8SetReturnValue(info, result1.release()); |
461 return; | 460 return; |
462 } | 461 } |
463 | |
464 v8SetReturnValueNull(info); | 462 v8SetReturnValueNull(info); |
465 } | 463 } |
466 | 464 |
467 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 465 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
468 { | 466 { |
469 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 467 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
470 TestInterfaceV8Internal::namedItemMethod(info); | 468 TestInterfaceV8Internal::namedItemMethod(info); |
471 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 469 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
472 } | 470 } |
473 | 471 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 619 |
622 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 620 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
623 { | 621 { |
624 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 622 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
625 return; | 623 return; |
626 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 624 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
627 return; | 625 return; |
628 if (info.Holder()->HasRealNamedProperty(name)) | 626 if (info.Holder()->HasRealNamedProperty(name)) |
629 return; | 627 return; |
630 | 628 |
631 TestInterface* collection = V8TestInterface::toNative(info.Holder()); | 629 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
632 AtomicString propertyName = toCoreAtomicString(name); | 630 AtomicString propertyName = toCoreAtomicString(name); |
633 bool element0Enabled = false; | 631 bool result0Enabled = false; |
634 RefPtr<Node> element0; | 632 RefPtr<Node> result0; |
635 bool element1Enabled = false; | 633 bool result1Enabled = false; |
636 RefPtr<NodeList> element1; | 634 RefPtr<NodeList> result1; |
637 collection->getItem(propertyName, element0Enabled, element0, element1Enabled
, element1); | 635 imp->getItem(propertyName, result0Enabled, result0, result1Enabled, result1)
; |
638 if (!element0Enabled && !element1Enabled) | 636 if (!result0Enabled && !result1Enabled) |
639 return; | 637 return; |
640 if (element0Enabled) { | 638 if (result0Enabled) { |
641 v8SetReturnValueFast(info, element0.release(), collection); | 639 v8SetReturnValueFast(info, result0.release(), imp); |
642 return; | 640 return; |
643 } | 641 } |
644 | 642 if (result1Enabled) { |
645 if (element1Enabled) { | 643 v8SetReturnValueFast(info, result1.release(), imp); |
646 v8SetReturnValueFast(info, element1.release(), collection); | |
647 return; | 644 return; |
648 } | 645 } |
649 | |
650 v8SetReturnValueNull(info); | 646 v8SetReturnValueNull(info); |
651 } | 647 } |
652 | 648 |
653 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 649 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
654 { | 650 { |
655 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 651 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
656 TestInterfaceV8Internal::namedPropertyGetter(name, info); | 652 TestInterfaceV8Internal::namedPropertyGetter(name, info); |
657 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 653 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
658 } | 654 } |
659 | 655 |
660 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 656 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
661 { | 657 { |
662 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 658 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
663 V8TestInterface::namedPropertySetterCustom(name, jsValue, info); | 659 V8TestInterface::namedPropertySetterCustom(name, jsValue, info); |
664 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 660 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
665 } | 661 } |
666 | 662 |
667 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 663 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
668 { | 664 { |
669 TestInterface* collection = V8TestInterface::toNative(info.Holder()); | 665 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
670 AtomicString propertyName = toCoreAtomicString(name); | 666 AtomicString propertyName = toCoreAtomicString(name); |
671 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 667 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
672 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 668 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
673 if (exceptionState.throwIfNeeded()) | 669 if (exceptionState.throwIfNeeded()) |
674 return; | 670 return; |
675 if (!result) | 671 if (!result) |
676 return; | 672 return; |
677 v8SetReturnValueInt(info, v8::None); | 673 v8SetReturnValueInt(info, v8::None); |
678 } | 674 } |
679 | 675 |
680 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 676 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
681 { | 677 { |
682 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 678 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
683 TestInterfaceV8Internal::namedPropertyQuery(name, info); | 679 TestInterfaceV8Internal::namedPropertyQuery(name, info); |
684 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 680 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
685 } | 681 } |
686 | 682 |
687 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 683 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
688 { | 684 { |
689 TestInterface* collection = V8TestInterface::toNative(info.Holder()); | 685 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
690 Vector<String> names; | 686 Vector<String> names; |
691 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 687 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
692 collection->namedPropertyEnumerator(names, exceptionState); | 688 imp->namedPropertyEnumerator(names, exceptionState); |
693 if (exceptionState.throwIfNeeded()) | 689 if (exceptionState.throwIfNeeded()) |
694 return; | 690 return; |
695 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 691 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
696 for (size_t i = 0; i < names.size(); ++i) | 692 for (size_t i = 0; i < names.size(); ++i) |
697 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 693 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
698 v8SetReturnValue(info, v8names); | 694 v8SetReturnValue(info, v8names); |
699 } | 695 } |
700 | 696 |
701 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 697 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
702 { | 698 { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 } | 882 } |
887 | 883 |
888 template<> | 884 template<> |
889 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 885 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
890 { | 886 { |
891 return toV8(impl, creationContext, isolate); | 887 return toV8(impl, creationContext, isolate); |
892 } | 888 } |
893 | 889 |
894 } // namespace WebCore | 890 } // namespace WebCore |
895 #endif // ENABLE(Condition1) || ENABLE(Condition2) | 891 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
OLD | NEW |