| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp
pValue)); | 357 TestImplements::setImplementsRuntimeEnabledNodeAttribute(imp, WTF::getPtr(cp
pValue)); |
| 358 } | 358 } |
| 359 | 359 |
| 360 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc
al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) | 360 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc
al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) |
| 361 { | 361 { |
| 362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 363 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeSetter(jsValue, info); | 363 TestInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAtt
ributeAttributeSetter(jsValue, info); |
| 364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 365 } | 365 } |
| 366 | 366 |
| 367 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 368 { |
| 369 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 370 v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAt
tribute(imp), imp); |
| 371 } |
| 372 |
| 373 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8::
Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 374 { |
| 375 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 376 TestInterfacePythonImplementationV8Internal::implementsPerContextEnabledNode
AttributeAttributeGetter(info); |
| 377 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 378 } |
| 379 |
| 380 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 381 { |
| 382 ExceptionState exceptionState(ExceptionState::SetterContext, "implementsPerC
ontextEnabledNodeAttribute", "TestInterfacePython", info.Holder(), info.GetIsola
te()); |
| 383 if (!isUndefinedOrNull(jsValue) && !V8Node::hasInstance(jsValue, info.GetIso
late())) { |
| 384 exceptionState.throwTypeError("The provided value is not of type 'Node'.
"); |
| 385 exceptionState.throwIfNeeded(); |
| 386 return; |
| 387 } |
| 388 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
| 389 V8TRYCATCH_VOID(Node*, cppValue, V8Node::hasInstance(jsValue, info.GetIsolat
e()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 390 TestImplements::setImplementsPerContextEnabledNodeAttribute(imp, WTF::getPtr
(cppValue)); |
| 391 } |
| 392 |
| 393 static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8::
Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<
void>& info) |
| 394 { |
| 395 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 396 TestInterfacePythonImplementationV8Internal::implementsPerContextEnabledNode
AttributeAttributeSetter(jsValue, info); |
| 397 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 398 } |
| 399 |
| 367 static void implements2StaticStringAttributeAttributeGetter(const v8::PropertyCa
llbackInfo<v8::Value>& info) | 400 static void implements2StaticStringAttributeAttributeGetter(const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 368 { | 401 { |
| 369 v8SetReturnValueString(info, TestImplements2Implementation::implements2Stati
cStringAttribute(), info.GetIsolate()); | 402 v8SetReturnValueString(info, TestImplements2Implementation::implements2Stati
cStringAttribute(), info.GetIsolate()); |
| 370 } | 403 } |
| 371 | 404 |
| 372 static void implements2StaticStringAttributeAttributeGetterCallback(v8::Local<v8
::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 405 static void implements2StaticStringAttributeAttributeGetterCallback(v8::Local<v8
::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 373 { | 406 { |
| 374 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 407 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 375 TestInterfacePythonImplementationV8Internal::implements2StaticStringAttribut
eAttributeGetter(info); | 408 TestInterfacePythonImplementationV8Internal::implements2StaticStringAttribut
eAttributeGetter(info); |
| 376 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 409 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 1056 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 1024 return handleScope.Escape(templ); | 1057 return handleScope.Escape(templ); |
| 1025 } | 1058 } |
| 1026 | 1059 |
| 1027 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate) | 1060 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate) |
| 1028 { | 1061 { |
| 1029 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 1062 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 1030 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 1063 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 1031 } | 1064 } |
| 1032 | 1065 |
| 1066 void V8TestInterfacePython::installPerContextEnabledProperties(v8::Handle<v8::Ob
ject> instanceTemplate, TestInterfacePythonImplementation* impl, v8::Isolate* is
olate) |
| 1067 { |
| 1068 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan
ceTemplate->GetPrototype()); |
| 1069 if (ContextFeatures::implementsContextNameEnabled(impl->document())) { |
| 1070 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
| 1071 {"implementsPerContextEnabledNodeAttribute", TestInterfacePythonImplemen
tationV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetterCallbac
k, TestInterfacePythonImplementationV8Internal::implementsPerContextEnabledNodeA
ttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEF
AULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; |
| 1072 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); |
| 1073 } |
| 1074 } |
| 1075 |
| 1033 ActiveDOMObject* V8TestInterfacePython::toActiveDOMObject(v8::Handle<v8::Object>
wrapper) | 1076 ActiveDOMObject* V8TestInterfacePython::toActiveDOMObject(v8::Handle<v8::Object>
wrapper) |
| 1034 { | 1077 { |
| 1035 return toNative(wrapper); | 1078 return toNative(wrapper); |
| 1036 } | 1079 } |
| 1037 | 1080 |
| 1038 void V8TestInterfacePython::derefObject(void* object) | 1081 void V8TestInterfacePython::derefObject(void* object) |
| 1039 { | 1082 { |
| 1040 fromInternalPointer(object)->deref(); | 1083 fromInternalPointer(object)->deref(); |
| 1041 } | 1084 } |
| 1042 | 1085 |
| 1043 template<> | 1086 template<> |
| 1044 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 1087 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 1045 { | 1088 { |
| 1046 return toV8(impl, creationContext, isolate); | 1089 return toV8(impl, creationContext, isolate); |
| 1047 } | 1090 } |
| 1048 | 1091 |
| 1049 } // namespace WebCore | 1092 } // namespace WebCore |
| 1050 #endif // ENABLE(CONDITION) | 1093 #endif // ENABLE(CONDITION) |
| OLD | NEW |