| 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 5244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5255 imp->notEnumerableVoidMethod(); | 5255 imp->notEnumerableVoidMethod(); |
| 5256 } | 5256 } |
| 5257 | 5257 |
| 5258 static void notEnumerableVoidMethodMethodCallback(const v8::FunctionCallbackInfo
<v8::Value>& info) | 5258 static void notEnumerableVoidMethodMethodCallback(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 5259 { | 5259 { |
| 5260 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 5260 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 5261 TestObjectPythonV8Internal::notEnumerableVoidMethodMethod(info); | 5261 TestObjectPythonV8Internal::notEnumerableVoidMethodMethod(info); |
| 5262 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 5262 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 5263 } | 5263 } |
| 5264 | 5264 |
| 5265 static void perContextEnabledVoidMethodMethod(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 5266 { |
| 5267 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
| 5268 imp->perContextEnabledVoidMethod(); |
| 5269 } |
| 5270 |
| 5271 static void perContextEnabledVoidMethodMethodCallback(const v8::FunctionCallback
Info<v8::Value>& info) |
| 5272 { |
| 5273 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 5274 TestObjectPythonV8Internal::perContextEnabledVoidMethodMethod(info); |
| 5275 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 5276 } |
| 5277 |
| 5265 } // namespace TestObjectPythonV8Internal | 5278 } // namespace TestObjectPythonV8Internal |
| 5266 | 5279 |
| 5267 static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib
utes[] = { | 5280 static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib
utes[] = { |
| 5268 {"readonlyStringAttribute", TestObjectPythonV8Internal::readonlyStringAttrib
uteAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 5281 {"readonlyStringAttribute", TestObjectPythonV8Internal::readonlyStringAttrib
uteAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 5269 {"readonlyTestInterfaceEmptyAttribute", TestObjectPythonV8Internal::readonly
TestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::
AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /*
on instance */}, | 5282 {"readonlyTestInterfaceEmptyAttribute", TestObjectPythonV8Internal::readonly
TestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::
AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /*
on instance */}, |
| 5270 {"readonlyLongAttribute", TestObjectPythonV8Internal::readonlyLongAttributeA
ttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 5283 {"readonlyLongAttribute", TestObjectPythonV8Internal::readonlyLongAttributeA
ttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 5271 {"dateAttribute", TestObjectPythonV8Internal::dateAttributeAttributeGetterCa
llback, TestObjectPythonV8Internal::dateAttributeAttributeSetterCallback, 0, 0,
0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribut
e>(v8::None), 0 /* on instance */}, | 5284 {"dateAttribute", TestObjectPythonV8Internal::dateAttributeAttributeGetterCa
llback, TestObjectPythonV8Internal::dateAttributeAttributeSetterCallback, 0, 0,
0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribut
e>(v8::None), 0 /* on instance */}, |
| 5272 {"stringAttribute", TestObjectPythonV8Internal::stringAttributeAttributeGett
erCallback, TestObjectPythonV8Internal::stringAttributeAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAt
tribute>(v8::None), 0 /* on instance */}, | 5285 {"stringAttribute", TestObjectPythonV8Internal::stringAttributeAttributeGett
erCallback, TestObjectPythonV8Internal::stringAttributeAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAt
tribute>(v8::None), 0 /* on instance */}, |
| 5273 {"readonlyDOMTimeStampAttribute", TestObjectPythonV8Internal::readonlyDOMTim
eStampAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContro
l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance
*/}, | 5286 {"readonlyDOMTimeStampAttribute", TestObjectPythonV8Internal::readonlyDOMTim
eStampAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContro
l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance
*/}, |
| 5274 {"booleanAttribute", TestObjectPythonV8Internal::booleanAttributeAttributeGe
tterCallback, TestObjectPythonV8Internal::booleanAttributeAttributeSetterCallbac
k, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Propert
yAttribute>(v8::None), 0 /* on instance */}, | 5287 {"booleanAttribute", TestObjectPythonV8Internal::booleanAttributeAttributeGe
tterCallback, TestObjectPythonV8Internal::booleanAttributeAttributeSetterCallbac
k, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Propert
yAttribute>(v8::None), 0 /* on instance */}, |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5664 void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle<v8::Objec
t> instance, TestObjectPython* impl, v8::Isolate* isolate) | 5677 void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle<v8::Objec
t> instance, TestObjectPython* impl, v8::Isolate* isolate) |
| 5665 { | 5678 { |
| 5666 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto
type()); | 5679 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto
type()); |
| 5667 if (ContextFeatures::featureNameEnabled(impl->document())) { | 5680 if (ContextFeatures::featureNameEnabled(impl->document())) { |
| 5668 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 5681 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
| 5669 {"perContextEnabledLongAttribute", TestObjectPythonV8Internal::perContex
tEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perCon
textEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on ins
tance */}; | 5682 {"perContextEnabledLongAttribute", TestObjectPythonV8Internal::perContex
tEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perCon
textEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on ins
tance */}; |
| 5670 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); | 5683 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); |
| 5671 } | 5684 } |
| 5672 } | 5685 } |
| 5673 | 5686 |
| 5687 void V8TestObjectPython::installPerContextEnabledPrototypeProperties(v8::Handle<
v8::Object> proto, v8::Isolate* isolate) |
| 5688 { |
| 5689 UNUSED_PARAM(proto); |
| 5690 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(i
solate, worldType(isolate))); |
| 5691 UNUSED_PARAM(defaultSignature); |
| 5692 |
| 5693 ExecutionContext* context = toExecutionContext(proto->CreationContext()); |
| 5694 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) |
| 5695 proto->Set(v8::String::NewSymbol("perContextEnabledVoidMethod"), v8::Fun
ctionTemplate::New(TestObjectPythonV8Internal::perContextEnabledVoidMethodMethod
Callback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| 5696 } |
| 5697 |
| 5674 v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPy
thon> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 5698 v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPy
thon> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 5675 { | 5699 { |
| 5676 ASSERT(impl); | 5700 ASSERT(impl); |
| 5677 ASSERT(!DOMDataStore::containsWrapper<V8TestObjectPython>(impl.get(), isolat
e)); | 5701 ASSERT(!DOMDataStore::containsWrapper<V8TestObjectPython>(impl.get(), isolat
e)); |
| 5678 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 5702 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 5679 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 5703 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 5680 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 5704 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 5681 // the same object de-ref functions, though, so use that as the basis of
the check. | 5705 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 5682 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 5706 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 5683 } | 5707 } |
| 5684 | 5708 |
| 5685 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 5709 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 5686 if (UNLIKELY(wrapper.IsEmpty())) | 5710 if (UNLIKELY(wrapper.IsEmpty())) |
| 5687 return wrapper; | 5711 return wrapper; |
| 5688 | 5712 |
| 5689 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 5713 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 5690 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT
ypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 5714 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT
ypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 5691 return wrapper; | 5715 return wrapper; |
| 5692 } | 5716 } |
| 5693 | 5717 |
| 5694 void V8TestObjectPython::derefObject(void* object) | 5718 void V8TestObjectPython::derefObject(void* object) |
| 5695 { | 5719 { |
| 5696 fromInternalPointer(object)->deref(); | 5720 fromInternalPointer(object)->deref(); |
| 5697 } | 5721 } |
| 5698 | 5722 |
| 5699 } // namespace WebCore | 5723 } // namespace WebCore |
| OLD | NEW |