| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 static void testInterfacePythonAttributeAttributeGetterCallback(v8::Local<v8::St
ring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 90 static void testInterfacePythonAttributeAttributeGetterCallback(v8::Local<v8::St
ring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 91 { | 91 { |
| 92 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 92 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 93 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeGetter(info); | 93 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeGetter(info); |
| 94 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 94 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 95 } | 95 } |
| 96 | 96 |
| 97 static void testInterfacePythonAttributeAttributeSetter(v8::Local<v8::Value> jsV
alue, const v8::PropertyCallbackInfo<void>& info) | 97 static void testInterfacePythonAttributeAttributeSetter(v8::Local<v8::Value> jsV
alue, const v8::PropertyCallbackInfo<void>& info) |
| 98 { | 98 { |
| 99 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 99 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 100 V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfac
ePython::hasInstance(jsValue, info.GetIsolate(), worldType(info.GetIsolate())) ?
V8TestInterfacePython::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); | 100 V8TRYCATCH_VOID(TestInterfacePythonImplementation*, cppValue, V8TestInterfac
ePython::hasInstance(jsValue, info.GetIsolate()) ? V8TestInterfacePython::toNati
ve(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 101 imp->setTestInterfacePythonAttribute(WTF::getPtr(cppValue)); | 101 imp->setTestInterfacePythonAttribute(WTF::getPtr(cppValue)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 static void testInterfacePythonAttributeAttributeSetterCallback(v8::Local<v8::St
ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 104 static void testInterfacePythonAttributeAttributeSetterCallback(v8::Local<v8::St
ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 105 { | 105 { |
| 106 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 107 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeSetter(jsValue, info); | 107 TestInterfacePythonImplementationV8Internal::testInterfacePythonAttributeAtt
ributeSetter(jsValue, info); |
| 108 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 108 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 109 } | 109 } |
| 110 | 110 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 273 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 274 { | 274 { |
| 275 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 275 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 276 TestInterfacePythonImplementationV8Internal::implementsNodeAttributeAttribut
eGetter(info); | 276 TestInterfacePythonImplementationV8Internal::implementsNodeAttributeAttribut
eGetter(info); |
| 277 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 277 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 278 } | 278 } |
| 279 | 279 |
| 280 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 280 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
| 281 { | 281 { |
| 282 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 282 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 283 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat
e(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Ca
st(jsValue)) : 0); | 283 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat
e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 284 TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue)); | 284 TestImplements::setImplementsNodeAttribute(imp, WTF::getPtr(cppValue)); |
| 285 } | 285 } |
| 286 | 286 |
| 287 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 287 static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 288 { | 288 { |
| 289 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 289 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 290 TestInterfacePythonImplementationV8Internal::implementsNodeAttributeAttribut
eSetter(jsValue, info); | 290 TestInterfacePythonImplementationV8Internal::implementsNodeAttributeAttribut
eSetter(jsValue, info); |
| 291 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 291 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 292 } | 292 } |
| 293 | 293 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc
al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 328 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc
al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 329 { | 329 { |
| 330 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 330 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 331 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeGetter(info); | 331 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeGetter(info); |
| 332 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 332 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 333 } | 333 } |
| 334 | 334 |
| 335 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V
alue> jsValue, const v8::PropertyCallbackInfo<void>& info) | 335 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V
alue> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 336 { | 336 { |
| 337 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 337 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 338 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat
e(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Ca
st(jsValue)) : 0); | 338 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat
e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 339 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp
pValue)); | 339 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp
pValue)); |
| 340 } | 340 } |
| 341 | 341 |
| 342 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc
al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) | 342 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc
al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) |
| 343 { | 343 { |
| 344 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 344 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 345 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeSetter(jsValue, info); | 345 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeSetter(jsValue, info); |
| 346 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 346 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 654 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 655 { | 655 { |
| 656 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC
omplexMethod", "TestInterfacePython", info.Holder(), info.GetIsolate()); | 656 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC
omplexMethod", "TestInterfacePython", info.Holder(), info.GetIsolate()); |
| 657 if (UNLIKELY(info.Length() < 2)) { | 657 if (UNLIKELY(info.Length() < 2)) { |
| 658 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 658 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
| 659 exceptionState.throwIfNeeded(); | 659 exceptionState.throwIfNeeded(); |
| 660 return; | 660 return; |
| 661 } | 661 } |
| 662 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 662 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 663 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); | 663 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); |
| 664 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolate())) ? V8
TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0); | 664 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v
8::Handle<v8::Object>::Cast(info[1])) : 0); |
| 665 ExecutionContext* scriptContext = getExecutionContext(); | 665 ExecutionContext* scriptContext = getExecutionContext(); |
| 666 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(
scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState); | 666 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(
scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState); |
| 667 if (exceptionState.throwIfNeeded()) | 667 if (exceptionState.throwIfNeeded()) |
| 668 return; | 668 return; |
| 669 v8SetReturnValue(info, result.release()); | 669 v8SetReturnValue(info, result.release()); |
| 670 } | 670 } |
| 671 | 671 |
| 672 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo
<v8::Value>& info) | 672 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 673 { | 673 { |
| 674 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 674 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 return result->value.newLocal(isolate); | 971 return result->value.newLocal(isolate); |
| 972 | 972 |
| 973 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 973 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 974 v8::EscapableHandleScope handleScope(isolate); | 974 v8::EscapableHandleScope handleScope(isolate); |
| 975 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 975 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 976 configureV8TestInterfacePythonTemplate(templ, isolate, currentWorldType); | 976 configureV8TestInterfacePythonTemplate(templ, isolate, currentWorldType); |
| 977 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 977 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 978 return handleScope.Escape(templ); | 978 return handleScope.Escape(templ); |
| 979 } | 979 } |
| 980 | 980 |
| 981 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate, WrapperWorldType currentWorldType) | 981 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate) |
| 982 { | 982 { |
| 983 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 983 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 984 } | 984 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 985 | |
| 986 bool V8TestInterfacePython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | |
| 987 { | |
| 988 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 989 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 990 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 991 } | 985 } |
| 992 | 986 |
| 993 ActiveDOMObject* V8TestInterfacePython::toActiveDOMObject(v8::Handle<v8::Object>
wrapper) | 987 ActiveDOMObject* V8TestInterfacePython::toActiveDOMObject(v8::Handle<v8::Object>
wrapper) |
| 994 { | 988 { |
| 995 return toNative(wrapper); | 989 return toNative(wrapper); |
| 996 } | 990 } |
| 997 | 991 |
| 998 void V8TestInterfacePython::derefObject(void* object) | 992 void V8TestInterfacePython::derefObject(void* object) |
| 999 { | 993 { |
| 1000 fromInternalPointer(object)->deref(); | 994 fromInternalPointer(object)->deref(); |
| 1001 } | 995 } |
| 1002 | 996 |
| 1003 template<> | 997 template<> |
| 1004 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 998 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 1005 { | 999 { |
| 1006 return toV8(impl, creationContext, isolate); | 1000 return toV8(impl, creationContext, isolate); |
| 1007 } | 1001 } |
| 1008 | 1002 |
| 1009 } // namespace WebCore | 1003 } // namespace WebCore |
| 1010 #endif // ENABLE(CONDITION) | 1004 #endif // ENABLE(CONDITION) |
| OLD | NEW |