| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 { | 678 { |
| 679 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 679 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 680 V8TestInterface::namedPropertySetterCustom(name, jsValue, info); | 680 V8TestInterface::namedPropertySetterCustom(name, jsValue, info); |
| 681 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 681 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 682 } | 682 } |
| 683 | 683 |
| 684 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 684 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 685 { | 685 { |
| 686 TestInterface* imp = V8TestInterface::toNative(info.Holder()); | 686 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
| 687 AtomicString propertyName = toCoreAtomicString(name); | 687 AtomicString propertyName = toCoreAtomicString(name); |
| 688 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 688 v8::String::Utf8Value namedProperty(name); |
| 689 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface", info.Holder(), info.GetIsolate()); |
| 689 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 690 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
| 690 if (exceptionState.throwIfNeeded()) | 691 if (exceptionState.throwIfNeeded()) |
| 691 return; | 692 return; |
| 692 if (!result) | 693 if (!result) |
| 693 return; | 694 return; |
| 694 v8SetReturnValueInt(info, v8::None); | 695 v8SetReturnValueInt(info, v8::None); |
| 695 } | 696 } |
| 696 | 697 |
| 697 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 698 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 698 { | 699 { |
| 699 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 700 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 700 TestInterfaceV8Internal::namedPropertyQuery(name, info); | 701 TestInterfaceV8Internal::namedPropertyQuery(name, info); |
| 701 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 702 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 702 } | 703 } |
| 703 | 704 |
| 704 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 705 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 705 { | 706 { |
| 706 TestInterface* imp = V8TestInterface::toNative(info.Holder()); | 707 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
| 707 Vector<String> names; | 708 Vector<String> names; |
| 708 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 709 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter
face", info.Holder(), info.GetIsolate()); |
| 709 imp->namedPropertyEnumerator(names, exceptionState); | 710 imp->namedPropertyEnumerator(names, exceptionState); |
| 710 if (exceptionState.throwIfNeeded()) | 711 if (exceptionState.throwIfNeeded()) |
| 711 return; | 712 return; |
| 712 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 713 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 713 for (size_t i = 0; i < names.size(); ++i) | 714 for (size_t i = 0; i < names.size(); ++i) |
| 714 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 715 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 715 v8SetReturnValue(info, v8names); | 716 v8SetReturnValue(info, v8names); |
| 716 } | 717 } |
| 717 | 718 |
| 718 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 719 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 } | 909 } |
| 909 | 910 |
| 910 template<> | 911 template<> |
| 911 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 912 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 912 { | 913 { |
| 913 return toV8(impl, creationContext, isolate); | 914 return toV8(impl, creationContext, isolate); |
| 914 } | 915 } |
| 915 | 916 |
| 916 } // namespace WebCore | 917 } // namespace WebCore |
| 917 #endif // ENABLE(Condition1) || ENABLE(Condition2) | 918 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
| OLD | NEW |